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

undefined reference to mkl_serv_iface_allocate(deallocate)

Alexey_K_
Beginner
1,068 Views

Hallo,

I have very strange problem with mkl libraries.

Compiling the code with following options:

MPIF90=mpif90 -mcmodel=medium -openmp -I$(MKLROOT)/include

FFLAGS = -c -O3 -g

MKL =  $(MKLROOT)/lib/intel64/libmkl_scalapack_ilp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -Wl,--end-group $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a -lpthread -lm

and trying to use blacs_get and blacs_initgrid routines in my code, I am getting very strange errors, wich are not described elsewhere:

libmkl_blacs_intelmpi_ilp64.a(blacs_extended.o): In function `MKL_BLACS_Deallocate':

blacs_extended.c:(.text+0x241): undefined reference to `mkl_serv_iface_deallocate'

libmkl_blacs_intelmpi_ilp64.a(blacs_extended.o): In function `MKL_BLACS_ALLOCATE':

blacs_extended.c:(.text+0x265): undefined reference to `mkl_serv_iface_allocate'

I will be very thankfull for any help.

Cheers,

Alexey

 

0 Kudos
1 Solution
Evarist_F_Intel
Employee
1,068 Views

Hi, Alexey

The problem is in the link-line.

Please include $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a in --start-group ... --end-group, i.e. 

MKL =  $(MKLROOT)/lib/intel64/libmkl_scalapack_ilp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group  -lpthread -lm

BTW, do not you forget -i8 (or similar) option in FFLAGS? Since you use ilp64 mode, intergers are expected to be a size of 8 bytes.

And finally, if mpif90 stands for MPI driver over GNU Fortran you probably need to link against libmkl_gf_ilp64.a, rather than libmkl_intel_ilp64.a.

MKL Link Line Adviser can help with linking: https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor (however, it doesn't include blacs lib inside the group, which is incorrect).

View solution in original post

0 Kudos
2 Replies
Evarist_F_Intel
Employee
1,069 Views

Hi, Alexey

The problem is in the link-line.

Please include $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a in --start-group ... --end-group, i.e. 

MKL =  $(MKLROOT)/lib/intel64/libmkl_scalapack_ilp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group  -lpthread -lm

BTW, do not you forget -i8 (or similar) option in FFLAGS? Since you use ilp64 mode, intergers are expected to be a size of 8 bytes.

And finally, if mpif90 stands for MPI driver over GNU Fortran you probably need to link against libmkl_gf_ilp64.a, rather than libmkl_intel_ilp64.a.

MKL Link Line Adviser can help with linking: https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor (however, it doesn't include blacs lib inside the group, which is incorrect).

0 Kudos
Alexey_K_
Beginner
1,068 Views

Hallo Evarist,

 

Thank you very much for your help.

I got the line for the library linking from the Intel MKL Library Link Advisor. I did this again, and get the same result:

 $(MKLROOT)/lib/intel64/libmkl_blas95_ilp64.a $(MKLROOT)/lib/intel64/libmkl_lapack95_ilp64.a $(MKLROOT)/lib/intel64/libmkl_scalapack_ilp64.a -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -Wl,--end-group $(MKLROOT)/lib/intel64/libmkl_blacs_intelmpi_ilp64.a -lpthread -lm

It seems that there is a bug in Library Link Advisor which should be fixed.

Cheers,

Alexey

0 Kudos
Reply