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

mkl_sparse_d_mv returns different values than mkl_dcsrsymv




we are updating the code in my organisation to get rid of the deprecated SPBLAS functions. Our software makes some structure calculations with sparse matrices codified as CSR  (symmetric, upper, one-based indexes, non-unit diagonal) and force/displacement vectors. Until now we were using mkl_dscrsymv to multiply matrix by vector (we were obtaining exactly the same values codifying the vector as a one-row matrix and using mkl_dcsrmm because we experimented some segmentation faults with an older MKL version; btw, we are working with MS Visual Studio C++ on an Intel Core i7).

The fact is, all our operations with the Inspector-Executor functions (building the matrix from a COO, adding, even the results from PARDISO) are ok, but the multiplication with mkl_sparse_d_mv return a few significativelly different values than the deprecated functions, and that makes our structures fail. For instance, with a rank=1792 and a vector with 496 non-zero values, we find 144 different values in the multiplication, 36 of them being significally different (at least 1% in absolute value).

This is the code for the operation V_out = M x V_in :

    matrix_descr matrix_descr;
    matrix_descr.type = sparse_matrix_type_t::SPARSE_MATRIX_TYPE_SYMMETRIC;
    matrix_descr.mode = sparse_fill_mode_t::SPARSE_FILL_MODE_UPPER;
    matrix_descr.diag = sparse_diag_type_t::SPARSE_DIAG_NON_UNIT;

    sparse_status_t res = mkl_sparse_d_mv (sparse_operation_t::SPARSE_OPERATION_NON_TRANSPOSE, 1.0, M, matrix_descr, V_in, 0.0, V_out);

The return value is always sparse_status_t::SPARSE_STATUS_SUCCESS, but the values returned into V_out do not match the ones expected.

Is this a problem you were aware of, or have I found some bug?



David B.

0 Kudos
2 Replies

Hi David,

To be clear, are you creating the sparse_matrix_t M with mkl_sparse_?_create_csr()  or with mkl_sparse_?_create_coo() ?  If with the coo, could you convert to CSR and then try with mkl_sparse_?_create_csr() ? 

If you wouldn't mind, could you share your matrix and a reproducer so we can determine if it is a bug or not?




0 Kudos

or you can submit the issue to the intel online service center if you need to share the private info and data

0 Kudos