Reputation: 71
I am trying to compile python package https://github.com/jrs65/scalapy which wraps mkl
scalapack
and blacs
libraries. Compilation is successful however when I try to execute test programs I get:
Intel MKL FATAL ERROR: Cannot load symbol MKLMPI_Get_wrappers
I tried to use mkl_link_tool
to get linking lines.
This is what is happening under the hood of distutils
:
gcc -pthread -shared -L/scratch/apc/lukrazi/intel/intelpython3/lib -Wl,-rpath=/scratch/apc/lukrazi/intel/intelpython3/lib,--no-as-needed -z noexecstack -z relro -z now -fstack-protector build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/scalapy/lowlevel/redistmodule.o build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/build/src.linux-x86_64-3.6/scalapy/lowlevel/fortranobject.o -L/scratch/apc/lukrazi/intel/intelpython3/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/scalapy/lowlevel/redist.cpython-36m-x86_64-linux-gnu.so -I/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/include -L/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib/release_mt -L/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib/release_mt -Xlinker -rpath -Xlinker /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2107.0.0/intel64/lib/release_mt -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2017.0.0/intel64/lib -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread -L/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -fopenmp
I also tried static linking with -Wl,-Bstatic -Wl,--start-group
and -Wl,--end-group -Wl,-Bdynamic
:
gcc -pthread -shared -L/scratch/apc/lukrazi/intel/intelpython3/lib -Wl,-rpath=/scratch/apc/lukrazi/intel/intelpython3/lib,--no-as-needed -z noexecstack -z relro -z now -fstack-protector build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/scalapy/lowlevel/redistmodule.o build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/build/src.linux-x86_64-3.6/scalapy/lowlevel/fortranobject.o -L/scratch/apc/lukrazi/intel/intelpython3/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/scalapy/lowlevel/redist.cpython-36m-x86_64-linux-gnu.so -I/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/include -L/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib/release_mt -L/scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib/release_mt -Xlinker -rpath -Xlinker /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mpi/intel64/lib -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2107.0.0/intel64/lib/release_mt -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2017.0.0/intel64/lib -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread -Wl,-Bstatic -Wl,--start-group /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64/libmkl_scalapack_lp64.a /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64/libmkl_intel_lp64.a /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64/libmkl_intel_thread.a /scratch/apc/lukrazi/intel/compilers_and_libraries_2018.1.148/linux/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -Wl,-Bdynamic -liomp5 -lpthread -lm -ldl -fopenmp
No success. What could be the problem?
Upvotes: 4
Views: 928
Reputation: 1174
You have two options: a) build a shared library via
-ld -shared --whole-archive libmkl_blacs_openmpi_lp64.a -no-whole-archive -o libmkl_blacs_openmp_lp64.so
or b) link to static libraries by adding
-Wl,-Bstatic -Wl,--start-group
and
-Wl,--end-group -Wl,-Bdynamic
Upvotes: 0