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

mkl_sparse_copy for a symetric matrix

marcsolal
Beginner
1,352 Views

I have a symmetric sparse matrix and I would like to keep only the upper triangle. 

I was thinking this is possible using:

descr.type=SPARSE_MATRIX_TYPE_SYMMETRIC; //keep only upper triangle
descr.mode=SPARSE_FILL_MODE_UPPER;
descr.diag=SPARSE_DIAG_NON_UNIT;

sparse_status_t ok=mkl_sparse_copy(matrix,descr,&upper_Triangle_csr);

I am exporting the resulting matrix (for using in PARDISO) and it looks that the full matrix is exported. Am I understanding the documentation wrong and the full matrix is copied? Am I doing it the wrong way? 

Thanks for helping.

Marc 

 

 

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
1,241 Views

Marc,

You are right, at the current moment mkl_sparse_copy is copying the full matrixes.

The MKL’s documentation has to be updated. We will do that asap.

Regarding copying upper triangle part of the matrix, we would recommend You submitting the Feature Request query to the Intel online Service Center  


View solution in original post

6 Replies
VidyalathaB_Intel
Moderator
1,325 Views

Hi,


Thanks for reaching out to us.


>>Am I understanding the documentation wrong


Could you please let us know which documentation you are referring to ?


>>I am exporting the resulting matrix (for using in PARDISO) and it looks that the full matrix is exported


Could you please provide us the sample reproducer and command used to compile the code so that we can work on it from our end.

And also provide us your environment details on which you are working.

OS & version

MKL version


Regards,

Vidya.



0 Kudos
marcsolal
Beginner
1,315 Views

I am using version 2019.5.281 of parallel studio on linux.  It is true I looked in the online documentation which should be a different version. Could you please at least confirm I am understanding this right? I am aiming to keep only the upper triangle. Am I doing this right? If the answer is yes, I will try to generate a smaller example I can share. Thanks for helping.

Marc

0 Kudos
marcsolal
Beginner
1,217 Views

This is a  small code example I generated. It is supposed to copy only the upper triangle but everything is copied. This looks like a bug, or I did not understand how mkl_sparse_copy is working.  Please let me know if I am right.

Thanks for helping. 

Marc

Results:

Intel(R) Math Kernel Library Version 2019.0.5 Product Build 20190808 for Intel(R) 64 architecture applications
===Generating symmetric csr sparse matrix
(1,5)
(2,3)
(3,4)
(3,6)

OPENMP DISPLAY ENVIRONMENT BEGIN
_OPENMP='201611'
[host] OMP_AFFINITY_FORMAT='OMP: pid %P tid %i thread %n bound to OS proc set {%A}'
[host] OMP_ALLOCATOR='omp_default_mem_alloc'
[host] OMP_CANCELLATION='FALSE'
[host] OMP_DEBUG='disabled'
[host] OMP_DEFAULT_DEVICE='0'
[host] OMP_DISPLAY_AFFINITY='FALSE'
[host] OMP_DISPLAY_ENV='TRUE'
[host] OMP_DYNAMIC='FALSE'
[host] OMP_MAX_ACTIVE_LEVELS='2'
[host] OMP_MAX_TASK_PRIORITY='0'
[host] OMP_NESTED='FALSE'
[host] OMP_NUM_THREADS='40'
[host] OMP_PLACES='cores'
[host] OMP_PROC_BIND='spread,close'
[host] OMP_SCHEDULE='static'
[host] OMP_STACKSIZE='32000k'
[host] OMP_TARGET_OFFLOAD=DEFAULT
[host] OMP_THREAD_LIMIT='2147483647'
[host] OMP_TOOL='enabled'
[host] OMP_TOOL_LIBRARIES: value is not defined
[host] OMP_WAIT_POLICY='PASSIVE'
OPENMP DISPLAY ENVIRONMENT END


=====Result after copy
(1,1) (1,5)
(2,2) (2,3)
(3,2) (3,3) (3,4) (3,6)
(4,3) (4,4)
(5,1) (5,5)
(6,3) (6,6)

0 Kudos
marcsolal
Beginner
1,194 Views

Here is a small example showing that the copy routine is copying the full matrix. I did not understand how this is working or this looks like a bug in the library. 

Thanks for looking ad helping.

Marc

Intel(R) Math Kernel Library Version 2019.0.5 Product Build 20190808 for Intel(R) 64 architecture applications
===Generating symmetric csr sparse matrix
(1,5)
(2,3)
(3,4)
(3,6)

OPENMP DISPLAY ENVIRONMENT BEGIN
_OPENMP='201611'
[host] OMP_AFFINITY_FORMAT='OMP: pid %P tid %i thread %n bound to OS proc set {%A}'
[host] OMP_ALLOCATOR='omp_default_mem_alloc'
[host] OMP_CANCELLATION='FALSE'
[host] OMP_DEBUG='disabled'
[host] OMP_DEFAULT_DEVICE='0'
[host] OMP_DISPLAY_AFFINITY='FALSE'
[host] OMP_DISPLAY_ENV='TRUE'
[host] OMP_DYNAMIC='FALSE'
[host] OMP_MAX_ACTIVE_LEVELS='2'
[host] OMP_MAX_TASK_PRIORITY='0'
[host] OMP_NESTED='FALSE'
[host] OMP_NUM_THREADS='40'
[host] OMP_PLACES='cores'
[host] OMP_PROC_BIND='spread,close'
[host] OMP_SCHEDULE='static'
[host] OMP_STACKSIZE='32000k'
[host] OMP_TARGET_OFFLOAD=DEFAULT
[host] OMP_THREAD_LIMIT='2147483647'
[host] OMP_TOOL='enabled'
[host] OMP_TOOL_LIBRARIES: value is not defined
[host] OMP_WAIT_POLICY='PASSIVE'
OPENMP DISPLAY ENVIRONMENT END


=====Result after copy
(1,1) (1,5)
(2,2) (2,3)
(3,2) (3,3) (3,4) (3,6)
(4,3) (4,4)
(5,1) (5,5)
(6,3) (6,6)

0 Kudos
Gennady_F_Intel
Moderator
1,242 Views

Marc,

You are right, at the current moment mkl_sparse_copy is copying the full matrixes.

The MKL’s documentation has to be updated. We will do that asap.

Regarding copying upper triangle part of the matrix, we would recommend You submitting the Feature Request query to the Intel online Service Center  


Gennady_F_Intel
Moderator
1,209 Views

The issue is closing and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.



0 Kudos
Reply