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

Convert a sparse matrix to BSR with mkl_dcsrbsr, JOB(6) = -1

Dmitri_Gribenko
Beginner
367 Views

Hello,


I want to use mkl_dcsrbsr to convert a sparse matrix from CSR to BSR. I don't know the number of nnz blocks in advance, so I set job(6)=-1. Unfortunately, mkl_dcsrbsr says that job parameter is wrong and I don't see why.


Here's a small testcase:

[cpp]// Matrix is:
//
//      1 2 0 0
// A =  3 4 0 0
//      0 0 5 6
//      0 0 7 8

#include 
#include "mkl_spblas.h"

int main(int argc, char *argv[] )
{
  int m = 4;
  int mblk = 2;
  double acsr[8] = { 1., 2., 3., 4., 5., 6., 7., 8. };
  int ja[8] = { 1, 2, 1, 2, 3, 4, 3, 4 };
  int ia[5] = { 1, 3, 5, 7, 9 };
  int job[8] = { 0, 1, 1, 0, 0, -1, 0, 0 };
  int nnzblocks = -1;
  int info;

  mkl_dcsrbsr(job, &m, &mblk, NULL, acsr, ja, ia, NULL, NULL, &nnzblocks, &info);

  printf("info = %d, nnzblocks = %d\n", info, nnzblocks);
  return 0;
}
[/cpp]

Here's the output:

$ ./test

MKL ERROR: Parameter 1 was incorrect on entry to MKL_DCSRBSR
info = 32692, nnzblocks = -1

ICC and MKL installation directory is called composerxe-2011.3.174, so I guess I'm using MKL 10.3. (How can I find out?)

0 Kudos
6 Replies
Gennady_F_Intel
Moderator
366 Views
interesting.. job array initialized correctly.
it's pretty difficult to understand the reason of such behaviour without compilation the example. would e the result the same if you allocate the array for elements of non-zero blocks of the matrix A?
0 Kudos
Gennady_F_Intel
Moderator
367 Views
quote "ICC and MKL installation directory is called composerxe-2011.3.174, so I guess I'm using MKL 10.3. (How can I find out?)". see which version of the Intel IPP, Intel MKL and Intel TBB Libraries are Included in the Intel Composer Bundles into this article
0 Kudos
Dmitri_Gribenko
Beginner
367 Views

If I replace NULLs with pointers to some int [10] arrays, I get the same error.


Thank you for the link, I've got MKL 10.3.3 installed.

0 Kudos
Gennady_F_Intel
Moderator
367 Views
Dmitri, thaks for the issue. This is the unknown bug. We will fix the issue asap and I will let you know any update.
--Gennady
0 Kudos
Gennady_F_Intel
Moderator
366 Views
Hi Dima,
would you check the fix of the problem with the latest update (Intel MKL v.10.3.5)?
--Gennady
0 Kudos
Dmitri_Gribenko
Beginner
367 Views
Thank you, example from the first post works now (but I had to replace NULLs with pointers to valid memory -- no idea why MKL wants them, it is not supposed to read or write there).
0 Kudos
Reply