Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

Compilation error

Hi

I am trying to compile the C programme which uses the MKL subroutine.

For example, mkl_scsrdia and mkl_scsrcoo,

but when I am trying to compile it,

I am getting error like this. It seems that I am not linking some path

or flags during the compilation.

icc one.c -L$MKLPATH -I$MKLINCLUDE -lmkl -liomp5 -lpthread

one.c -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lsplas -lm -lmkl -lguide

nothing wordks, got error like this

one.c(9): catastrophic error: cannot open source file "mkl_spblas.h"
  #include <mkl_spblas.h>
                         ^

compilation aborted for one.c (code 4)


Could some one pelase tell me how to fix this problem.

Kind regards,

Mathias

0 Kudos
2 Replies
Highlighted
Black Belt
13 Views

Is your environment correctly set up to use Intel C and MKL? Assuming that you are running in Linux, first try the simple command icc -mkl one.c.

If that works, but you wish to use other options for multi-threading, 8-bytet integers, etc., you will need to change to more elaborate options. Please consult the helpful MKL Link Line Advisor tool at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor .

0 Kudos
Highlighted
Black Belt
13 Views

The include path -I$MKLINCLUDE is responsible for finding the .h files associated with MKL.  If MKL is installed with your icc, sourceing the compilervars.sh should have set the environment variables, so you should be able to check whether they point to an appropriate directory.

You should also use a sane order of options in your compile command.  As mecej4 said, the link advisor would give you important hints.

0 Kudos