Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Problem compiling MKL with OpenMP

Don_Spong
Beginner
917 Views

I'm trying to compile and load a code that uses MKL libraries to solve an eigenvalue problem. I use the following commands based on what the Intel MKL link line advisor tells me:

 

ifort -c  -i8 -qopenmp -I${MKLROOT}/include $OPT dggev_solver.f

ifort -o xgv_omp dggev_solver.o -I. -L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

 

However, when these are used, there seems to be symbols that are not found (see below):

 

+ OPT=-O2

+ ifort -c -i8 -qopenmp -I/opt/intel//compilers_and_libraries_2016.3.170/mac/mkl/include -O2 dggev_solver.f

+ ifort -o xgv_omp dggev_solver.o -I. -L/opt/intel//compilers_and_libraries_2016.3.170/mac/mkl/lib -Wl,-rpath,/opt/intel//compilers_and_libraries_2016.3.170/mac/mkl/lib -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

Undefined symbols for architecture x86_64:

  "___kmpc_begin", referenced from:

      _MAIN__ in dggev_solver.o

  "___kmpc_end", referenced from:

      _MAIN__ in dggev_solver.o

ld: symbol(s) not found for architecture x86_64

 

What needs to be added to my compilation lines to fix this?

 

Thanks, Don

 
 

 

 

0 Kudos
3 Replies
TimP
Honored Contributor III
917 Views
Ifort -qopenmp in the link step would supply -liomp5 -lpthreads as required by Mkl parallel and your use of openmp.
0 Kudos
Don_Spong
Beginner
917 Views

Thanks, that fixed my compilation and loading problem. Also, I had found earlier that just adding -mkl to to the load fixed things.

0 Kudos
Gennady_F_Intel
Moderator
917 Views

two my cents wrt "-mkl" option :  with this option, Compiler will link with LP64 ( not ILP64 API you originally pointed.

0 Kudos
Reply