topic Problem with mkl_dcsrmultcsr in IntelĀ® oneAPI Math Kernel Library
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problem-with-mkl-dcsrmultcsr/m-p/825993#M5114
Hello! <BR />I'm using mkl_dcsrmultcsr to find a product of sparse matrices, "A" and "B". "A" has many zeros in the array of nonzero elements (because I need so). Result (matrix "C" in csr format) is incorrect. In particular, half of the array jC consists of correct numbers, an there are zeros with some random numbers (pretty big, some of them are negative) in other half. It results in segmentation fault in the following code. How can zeros be in jC? It seems to be malfunctioning of procedure. Most arrays in my program are allocatable, many allocate-deallocate operators, so maybe there is a clue.<BR />Also, I noted some "intresting" thing. If I print two integer variables in the beginning of the code (write(*,*) m,n), there are 0's and some 1's in second half of jC, no big random numbers. And following code works properly, on some stage second half of jC somehow isn't referenced, and products of other matrix are correct. So do happen in the first case (without printing m,n), when biggest positive random number in jC is 10^4, not 10^10.<BR /><BR />I'm not an experienced programmer (how you may've seen), so I understand, that I could miss some simple and well-known things, but in that case you will not spend much time to correct me, I suppose :)<BR /><BR />Version of MKL:<BR />Major version:10<BR />Minor version:2<BR />Update version:7<BR />Product status:Product<BR />Build:20101126<BR />Processor optimization:Intel Core 2 Duo Processor<BR /><BR />Program is running on cluster with Xeon's 8-core nodes.<BR />Wed, 21 Sep 2011 13:14:41 GMTDuke_K2011-09-21T13:14:41ZProblem with mkl_dcsrmultcsr
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problem-with-mkl-dcsrmultcsr/m-p/825993#M5114
Hello! <BR />I'm using mkl_dcsrmultcsr to find a product of sparse matrices, "A" and "B". "A" has many zeros in the array of nonzero elements (because I need so). Result (matrix "C" in csr format) is incorrect. In particular, half of the array jC consists of correct numbers, an there are zeros with some random numbers (pretty big, some of them are negative) in other half. It results in segmentation fault in the following code. How can zeros be in jC? It seems to be malfunctioning of procedure. Most arrays in my program are allocatable, many allocate-deallocate operators, so maybe there is a clue.<BR />Also, I noted some "intresting" thing. If I print two integer variables in the beginning of the code (write(*,*) m,n), there are 0's and some 1's in second half of jC, no big random numbers. And following code works properly, on some stage second half of jC somehow isn't referenced, and products of other matrix are correct. So do happen in the first case (without printing m,n), when biggest positive random number in jC is 10^4, not 10^10.<BR /><BR />I'm not an experienced programmer (how you may've seen), so I understand, that I could miss some simple and well-known things, but in that case you will not spend much time to correct me, I suppose :)<BR /><BR />Version of MKL:<BR />Major version:10<BR />Minor version:2<BR />Update version:7<BR />Product status:Product<BR />Build:20101126<BR />Processor optimization:Intel Core 2 Duo Processor<BR /><BR />Program is running on cluster with Xeon's 8-core nodes.<BR />Wed, 21 Sep 2011 13:14:41 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problem-with-mkl-dcsrmultcsr/m-p/825993#M5114Duke_K2011-09-21T13:14:41ZProblem with mkl_dcsrmultcsr
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problem-with-mkl-dcsrmultcsr/m-p/825994#M5115
<P>Hello, <BR /><BR />I'd assume that the root cause of the behavior described by you is that it is not enough memory for storing the result matrix. I'd recommend you to allocate the integer array ic of the size n+1 where n is the number of rows in the the result matrix. Then please call the routine with job=1<BR /> job=1<BR /> call mkl_dcsrmultcsr(trans, job, sort, n, n, n, a,ja,ia, a, ja,ia, ddum, idum, ic, idum, idum)<BR /><BR />After that thevalue of ic(n+1)-1 is the exact size of jC and C. After allocation of jC and C, the routine should be called again with job=2 to fill Jc and C.<BR /><BR />Another possible reason of the failures is that the column indices of the matrix <VAR>A or the matrix B </VAR>are not arranged in the increasing order for each row. I'd recommend to set the parameter sort to 3. </P><P>Please provide a test case for reproducing the issue if above suggestions dont workfor you.</P><P>All the best</P><P>Sergey</P><P></P>Thu, 22 Sep 2011 08:02:01 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Problem-with-mkl-dcsrmultcsr/m-p/825994#M5115Sergey_K_Intel12011-09-22T08:02:01Z