I'm almost new in using mkl
libraries. So excuse me if it seems silly. I tried to run an example in tutorial [here] with ifort -mkl dgemm_example.f
,then run the executable file. Here is the error:
./a.out: error while loading shared libraries: libmkl_intel_lp64.so: cannot open shared object file: No such file or directory
I also searched for the similar problems but it baffled me more. do you have any idea? dgemm_example.f
You have to set the LD_LIBRARY_PATH environment variable, otherwise the shared library will not be found at run time.
Before running your program, type export LD_LIBRARY_PATH=/path/to/your/library/directory
in the (bash) shell in which you want to run your code.
If you are using Ubuntu, you can set this variable automatically by using configuration files in /etc/ld.so.conf.d/
, see Ubuntu help. Similar mechanisms are available for other distributions.
I copied the address of libiomp5 in /etc/ld.so.conf.d/icc.conf
and used sudo ldconfig
.
There is another way that every time we should use this flag: -Wl,-rpath=/opt/intel/directory/to/library/directory
and it worked.
I'm using CentOS on our workstations. Adding following lines to bashrc worked for me.
export PATH="$PATH:/opt/intel/bin"
export LD_LIBRARY_PATH="$PATH:opt/intel/mkl/lib/intel64_lin/"
I'm using CentOS and intel compiler.
Type locate compilervars.sh
Go to your '.bashrc' file and add
source /adress you got from locate command/compilervars.sh intel64
Then in terminal typesource ~/.bashrc
It will fix the error.
来源:https://stackoverflow.com/questions/35046753/using-mkl-error-while-loading-shared-libraries-libmkl-intel-lp64-so