csrcoo garbles unsorted complex16 matrices

csrcoo garbles unsorted complex16 matrices

While using csrcoo to convert an unsorted (rows and colums) complex16 (double precision complex) matrix from COO to CSR using the option to sort the columns in the output, I discovered the array of matrix values gets garbled during the sort. The same operation appears to work if the input is already sorted, or using any other data type.

I'm guessing there's something wrong in how it handles swapping/gathering the data in the value arrray. Can anyone confirm?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Zhang Z (Intel)'s picture

Would you please provide a simple test case, including a sparse matrix and a code snippet showing how you call mkl_zcsrcoo?

And I also need information on the version of MKL and your OS.

Thanks.

A small program demonstrating my problem is attached. I am running Linux and using MKL 11.0.

Attachments: 

AttachmentSize
Download example.zip1.27 KB
mecej4's picture

I can confirm that the problem exists also on Windows 7, MKL 10.3.12 and 11.0.2, 32- or 64-bit. The example code below has the values of the "val" array contrived such that they are also in sort order when printed out.


program tcnv

integer,parameter :: n=8,nnz=12

integer :: irow(nnz)=(/ 7, 5, 2, 0, 4, 0, 1, 6, 5, 6, 5, 3 /)

integer :: icol(nnz)=(/ 7, 2, 2, 1, 4, 0, 1, 6, 7, 1, 5, 2 /)

!order                  C  7  4  2  6  1  3  B  9  A  8  5

complex*16 :: val(nnz)=(/(12,22),(7,17),(4,14),(2,12),(6,16),(1,11), &

                         (3,13),(11,21),(9,19),(10,20),(8,18),(5,15)/)

complex*16 :: acsr(nnz)

integer :: job(6)=(/2,0,0,0,nnz,0/)

integer :: rowptr(n+1),colind(nnz)

character*198 :: vers

!

call mkl_get_version_string(vers)

write(*,'(A)')vers

call mkl_zcsrcoo(job,n,acsr,colind,rowptr,nnz,val,irow,icol,info)

do i=1,nnz

   write(*,'(1x,i3,2x,2F8.1)')i,acsr(i)

end do

end program tcnv

The output is not correct:


   1      12.0     2.0

   2       1.0    11.0

   3       3.0    13.0

   4       4.0     5.0

   5      14.0     6.0

   6      15.0    16.0

   7       7.0    17.0

   8       9.0    19.0

   9       8.0    18.0

  10      11.0    21.0

  11      10.0    20.0

  12      12.0    22.0

Change the array to COMPLEX*8 and mkl_zcsrcoo to mkl_ccsrcoo, and you get


   1       1.0    11.0

   2       2.0    12.0

   3       3.0    13.0

   4       4.0    14.0

   5       5.0    15.0

   6       6.0    16.0

   7       7.0    17.0

   8       8.0    18.0

   9       9.0    19.0

  10      10.0    20.0

  11      11.0    21.0

  12      12.0    22.0

Zhang Z (Intel)'s picture

This does look like a bug. This issue is now escalated to the MKL engineering team. Thanks for catching it!

Login to leave a comment.