Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sharma__Ketan
Beginner
70 Views

Feast with g++

Hi,

 

I am thinking of using feast to get a small set (around 300 lowest) of eigenvectors of a huge sparse matrix (more than a 10 million basis functions) in my c++ code. As a first step towards that I was trying to make the example code "dexample_sparse_c.c" work for me  and here is the issue that I am facing:

When I am compiling the code with gcc everything is fine. I use the following command to compile it:

 gcc dexample_sparse_c.c -DMKL_ILP64 -m64 -I${MKLROOT}/include -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_cdft_core.a ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a  -Wl,--end-group -lpthread -lm -ldl

 

But when I try to compile it with g++ i am getting an error

dexample_sparse_c.c: In function ‘int main()’:
dexample_sparse_c.c:239:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("FEAST OUTPUT INFO %d \n",info);
                                          ^
dexample_sparse_c.c:248:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("Number of eigenvalues found %d \n", M);
                                                  ^
dexample_sparse_c.c:280:9: error: ‘dgemm’ was not declared in this scope
         );
         ^
dexample_sparse_c.c:292:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("#mode found/subspace %d %d \n", M, M0);
                                                  ^
dexample_sparse_c.c:292:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ [-Wformat=]
dexample_sparse_c.c:293:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("#iterations %d \n", loop);
                                     ^
dexample_sparse_c.c:304:55: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
         printf("   %d  %.15e %.15e \n",i, E, res);
                                                       ^
dexample_sparse_c.c:356:43: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("FEAST OUTPUT INFO %d \n" ,info);
                                           ^
dexample_sparse_c.c:365:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("Number of eigenvalues found %d \n", M);
                                                  ^
dexample_sparse_c.c:418:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("# mode found/subspace %d %d \n",M,M0);
                                                 ^
dexample_sparse_c.c:418:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ [-Wformat=]
dexample_sparse_c.c:419:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     printf("# iterations %d \n",loop);
                                     ^
dexample_sparse_c.c:431:56: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
         printf("   %d  %.15e %.15e \n", i, E, res);

 

I am using the following command to compile with g++, which is exactly the same as above but with g++ instead of gcc:

g++ dexample_sparse_c.c -DMKL_ILP64 -m64 -I${MKLROOT}/include -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_cdft_core.a ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel6
4/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a  -Wl,--end-group -lpthread -lm -ldl

 

Also, as a completely separate question, we have been using Lanczos algorithm uptil now to achieve the same objective (although I didn't write that code, but an earlier postdoc in my group did). If someone has experience/knows about this, what are the advantages of feast over lanczos or vice versa? 

 

 

0 Kudos
1 Reply
mecej4
Black Belt
70 Views

There are several issues with the example code. Most of the error messages that you received are related to using ILP64 and an example in which many variables are MKL_INT, which becomes a 64-bit int when ILP64 is being used. As long as the 64-bit integer variables have values that do not need more than 32 bits to represent, these mismatches may be benign. You may need to change the %d formats in your printf() calls to formats more appropriate to the corresponding integers. You may also use a compiler options that allows the compiler to overlook benign mismatches.

You need to include mkl_blas.h for the prototype of dgemm().

I do not have an opinion regarding your question regarding the Lanczos versus the Feast algorithms.

Reply