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

Static linking mkl 6 with ifc 7 help

Wee_Beng_T_
Beginner
294 Views

Hi,

My school has mkl6 and ifc7 installed. I am using the Petsc linear solver in my code and it requires the use of blas/lapack routines. Hence I'm using mkl. The compiling command includes -Wl,-rpath/opt/intel/mkl60 -L/opt/intel/mkl60/lib/32 -lmkl_lapack -lmkl_def -lguide -lvml -lpthread -ldl

It runs ok if I run directly. However if I send the job to the background, it says error.

error while loading shared libraries: libmkl_def.so: cannot open shared
object file: No such file or directory.
Can I compiled the libraries statically to prevent this problem?
I tried adding -static but then it gives:
ld: cannot find -lmkl_def.
So what is the command to modify?
Thank you
0 Kudos
1 Reply
TimP
Honored Contributor III
294 Views
That's ancient history (5 years ago?), but I'll take a guess at it. Unless you are running even older CPUs, there should be an mkl library for P4 in your installation, which would be much faster than mkl_def. Assuming there are both static and dynamic versions of libguide on your installation, you can specify the static one by giving the complete path name of that library (libguide.a). If you are using ifc, you should be using the libguide which belongs to the compiler, rather than the one which belongs to MKL. In order to run, when you have linked with dynamic libraries, add the path to the library directory to the environment variable LD_LIBRARY_PATH. Setting the environment variables by sourcing the compiler script would take care of that. For example,
source /opt/intel_fc_60/bin/ifcvars.sh (.csh if running csh or tcsh)
ifc -openmp yourfile.f /opt/intel/mkl60/lib/32/libmkl_lapack.a /opt/intel/mkl60/lib/32/libmkl_p4.a

would like the dynamic libguide which comes with the compiler (since -openmp implies linkage with libguide), and would find it at run time. You could specify the corresponding static libguide if you wish.
Surely, your school should be able to keep your Intel software current at the academic prices.

0 Kudos
Reply