I am using the MKL library to perform the sparse matrix vector multiplication using diagonal format, When I use the MKL mkl_sdiagemv function I get a "MKL ERROR: Parameter 4 was incorrect on entry to MKL_SDIAGEMV. " error.
Asked
Active
Viewed 921 times
2
-
The link to the documentation is https://software.intel.com/en-us/node/468542 – The Hiary Oct 13 '14 at 06:14
1 Answers
1
Please, see below a basic example illustrating use of several MKL sparse matrix-vector product routines.
enter code #include <stdio.h>
#include "mkl_spblas.h"
#include "mkl_types.h"
#define NJOB 6
#define NZMAX 8
#define INFO 0
#define NNZ 8
#define N 4
#define M 4
#define NMETHODS 3
int main()
{
double Acoo[NZMAX] = {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};
int AJ[NZMAX] ;
int AI[M+1];
int ir[NZMAX] = {1, 1, 2, 2, 3, 3, 4, 4};
int jc[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};
double Acsr[NZMAX] ;
int n=N, info=INFO, nnz = NNZ;
int i, j;
int job[NJOB]={2,1,1,0,NZMAX,0};
int job1[NJOB]={0,1,1,0,0,10};
double Adia[N][N];
int ndiag = N;
int idiag = N;
int distance[N];
double *Acsr_rem=NULL;
int *AJ_rem=NULL;
int *AI_rem=NULL;
double v[N]={1.0,1.0,1.0,1.0};
double answer[NMETHODS][N];
int lval;
char transa = 'N';
mkl_dcsrcoo (job, &n, Acsr, AJ, AI, &nnz, Acoo, ir, jc, &info);
mkl_dcsrdia (job1, &n, Acsr, AJ, AI, *Adia, &ndiag, distance, &idiag, Acsr_rem, AJ_rem, AI_rem, &info);
mkl_ddiagemv (&transa, &n, *Adia, &ndiag, distance, &ndiag, v, answer[0]);
mkl_dcoogemv(&transa, &n, Acoo, ir, jc, &nnz, v, answer[1]);
mkl_dcsrgemv(&transa, &n, Acsr, AI, AJ, v, answer[2]);
}

Kostya
- 1,552
- 1
- 10
- 16
-
-
@The Hiary: You're welcome (:( i'll not get my bounty :) ). There're a couple of small issues with my code, i'll adjust it a bit later – Kostya Oct 14 '14 at 17:26
-