- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am struggling to change a single value of a matrix in internal Intel Sparse BLAS format using the mkl_sparse_z_set_value function. Most of the time this function returns a value of 3. However, it does work some times! I have checked the status of memory allocation and also mkl_sparse_z_create_csr and there is no problem with them. Any idea why this issue is happening? Here is the code:
// Matrix size is Mat_Size x Mat_Size
// This matrix is going to be a diagonal matrix so the maximum number of non-zeros will be equal to Mat_Size
int Mat_Size = 10;
sparse_matrix_t Ysh_CSR = NULL;
MKL_Complex16 *Ysh_val = NULL;
MKL_INT *Ysh_col = NULL;
MKL_INT *Ysh_row = NULL;
Ysh_val = (MKL_Complex16 *)mkl_malloc(Mat_Size * sizeof(MKL_Complex16), 64);
Ysh_col = (MKL_INT *)mkl_malloc(Mat_Size * sizeof(MKL_INT), 64);
Ysh_row = (MKL_INT *)mkl_malloc((Mat_Size + 1) * sizeof(MKL_INT), 64); // +1 is because we are using 3-aaray variation
mkl_sparse_z_create_csr(&Ysh_CSR, SPARSE_INDEX_BASE_ZERO, Mat_Size, Mat_Size, Ysh_row, Ysh_row + 1, Ysh_col, Ysh_val);
MKL_Complex16 temp;
temp.real = 2 ;
temp.imag = 3 ;
int info = mkl_sparse_z_set_value(Ysh_CSR, 1, 1, temp); // set the value of Ysh_CSR[1][1] to temp
printf("info is %i", info);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ahmadi,
Thank you for the post. We will investigate the problem and get back to you later. Could you pleas also submit the issue to https://supporttickets.intel.com/?lang=en-US, where we can track the details, like compiler/mkl version , bug etc.
Thanks
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ying H. (Intel) wrote:
Hi Ahmadi,
Thank you for the post. We will investigate the problem and get back to you later. Could you pleas also submit the issue to https://supporttickets.intel.com/?lang=en-US, where we can track the details, like compiler/mkl version , bug etc.
ThanksYing
Dear Ying,
Were you able to investigate the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ahmadi,
Yes, we can reproduce the problem. So did you create a ticket in https://supporttickets.intel.com/?lang=en-US ? please let me know the ticket number.
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ying H. (Intel) wrote:
Hi Ahmadi,
Yes, we can reproduce the problem. So did you create a ticket in https://supporttickets.intel.com/?lang=en-US ? please let me know the ticket number.
Best Regards,
Ying
Hi Ying,
The ticket number is 03319553. How long do you think it is going to take to fix the issue?
Best,
Afshin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Afshin,
Please refer to the reply from the 03319553. It seems you are creating a csr handle, but with invalid matrix value. If there are exact value for the Ysh_row, , Ysh_col, Ysh_val, then your code will work.
SPARSE_STATUS_INVALID_VALUE = 3, /* invalid input value */
Best Regards
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ying H. (Intel) wrote:
Hi Afshin,
Please refer to the reply from the 03319553. It seems you are creating a csr handle, but with invalid matrix value. If there are exact value for the Ysh_row, , Ysh_col, Ysh_val, then your code will work.
SPARSE_STATUS_INVALID_VALUE = 3, /* invalid input value */
Best Regards
Ying
Hi Yin,
My code is actually fine and there is not problem with creating the CSR handle. Ysh_$ are just empty arrays with the right memory size to keep the future sparse matrix information. However, what is wrong is that the mkl_sparse_z_set_value function can only be used after the CSR handle has been filled with values (e.g., after converting the dense matrix to sparse and storing the results in the CSR handle). I believe the language of MKL manual is vague in explaining this function. I also think Intel should include a similar function to retrieve an element from the sparse function. For example, if you add two sparse matrices together and you want to read diagonal elements of the resulting function, there is no function for that.
Anyway, I really appreciate your help in this matter.
Best,
Afshin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Afshin,
You're right, mkl_sparse_?_create_csr is supposed to be used only if one allocated and initialized all rows_start(_end)/col_indx and values arrays. On the basis of this information CSR handle will be created and can be used with all IE SpBLAS functionality.
mkl_sparse_?_set_value routine can only change one of the existing values from matrix to another (please, refer to https://software.intel.com/en-us/mkl-developer-reference-c-mkl-sparse-set-value). That explains why there was an error related to invalid input when passing non-initialized arrays to mkl_sparse_?_create_csr and then to mkl_sparse_?_set_value routines.
In order to retrieve an element from the resulting matrix you can use mkl_sparse_?_export_csr, however it's currently not supported to export only the part of the matrix from CSR Handle.
Hope this was helpful!
Best regards,
Maria
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page