MKL shared libraries not "found" in the accepted lication

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
Posts: 21
Joined: Thu Oct 05, 2017 3:04 pm

MKL shared libraries not "found" in the accepted lication

Post by Klausb » Sun Oct 08, 2017 9:22 am


even so the shared and static libraries are not properly installed (see previous thread), I identified another issue of the shared library when I tried to make the examples.

Apparently, the path to the Intel MKL is wrong. The magma shared library looks for the Intel MKL shared libraries in /usr/bin but they are located in:

I added:

Code: Select all

                    -L$/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -lmkl_core -lmkl_gnu_thread -lmkl_gf_lp64
to the example Makefile in the following section:

Code: Select all

MAGMA_LIBS       := -L$(MAGMADIR)/lib -lmagma_sparse -lmagma \
                               -L$(CUDADIR)/lib64 -lcublas -lcudart -lcusparse \
                               -L$(OPENBLASDIR)/lib -lopenblas \
                               -L$/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -lmkl_core -lmkl_gnu_thread -lmkl_gf_lp64
but as you can see below, that doesn't help:

Code: Select all

make all
gcc -Wall -DADD_ -I/usr/local/magma/include -I/usr/local/magma/sparse/include -I/usr/local/cuda-9.0/include -c -o example_v1.o example_v1.c
gcc -Wall  -o example_v1 example_v1.o -L/usr/local/magma/lib -lmagma_sparse -lmagma -L/usr/local/cuda-9.0/lib64 -lcublas -lcudart -lcusparse -L/usr/include/openblas/lib -lopenblas -Lopt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -lmkl_core -lmkl_gnu_thread -lmkl_gf_lp64
/usr/bin/ld: cannot find -lmkl_core
/usr/bin/ld: cannot find -lmkl_gnu_thread
/usr/bin/ld: cannot find -lmkl_gf_lp64
collect2: error: ld returned 1 exit status
Makefile:74: die Regel für Ziel „example_v1“ scheiterte
make: *** [example_v1] Fehler 1
The Intel MKL directory is the default: /opt/intel/mkl

How can I figure out which path needs to be set and where?


Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: MKL shared libraries not "found" in the accepted licatio

Post by mgates3 » Sat Oct 14, 2017 3:17 am

It seems from later posts that you figured out something that works.

In this case, I'm a bit confused what you're trying to do. The example/Makefile is setup to use OpenBLAS. If you want to use MKL instead, change

Code: Select all

-L$(OPENBLASDIR)/lib -lopenblas
to whatever MKL libraries you want, e.g., if using gcc and gfortran:

Code: Select all

-L$(MKLROOT)/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lstdc++ -lm -lgfortran
I would follow the order of libraries listed in the*, as the order can matter.


Post Reply