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

Error in feast eigenvalue solver for sparse matrices

aurora
초급자
2,045 조회수

Hi,

We are trying to use the MKL FEAST 11.0.3.1 solver for symmetric sparse CSR matrices of doubles. The call we are using is something like:

--------------------------------------------

#include "mkl.h"

......

//declaring & preparing data...

....

 feastinit(&feastparam[0]);   dfeast_scsrev(&UPLO,&N,sa,ia,ja,feastparam,&epsout,&loop,&Emin,&Emax,&M0,E,X,&M,res,&info);

--------------------------------------------

We have no warnings at compiling time, but at runtime the feast call throws an exception like this:

First exception in 0x000007fee1b8249c in feast.exe: 0xC0000005: Invalid read in 0xffffffffffffffff.

Which could be our mistake? Input data? Bad linkage/compiler version-mkl version combination? We are not getting any compiling warnings.

Intel Composer XE 2011 Update 7 (package 258)

Thanks in advance!

Aurora

0 포인트
9 응답
Zhang_Z_Intel
직원
2,045 조회수

It's hard to see what's wrong in the a few lines of code you've shown. Please provide your entire test code. What is your OS? How do you compile/link the code?

Please first check the FEAST example in MKL: $MKLROOT/examples/solvers_eec/source/dexample_sparse_c.c. Does it work for you?

0 포인트
SergeyKostrov
소중한 기여자 II
2,045 조회수
>>Which could be our mistake? It is hard to answer without seeing your test case. >>Input data? See above. >>Bad linkage/compiler version-mkl version combination? No.
0 포인트
aurora
초급자
2,045 조회수

Hi again, 

The example that you told us worked fine. We are essentially doing the same. However we are still having problems on runtime. 

We are working in Windows 7 x64.

//!!!!!!!!!!!!!!! Matrix declaration variables !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

char          UPLO='F'; 

const MKL_INT N = matrix_size;

double * val = new double[size];

int * rows = new int [size_rows + 1];

int * cols = new int [size];

for(int i=0;i<size;i++){ val=matrix_CSR.pr; } 

for(int i=0;i<(size_rows+1);i++){ rows=matrix_CSR.jc; }

for(int i=0;i<size;i++){ cols=matrix_CSR.ir; } 

   //!!!!!!!!!!!!!!! Declaration of FEAST variables !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    //!!!!!!!!!!!!!!! E - eigenvalues, X - eigenvectors, res - residual !!!!!!!!!!!!! 

    MKL_INT       fpm[128];

    double        Emin, Emax;

    double        epsout;

    MKL_INT       loop;

    MKL_INT       L = 20;

    MKL_INT       M0,M, info;

    double       * E =  new double ;

for(int i=0;i<N;i++){ E=0; }

    double       * X =  new double [N*N];

for(int i=0;i<N*N;i++){ X=0; }

    double       * res =  new double ;

for(int i=0;i<N;i++){ res=0; }

//!!!!!!!!!!!!!! search interval [Emin,Emax] including M eigenpairs !!!!!!!!!!!!

    Emin=(double)-0.5;

    Emax=(double)0.01;

    M0=L;

    M=M0;

    printf(" Search interval [ %.15e, %.15e  ]  \n", Emin, Emax);

    epsout=(double)0.0;

    loop=0;

    info=0;

    //         Task 1. Call  FEASTINIT to define the default values for the input 

    //         FEAST parameters. 

    feastinit(fpm);

    fpm[0]=1;

    //        Task 2. Solve the standard Ax=ex eigenvalue problem.

    dfeast_scsrev(&UPLO,&N,val,rows,cols,fpm,&epsout,&loop,&Emin,&Emax,&M0,E,X,&M,res,&info);

    if ( info != 0 ) return 1;

0 포인트
Zhang_Z_Intel
직원
2,045 조회수

It could be a problem in your input data. How big is your matrix? What are the values for variables such as N, size, and size_row? Can you attach your matrix please?

0 포인트
aurora
초급자
2,045 조회수

Hi again, 

Find in the attachment the input data of our example. We have written the matrix values and the row and column info arrays of the CSR matrix.

Thank you!

0 포인트
Zhang_Z_Intel
직원
2,045 조회수

Thanks for providing the test matrix. Please check a few things in your code:

  • Make sure that row and column indices are 1-based instead of 0-based. This is an requirement of using MKL FEAST.
  • Make sure the column indices for each row are sorted in increasing order.
  • Check your file I/O. The exception you got seems to indicate a problem in reading data from file.

0 포인트
aurora
초급자
2,045 조회수

Thank you for your advice!

Now our example is working properly. The problem was that the row and column indices were 0-based instead of 1-based as MKL FEAST needs. 

Thanks again!

0 포인트
SergeyKostrov
소중한 기여자 II
2,045 조회수
>>>>First exception in 0x000007fee1b8249c in feast.exe: 0xC0000005: Invalid read in 0xffffffffffffffff... >> >>- Check your file I/O. The exception you got seems to indicate a problem in reading data from file 'Aurora' confirmed that actually it was an Out-Of-Bound problem ( memory related problem ) and it was not related to any I/O operations with files. Anyway, it is good to know that in some MKL processing indices are 1-based. Thanks for the note.
0 포인트
Victor_N_
초급자
2,045 조회수

Seems hard to learn how to use this routine at first, but if one goes through the example and runs it, it would become clearer.  Finally I got my problem resolved with the fixes for indices and column-oriented sparse matrix.

0 포인트
응답