IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so. #130

Closed xiuliren closed 7 years ago

xiuliren commented 7 years ago

thanks for building this great package. I tried to Pkg.test("ParallelAccelerator") using MKL and got this error

Testing ranges...
Done testing ranges.
Testing miscellaneous features...
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
============================================[ ERROR: ParallelAccelerator ]=============================================

failed process: Process(`/usr/people/jingpeng/lib/julia/bin/julia -Cx86-64 -J/usr/people/jingpeng/lib/julia/lib/julia/sys.so --compile=yes --depwarn=yes --check-bounds=yes --code-coverage=none --color=yes --compilecache=yes /usr/people/jingpeng/.julia/v0.5/ParallelAccelerator/test/runtests.jl`, ProcessExited(2)) [2]

=======================================================================================================================
INFO: No packages to install, update or remove
ERROR: ParallelAccelerator had test errors
 in #test#61(::Bool, ::Function, ::Array{AbstractString,1}) at ./pkg/entry.jl:740
 in (::Base.Pkg.Entry.#kw##test)(::Array{Any,1}, ::Base.Pkg.Entry.#test, ::Array{AbstractString,1}) at ./<missing>:0
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#test,Tuple{Array{AbstractString,1}}})() at ./pkg/dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#test,Tuple{Array{AbstractString,1}}}, ::String) at ./file.jl:59
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::Array{AbstractString,1}, ::Vararg{Array{AbstractString,1},N}) at ./pkg/dir.jl:31
 in (::Base.Pkg.Dir.#kw##cd)(::Array{Any,1}, ::Base.Pkg.Dir.#cd, ::Function, ::Array{AbstractString,1}, ::Vararg{Array{AbstractString,1},N}) at ./<missing>:0
 in #test#3(::Bool, ::Function, ::String, ::Vararg{String,N}) at ./pkg/pkg.jl:258
 in test(::String, ::Vararg{String,N}) at ./pkg/pkg.jl:258
julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)
icc -v
icc version 16.0.3 (gcc version 4.8.0 compatibility)
ehsantn commented 7 years ago

Seems like a problem with MKL in environment variables like LD_LIBRARY_PATH.

My desktop configuration is similar to yours (Ubuntu I assume?) and this line in .bashrc sets up all ICC variables properly for me: . /opt/intel/bin/compilervars.sh intel64

xiuliren commented 7 years ago

Thanks for the quick response! I have a similar setting in .bashrc file. source /opt/intel/bin/compilervars.sh intel64

also tried yours, still get the same error.

ehsantn commented 7 years ago

Is the valid path to MKL in your LD_LIBRARY_PATH? For me it is /opt/intel/compilers_and_libraries_2017.0.098/linux/mkl/lib/intel64.

Maybe setting mklvars.sh directly could help?

ehsantn commented 7 years ago

The link command is formed in function getLinkCommand at src/cgen.jl:3329. You could try adding the MKL path there (-L).

A brute force solution is linking MKL statically.

xiuliren commented 7 years ago

the LD_LIBRARY_PATH is correct, it contains the mkl path.

it has the libmkl_avx2 file

ls /opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64
libmkl_avx2.so                  libmkl_gf_lp64.so
libmkl_avx512_mic.so            libmkl_gnu_thread.a
libmkl_avx512.so                libmkl_gnu_thread.so
libmkl_avx.so                   libmkl_intel_ilp64.a
libmkl_blacs_ilp64.a            libmkl_intel_ilp64.so
ehsantn commented 7 years ago

This doesn't look right to me. It doesn't have libmkl_rt.so, libmkl_core.so, libmkl_def.so etc. Maybe you should reinstall your ICC/MKL.

I actually have the same version of MKL installed with these files:

ls /opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/
libmkl_avx.so                   libmkl_blacs_lp64.a            libmkl_blas95_ilp64.a  libmkl_gf_lp64.so        libmkl_lapack95_lp64.a     libmkl_vml_avx.so
libmkl_avx2.so                  libmkl_blacs_lp64.so           libmkl_blas95_lp64.a   libmkl_gnu_thread.a      libmkl_mc.so               libmkl_vml_avx2.so
libmkl_avx512.so                libmkl_blacs_openmpi_ilp64.a   libmkl_cdft_core.a     libmkl_gnu_thread.so     libmkl_mc3.so              libmkl_vml_avx512.so
libmkl_avx512_mic.so            libmkl_blacs_openmpi_ilp64.so  libmkl_cdft_core.so    libmkl_intel_ilp64.a     libmkl_rt.so               libmkl_vml_avx512_mic.so
libmkl_blacs_ilp64.a            libmkl_blacs_openmpi_lp64.a    libmkl_core.a          libmkl_intel_ilp64.so    libmkl_scalapack_ilp64.a   libmkl_vml_cmpt.so
libmkl_blacs_ilp64.so           libmkl_blacs_openmpi_lp64.so   libmkl_core.so         libmkl_intel_lp64.a      libmkl_scalapack_ilp64.so  libmkl_vml_def.so
libmkl_blacs_intelmpi_ilp64.a   libmkl_blacs_sgimpt_ilp64.a    libmkl_def.so          libmkl_intel_lp64.so     libmkl_scalapack_lp64.a    libmkl_vml_mc.so
libmkl_blacs_intelmpi_ilp64.so  libmkl_blacs_sgimpt_ilp64.so   libmkl_gf_ilp64.a      libmkl_intel_thread.a    libmkl_scalapack_lp64.so   libmkl_vml_mc2.so
libmkl_blacs_intelmpi_lp64.a    libmkl_blacs_sgimpt_lp64.a     libmkl_gf_ilp64.so     libmkl_intel_thread.so   libmkl_sequential.a        libmkl_vml_mc3.so
libmkl_blacs_intelmpi_lp64.so   libmkl_blacs_sgimpt_lp64.so    libmkl_gf_lp64.a       libmkl_lapack95_ilp64.a  libmkl_sequential.so       locale
xiuliren commented 7 years ago

sorry, I did not pasted the complete list. Just wanted to show that I have the libmkl_avx2.so file. here is the complete list

ls /opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64
libmkl_avx2.so                  libmkl_gf_lp64.so
libmkl_avx512_mic.so            libmkl_gnu_thread.a
libmkl_avx512.so                libmkl_gnu_thread.so
libmkl_avx.so                   libmkl_intel_ilp64.a
libmkl_blacs_ilp64.a            libmkl_intel_ilp64.so
libmkl_blacs_ilp64.so           libmkl_intel_lp64.a
libmkl_blacs_intelmpi_ilp64.a   libmkl_intel_lp64.so
libmkl_blacs_intelmpi_ilp64.so  libmkl_intel_thread.a
libmkl_blacs_intelmpi_lp64.a    libmkl_intel_thread.so
libmkl_blacs_intelmpi_lp64.so   libmkl_lapack95_ilp64.a
libmkl_blacs_lp64.a             libmkl_lapack95_lp64.a
libmkl_blacs_lp64.so            libmkl_mc3.so
libmkl_blacs_openmpi_ilp64.a    libmkl_mc.so
libmkl_blacs_openmpi_ilp64.so   libmkl_rt.so
libmkl_blacs_openmpi_lp64.a     libmkl_scalapack_ilp64.a
libmkl_blacs_openmpi_lp64.so    libmkl_scalapack_ilp64.so
libmkl_blacs_sgimpt_ilp64.a     libmkl_scalapack_lp64.a
libmkl_blacs_sgimpt_ilp64.so    libmkl_scalapack_lp64.so
libmkl_blacs_sgimpt_lp64.a      libmkl_sequential.a
libmkl_blacs_sgimpt_lp64.so     libmkl_sequential.so
libmkl_blas95_ilp64.a           libmkl_vml_avx2.so
libmkl_blas95_lp64.a            libmkl_vml_avx512_mic.so
libmkl_cdft_core.a              libmkl_vml_avx512.so
libmkl_cdft_core.so             libmkl_vml_avx.so
libmkl_core.a                   libmkl_vml_cmpt.so
libmkl_core.so                  libmkl_vml_def.so
libmkl_def.so                   libmkl_vml_mc2.so
libmkl_gf_ilp64.a               libmkl_vml_mc3.so
libmkl_gf_ilp64.so              libmkl_vml_mc.so
libmkl_gf_lp64.a                locale

Maybe, I should upgrade to 2017?

xiuliren commented 7 years ago

checked out this repo, compiled successfully! I think I can close this issue. Thanks for the help!