Community
cancel
Showing results for 
Search instead for 
Did you mean: 
aurora
Beginner
52 Views

Error in feast eigenvalue solver for sparse matrices

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 Kudos
9 Replies
Zhang_Z_Intel
Employee
52 Views

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?

SKost
Valued Contributor II
52 Views

>>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.
aurora
Beginner
52 Views

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;

Zhang_Z_Intel
Employee
52 Views

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?

aurora
Beginner
52 Views

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!

Zhang_Z_Intel
Employee
52 Views

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.

aurora
Beginner
52 Views

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!

SKost
Valued Contributor II
52 Views

>>>>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.
Victor_N_
Beginner
52 Views

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.