Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6741 Discussions

Intel MKL ERROR: Parameter 2 was incorrect on entry to MKL_DCSRGEMV.

Maggie_m_
Beginner
1,423 Views

Not sure why I got such error message for the code below.  Any suggestions ? Thanks

 

0 Kudos
1 Solution
Ying_H_Intel
Employee
1,423 Views

Hi Maggie, 

i try you code.  and can't get the error, but other error. 

 >source /opt/intel/composer_xe_2015.2.164/bin/iccvars.sh intel64

 

>icc main.c LinearSolver.c -mkl

and the error is like below. 

 
matrix column indexes are not in increasing order.
From error message, it seems there are two problems in your programs:

1. mkl_dcsrgemv  and dcsrilu0 supports only one-based indexing of the input arrays  and matrix column indexes must be in increasing order.  

why you have code to change this?

for(i=0; i<*N; i++) --ia;
        for(i=0; i<*NNZ; i++) --ja;

2. the key problem, as alex mentioned,  what model do you want,  ILP64 or LP64.  If ILP64.  Then it is better to use MKL_INT  to replace the int where needed. 

20803 0.000037 1583 -1.288940

 20809 0.000635 1584 -0.294387
 20815 0.000056 433 -1.870527
 20821 -0.000022 1009 -0.125222
 dcsrgemv
Linear Solver begins
sizetmpi= 27474718
N=3314, NNZ= 20820
LinearSolver: Line 48
dfgmres_init
dfgmres_end
ilu begin

------------------------------------------------------------------------------
Intel MKL DCSRILU0 ERROR:
Cannot proceed with calculations as input
matrix column indexes are not in increasing order.
ilu end
Preconditioner dcsrilu0 has returned the ERROR code -106-------------------------------------------------------------------
Unfortunately, FGMRES+ILU0 C example has FAILED
-------------------------------------------------------------------
The error is 2

Best Regards,

Ying

View solution in original post

7 Replies
mecej4
Black Belt
1,423 Views

I have not looked at the details of your problem, but here is something that can be a problem if you have not already provided for it. When you store a matrix in the three array CSR scheme (iA,jA,A), there is a restriction in many routines that use such matrices as arguments, especially when factorizing A: you should not skip creating an entry for the diagonal element even when the value of that element is zero.

Maggie_m_
Beginner
1,423 Views

The problem is about   mkl_dcsrgemv(&cvar,&ivar, A, ia, ja, Sol, rhs); 

Parameter 2 was incorrect on entry to MKL_DCSRGEMV.

int ivar = N;
    char cvar ='N';
    for (i=0; i<N; i++) Sol = 1.0;
        printf("dcsrgemv\n");
    mkl_dcsrgemv(&cvar,&ivar, A, ia, ja, Sol, rhs); 

I have tried to print the beginning and the end part of array A, ia, ja, rhs before calling this function.  They are exactly as the input. So dont know why get such error. 

Alexander_K_Intel2
1,423 Views

Hi,

Have you link with ilp64 or lp64 MKL libraries? Try to changed your link line - the problem will fixed

Thanks,

Alex

Ying_H_Intel
Employee
1,424 Views

Hi Maggie, 

i try you code.  and can't get the error, but other error. 

 >source /opt/intel/composer_xe_2015.2.164/bin/iccvars.sh intel64

 

>icc main.c LinearSolver.c -mkl

and the error is like below. 

 
matrix column indexes are not in increasing order.
From error message, it seems there are two problems in your programs:

1. mkl_dcsrgemv  and dcsrilu0 supports only one-based indexing of the input arrays  and matrix column indexes must be in increasing order.  

why you have code to change this?

for(i=0; i<*N; i++) --ia;
        for(i=0; i<*NNZ; i++) --ja;

2. the key problem, as alex mentioned,  what model do you want,  ILP64 or LP64.  If ILP64.  Then it is better to use MKL_INT  to replace the int where needed. 

20803 0.000037 1583 -1.288940

 20809 0.000635 1584 -0.294387
 20815 0.000056 433 -1.870527
 20821 -0.000022 1009 -0.125222
 dcsrgemv
Linear Solver begins
sizetmpi= 27474718
N=3314, NNZ= 20820
LinearSolver: Line 48
dfgmres_init
dfgmres_end
ilu begin

------------------------------------------------------------------------------
Intel MKL DCSRILU0 ERROR:
Cannot proceed with calculations as input
matrix column indexes are not in increasing order.
ilu end
Preconditioner dcsrilu0 has returned the ERROR code -106-------------------------------------------------------------------
Unfortunately, FGMRES+ILU0 C example has FAILED
-------------------------------------------------------------------
The error is 2

Best Regards,

Ying

Maggie_m_
Beginner
1,423 Views

Thank you, Ying and Alex. I do use ilp64 in my makefile. And I have attached my makefile. 

for(i=0; i<*N; i++) --ia;
        for(i=0; i<*NNZ; i++) --ja;

These two lines are because the input ia, ja are from the output of fortran code, the array of which begins from 1. 

 

FC = ifort -check bounds -g -traceback
CC = icc -g -traceback

MKLDIR = /nas02/apps/intel-15.0/cc/mkl

FFLAGS = -i8 -openmp -w -fast -DMKL_ILP64 -m64  \
     -I$(MKLDIR)/include/intel64/ilp64 \
     -I$(MKLDIR)/include 

CFLAGS = -i8 -openmp -w -fast -DMKL_ILP64 -m64 \
     -I$(MKLDIR)/include/intel64/ilp64 \
     -I$(MKLDIR)/include


#INCLUDES = -I$(MKLDIR)/include/intel64/ilp64 -I$(MKLDIR)/include

LFLAGS = -L$(MKLDIR)/lib/intel64 -lmkl_intel_ilp64 \
     -lmkl_intel_thread -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 \
         -liomp5 -lmkl_core  -lm -lpthread

OBJS =  main.o LinearSolver.o

ALL_OBJ = $(OBJS)

%.o: %.f
    $(FC) $(FFLAGS) -c $<
%.o:%.c
    $(CC) $(FFLAGS) -c $<

ds:  $(ALL_OBJ)
    $(CC) $(ALL_OBJ) $(LFLAGS) -o ds 

clean:
    rm -rf *.o *.mod *.out *.chk ds

mecej4
Black Belt
1,423 Views

If you call MKL routines from C or Fortran 77, you do not need " -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 ". You need those libraries only if you call from Fortran 90+ and you call the F95 interface names rather than the F77 names.

Maggie_m_
Beginner
1,423 Views

Also,  I have changed all the int to MKL_INT. However, I still got the error:

 dcsrgemv
Linear Solver begins
sizetmpi= 27474718
N=3314, NNZ= 20820
LinearSolver: Line 48
dfgmres_init
dfgmres_end
ilu begin

------------------------------------------------------------------------------
Intel MKL DCSRILU0 ERROR: 
Cannot proceed with calculations as input
matrix column indexes are not in increasing order.
ilu end
Preconditioner dcsrilu0 has returned the ERROR code -106-------------------------------------------------------------------
Unfortunately, FGMRES+ILU0 C example has FAILED
-------------------------------------------------------------------
The error is 0

Reply