Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- Questions & Puzzled about mkl_sparse_spmm

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

wen_qiang_z_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-04-2018
07:16 PM

6 Views

Questions & Puzzled about mkl_sparse_spmm

Hi, I`m very very very anxious now because of the using of mkl_sparse_spmm function always feedback me an error beyond my understanding. When I trying to compute the product of two sparse matrix created by mkl_sparse_csr_create function, for the foremost, everything tends to be good, but when I tried to compute it again, an Access Conflict error appeared and I have no idea why this error shows.

Here is part of my codes

do i = 1, 5

!*steps to compute the values needed are ignored,and I `ve tested them to make sure they`re correct*!

!create sparse matrix, this step is right and the stat = 0

stat=mkl_sparse_z_create_csr(local(i)%Krc%B,sparse_index_base_one,sub(i)%temp, &

sub(i)%Noc,local(i)%rows_start,local(i)%rows_end,local(i)%col_indx,local(i)%values)

write(*,*) stat

!create sparse matrix, this step is right and the stat = 0

stat=mkl_sparse_z_create_csr(local(i)%Kcr%A,sparse_index_base_one,&

local(i)%Kcr%rows,local(i)%Kcr%cols,local(i)%Kcr%rows_start,local(i)%Kcr%rows_end,&

local(i)%Kcr%col_indx,local(i)%Kcr%values)

write(*,*) stat

!compute the product

info = mkl_sparse_spmm(sparse_operation_non_transpose,local(i)%Kcr%A,local(i)%Krc%B,local(i)%Kcr%B)

write(*,*) info

end do

At the first loop for i == 1, it seems good, bu when it turns to the loop for i == 2, then the compiler feedback an error of Access Conflict which confuses me most. I can make sure that the sparse matrices are correct. and I did not deallocate the memory or destroy the sparse matrix handle ,so I have no ides why this situation shows.

Can U help me?

6 Replies

Highlighted
##

In general, when you call a matrix routine that takes two input matrices A and B and produces an output matrix C, C should not be the same as A or B. This is because (i) if C is the same as A, for example, some elements of C may be computed and overwritten (into A) and the same elements of A read later, which would cause the results to be wrong; and (ii) in Fortran, there are what are often called "anti-aliasing" rules that say that changes to the contents of an argument may be made only through that argument and not through some other variable that occupies or points to the same memory area. Calls with aliased arguments may work sometimes and fail at other times. To be safe, no actual output argument should be the same as any actual input argument.

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-05-2018
09:03 AM

6 Views

Highlighted
##

wen_qiang_z_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-05-2018
04:35 PM

6 Views

mecej4 wrote:

You mean that I should open up other spaces to save the output matrix C instead of saving in the same type`s space? Am I right?

Highlighted
##

Exactly. If you wish, after the matrix multiplication is finished, copy the result from that "space" back into matrix C.

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-05-2018
05:53 PM

6 Views

Highlighted
##

wen_qiang_z_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-05-2018
10:26 PM

6 Views

mecej4 wrote:

Hi, I`ve tried what you said, it didn`t work. It looks like that the CSR matrix A created before the multiplication has some problem in saving its components but the stat information shows that the creation procedure is correct. So thanks for your advice but I still confused

Highlighted
##

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-06-2018
12:45 AM

6 Views

Please post a small but complete code example that demonstrates what you said "didn't work", and describe how you compiled, linked and ran the example. State your compiler and MKL versions.

You have not shown the declarations of the variables in your code extracts, but I believe that

info = mkl_sparse_spmm(sparse_operation_non_transpose,local(i)%Kcr%A,local(i)%Krc%B,local(i)%Kcr%B)

should actually have been

info = mkl_sparse_spmm(sparse_operation_non_transpose,local(i)%Kcr%A,local(i)%Krc%B,&(local(i)%Kcr%C))

In other words, the last argument should actually be the address to receive a newly created matrix handle, not an existing matrix handle.

If you have not done so already, please look at the example sparse_spmm.c that is provided with MKL in the .../examples/spblasc directory.

Highlighted
##

wen_qiang_z_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-06-2018
03:31 AM

6 Views

mecej4 wrote:Please post a small but complete code example that demonstrates what you said "didn't work", and describe how you compiled, linked and ran the example. State your compiler and MKL versions.

You have not shown the declarations of the variables in your code extracts, but I believe that

info = mkl_sparse_spmm(sparse_operation_non_transpose,local(i)%Kcr%A,local(i)%Krc%B,local(i)%Kcr%B)should actually have been

info = mkl_sparse_spmm(sparse_operation_non_transpose,local(i)%Kcr%A,local(i)%Krc%B,&(local(i)%Kcr%C))In other words, the last argument should actually be the address to receive a newly created matrix handle, not an existing matrix handle.

If you have not done so already, please look at the example sparse_spmm.c that is provided with MKL in the .../examples/spblasc directory.

Thx a lot! And I`ve figured out why this error occurred, thanks for your help!

For more complete information about compiler optimizations, see our Optimization Notice.