PhotonicsTUL / PLaSK

Photonic Lasers Simulation Kit
https://plask.app
GNU General Public License v3.0
8 stars 2 forks source link

Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so. #3

Closed krzyklo closed 9 months ago

krzyklo commented 9 months ago

Installed PLaSK from DEB for Ubuntu 20.04. Trying to start Tutorial1 from GUI but obtain errors: image

INTEL MKL ERROR: /usr/lib/x86_64-linux-gnu/libmkl_avx.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8. Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so.

The both files, that are indicated as missing, are at the path reported: image

Installed MKL with: pip3 install mkl but it not helped.

macdems commented 9 months ago

Make sure that the packages libmkl-avx2 and libmkl-def are installed.

krzyklo commented 9 months ago

libmkl-avx2 was missing, though error same persisted after libmkl-avx2 installation.

macdems commented 9 months ago

How about libmkl-def?

macdems commented 9 months ago

What is the output of

 ldd /usr/lib/plask/solvers/optical/slab.so 

?

krzyklo commented 9 months ago

libmkl-def was installed already.

Below output of ldd command:

krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ ldd /usr/lib/plask/solvers/optical/liboptical_slab.so 
        linux-vdso.so.1 (0x00007ffd0df3d000)
        libplask.so => /usr/lib/libplask.so (0x00007fac44111000)
        libmkl_intel_lp64.so => /usr/lib/x86_64-linux-gnu/libmkl_intel_lp64.so (0x00007fac435a5000)
        libmkl_sequential.so => /usr/lib/x86_64-linux-gnu/libmkl_sequential.so (0x00007fac41f8d000)
        libmkl_core.so => /usr/lib/x86_64-linux-gnu/libmkl_core.so (0x00007fac3dc6d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fac3db1e000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fac3db18000)
        libfftpacx.so => /usr/lib/libfftpacx.so (0x00007fac3dad3000)
        libboost_filesystem.so.1.71.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 (0x00007fac3dab5000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fac3da87000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fac3d8a5000)
        libomp.so.5 => /usr/lib/x86_64-linux-gnu/libomp.so.5 (0x00007fac3d7b4000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fac3d799000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fac3d774000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fac3d582000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fac44cf6000)
krzyklo commented 9 months ago
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ ldd /usr/lib/x86_64-linux-gnu/libmkl_avx.so
        linux-vdso.so.1 (0x00007ffe4fd6f000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3456164000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3455f72000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f34594b7000)
krzyklo commented 9 months ago

When trying to run plask at console, also series of errors. I suspect my python settings are messed up during previous/other installations of multiple versions of python and anaconda3.

image

krzyklo commented 9 months ago

Following advice here: https://stackoverflow.com/questions/13951953/linking-intels-mkl-within-python-c-c-fortran-2003-program

Tried to add: export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_def.so:/usr/lib/x86_64-linux-gnu/libmkl_avx2.so

then plaskgui at the start complain about undefined symbol: mkl_sparse_optimize_bsr_trsm_i8

krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_def.so
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ plaskgui 
plaskgui: symbol lookup error: /usr/lib/x86_64-linux-gnu/libmkl_def.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_
libmkl_avx2.so        libmkl_avx.so         libmkl_core.so        libmkl_def.so         libmkl_intel_lp64.so  libmkl_sequential.so  libmkl_vml_def.so     
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_avx
libmkl_avx2.so  libmkl_avx.so   
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_avx.so 
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ plaskgui 
plaskgui: symbol lookup error: /usr/lib/x86_64-linux-gnu/libmkl_avx.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_avx2.so 
krzys@kLatitude-E6430:~/Aix200R2/PLaSK$ plaskgui 
plaskgui: symbol lookup error: /usr/lib/x86_64-linux-gnu/libmkl_avx2.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8
krzyklo commented 9 months ago

Tried to follow this advice, though it not helped: https://github.com/ContinuumIO/anaconda-issues/issues/698#issuecomment-249627096

macdems commented 9 months ago

This is strange. I cannot reproduce this error. Please send me the output of

 ldd /usr/lib/plask/solvers/optical/slab.so

Also, try with

 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmkl_def.so:/usr/lib/x86_64-linux-gnu/libmkl_avx:/usr/lib/x86_64-linux-gnu/libmkl_core.so:/usr/lib/x86_64-linux-gnu/libmkl_sequential.so:/usr/lib/x86_64-linux-gnu/libmkl_intel_lp64.so

(you were preloading only one library).

Binary packages of PLaSK are tested on the raw distribution packages and they work well. My guess is that your install of Anaconda or custom install of MKL somehow interfere with it. If the above do not work, I can only recommend either fully uninstalling Anaconda and Intel Compiler and MKL other than the one provided by the Ubuntu packages. If this is not an option, you may try compiling from source (make sure all the packages specified in the README are installed). When compiling you may choose different BLAS and LAPACK (e.g. install libopenblas-dev and add -DBLA_VENDOR=OpenBLAS to the cmake command).

krzyklo commented 9 months ago

Ha! Eureka! It works, with LD_PRELOAD above! It is strange, as I tried to load more than one lib to LD_PRELOAD, and then wasn't able to run plaskgui (it raised other lib issues), but your set of libraries works! Wonderful!! Thank you very much for support and for the opensource software to play with semiconductors devices!!! With this, LD_PRELOAD, I tested all 3 Tutorials, and they works!

The output of ldd /usr/lib/plask/solvers/optical/slab.so

krzys@kLatitude-E6430:~/Aix200R2/PLaSK$  ldd /usr/lib/plask/solvers/optical/slab.so
        linux-vdso.so.1 (0x00007ffe723ee000)
        liboptical_slab.so => /usr/lib/plask/solvers/optical/liboptical_slab.so (0x00007f58d644b000)
        libpython3.8.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0 (0x00007f58d5eb4000)
        libplask_python.so => /usr/lib/libplask_python.so (0x00007f58d3c8d000)
        libplask.so => /usr/lib/libplask.so (0x00007f58d331b000)
        libmkl_intel_lp64.so => /usr/lib/x86_64-linux-gnu/libmkl_intel_lp64.so (0x00007f58d27af000)
        libmkl_sequential.so => /usr/lib/x86_64-linux-gnu/libmkl_sequential.so (0x00007f58d1197000)
        libmkl_core.so => /usr/lib/x86_64-linux-gnu/libmkl_core.so (0x00007f58cce75000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f58ccd26000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f58ccd20000)
        libfftpacx.so => /usr/lib/libfftpacx.so (0x00007f58cccdd000)
        libboost_python38.so.1.71.0 => /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0 (0x00007f58ccc9c000)
        libboost_filesystem.so.1.71.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 (0x00007f58ccc7e000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f58ccc4e000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f58cca6c000)
        libomp.so.5 => /usr/lib/x86_64-linux-gnu/libomp.so.5 (0x00007f58cc97b000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f58cc960000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f58cc93d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f58cc74b000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f58cc72d000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f58cc728000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f58d6b24000)