Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

mkl_dcsrbsr gives segmentation fault

Li__Yishui
Beginner
296 Views

 

when I use mkl_dcsrbsr to convert a large CSR matrix into BSR, it will give me segmentation fault. But it run correctly, when the matrix size is small.

 

here is my code(my icc version is 15.0.1)

//m is the dimension of CSR matrix and nnz is the number of non zero element in this matrix 
double *acsr;
 acsr = (double *)mkl_malloc(*nnz*sizeof(double), 64);//data in csr
 int *ja, *ia;
 ja = (int *)mkl_malloc(*nnz*sizeof(int), 64);//column in csr
 ia = (int *)mkl_malloc((*m + 1)*sizeof(int), 64);//row in csr
 
//read the CSR matrix
int *mblk,*ldabsr;
 mblk = (int *)mkl_malloc(sizeof(int), 64);
 ldabsr = (int *)mkl_malloc(sizeof(int), 64);
 
 *mblk = 4; *ldabsr = 16;
 double *absr;
 absr = (double*)mkl_malloc(((*nnz)*(*mblk)*(*mblk))*sizeof(double *), 64);//data in bsr

 int *jab, *iab;
 int ld = (*m) / (*mblk) + 1;
 jab = (int *)mkl_malloc(ld*ld*sizeof(int), 64);//column in bsr
 iab = (int *)mkl_malloc((*m+1)*sizeof(int),64);
 
 int *job;
 job = (int *)mkl_malloc(6 * sizeof(int), 64);
 job[0] = 0; job[1] = 0; job[2] = 0; job[5] = 3;
 int *info; info = (int *)mkl_malloc(sizeof(int), 64);
 mkl_dcsrbsr(job, m, mblk, ldabsr, acsr, ja, ia, absr, jab, iab, info);
 
I want to know what's wrong with my code or this function cannot convert big matrix?
thank you ~ :)
0 Kudos
2 Replies
mecej4
Honored Contributor III
296 Views

Please provide complete test source codes that can be compiled and run, along with matrix data files, for (i) a case where the run is correct, and (ii) a case where the program crashes.

0 Kudos
Li__Yishui
Beginner
296 Views

here are my code and matrix 

thanks for your help ~

0 Kudos
Reply