Community
cancel
Showing results for 
Search instead for 
Did you mean: 
chao_n_
Beginner
171 Views

Deal with huge matrix

I have written some codes with MKL library, but recently these codes do not work. They can be complied well and do not report any error when I run it. However, they did not work for some huge matrix operations. They keep running, but no results return. Here is an example code. When the variable nID exceed 31, the program will keep running forever.

#include <stdio.h>

#include <mkl.h>

int main(){

int nID=31;

int nSNP=33;

double *mMatrix = (double*) calloc(nID*nSNP,sizeof(double));

double *AGmatrix = (double*) calloc(nID*nID,sizeof(double));

    const CBLAS_LAYOUT Layout=CblasRowMajor;

    double alpha=1;

    double beta=0;

    cblas_dgemm (Layout, CblasTrans, CblasNoTrans, nID, nID, nSNP, alpha, mMatrix, 

nID, mMatrix, nID, beta, AGmatrix, nID);

0 Kudos
7 Replies
TimP
Black Belt
171 Views

I suppose you had in mind some other compiler, but I tried to make a VS gui project with a recent Intel C++ for Intel64, hoping to run under debug. I had several issues with source code format and line terminators. I wasn't able to get the mkl include path working.  At command line, I was able to build, but I got immediate return to command prompt when running.

It doesn't appear that you should be approaching default limits for stack or (if in 32-bit mode) heap space, but you leave us guessing.

Ying_H_Intel
Employee
171 Views

Hi Chao, 

Could you please tell some details like the OS, 32bit or 64bit, how do you compile the mkl program? 

for example, we run it in Red Hat Enterprise Linux Server release 6.3 on machine with16 core  . with command line

source /opt/intel/mkl/bin/mklvars.sh  intel64

$ g++ main.cpp -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lm
$ ./a.out

it just run fine. 

 

Best Regards,

Ying 

Ying_H_Intel
Employee
171 Views

Hi Chao, 

You can

>export MKL_VERBOSE=1

>a.out

and let us know the result. 

Best Regards,
Ying 

chao_n_
Beginner
171 Views

Ying H. (Intel) wrote:

Hi Chao, 

You can

>export MKL_VERBOSE=1

>a.out

and let us know the result. 

Best Regards,
Ying 

I'm sorry. I still keep running.

[ningc@localhost sig]$ gcc -lmkl_intel_lp64 -lmkl_intel_thread -liomp5 -lmkl_core\
>  -lpthread -lm test.c
[ningc@localhost sig]$ export MKL_VERBOSE=1
[ningc@localhost sig]$ ./a.out
chao_n_
Beginner
171 Views

chao n. wrote:

Quote:

Ying H. (Intel) wrote:

 

Hi Chao, 

You can

>export MKL_VERBOSE=1

>a.out

and let us know the result. 

Best Regards,
Ying 

 

 

I'm sorry. It still keep running.

[ningc@localhost sig]$ gcc -lmkl_intel_lp64 -lmkl_intel_thread -liomp5 -lmkl_core\

>  -lpthread -lm test.c

[ningc@localhost sig]$ export MKL_VERBOSE=1

[ningc@localhost sig]$ ./a.out

When I set nID=31

[ningc@localhost sig]$ ./a.out
MKL_VERBOSE Intel(R) MKL 11.3 Update 3 Product build 20160413 for Intel(R) 64 architecture Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled processors, Lnx 2.00GHz lp64 intel_thread NMICDev:0
MKL_VERBOSE DGEMM(N,T,31,31,33,0x7fffdf46b9d0,0x20ed010,31,0x20ed010,31,0x7fffdf46b9d8,0x20ef010,31) 80.88ms CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:32 WDiv:HOST:+0.000
Ying_H_Intel
Employee
171 Views

Hi 

When set nID=32,32,33, my output is like below 

[yhu5@snb04 mkl_issue]$ ./a.out

Error getting SCIF driver version
MKL_VERBOSE Intel(R) MKL 11.3 Update 3 Product build 20160413 for Intel(R) 64 architecture Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled processors, Lnx 2.70GHz lp64 intel_thread NMICDev:0
MKL_VERBOSE DGEMM(N,T,32,32,33,0x7fffa3280650,0x165e010,32,0x165e010,32,0x7fffa3280658,0x1660120,32) 3.61ms CNR:SSE4_2 Dyn:1 FastMM:1 TID:0  NThr:16 WDiv:HOST:+0.000

 

The  notable places is maybe the machine type be "   Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled processors. and thread number". 

Do you have other machine to test the code?   and for thread number , how about if you 

>export MKL_NUM_THREADS=1

>a.out?

Best Regards,
Ying 

 

 

chao_n_
Beginner
171 Views

Hi

When set export MKL_NUM_THREADS=1, it work well.

However, I can not set more than one threads. How can I solve the problem?

Ying H. (Intel) wrote:

Hi 

When set nID=32,32,33, my output is like below 

[yhu5@snb04 mkl_issue]$ ./a.out

Error getting SCIF driver version
MKL_VERBOSE Intel(R) MKL 11.3 Update 3 Product build 20160413 for Intel(R) 64 architecture Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled processors, Lnx 2.70GHz lp64 intel_thread NMICDev:0
MKL_VERBOSE DGEMM(N,T,32,32,33,0x7fffa3280650,0x165e010,32,0x165e010,32,0x7fffa3280658,0x1660120,32) 3.61ms CNR:SSE4_2 Dyn:1 FastMM:1 TID:0  NThr:16 WDiv:HOST:+0.000

 

The  notable places is maybe the machine type be "   Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled processors. and thread number". 

Do you have other machine to test the code?   and for thread number , how about if you 

>export MKL_NUM_THREADS=1

>a.out?

Best Regards,
Ying 

 

 

Reply