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

static linking when using lapack routine dsytrf

Richard_Kerr
Beginner
388 Views

Hello,

I have the recent 2017 version of the Parallel Studio XE Composer Edition for Fortran Linux

In my program I am calling Lapack routines dsytrf and dsytri2 . I need to statically link the program

In my Makefile I have

$(COMPUTE_INVERSE): $(OBJS)
    $(LNK) $(LDFLAGS)  -o $@ $(OBJS) $(MKLPATH)/libmkl_lapack95_lp64.a $(MKLPATH)/libmkl_blas95_lp64.a  -Wl,--start-group $(MKLPATH)/libmkl_intel_lp64.a $(MKLPATH)/libmkl_intel_thread.a $(MKLPATH)/libmkl_core.a -Wl,--end-group $(LIBS) $(RLIBS)

I defined LDFLAGS =  -static-intel -Bstatic -static-libgcc

I was unsure of what to use for MKLPATH. I initially used MKLROOT, which is set for me when i source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux in my .bashrc file. (If I echo $MKLROOT  i get /opt/intel/compilers_and_libraries_2017.0.098/linux/mkl)

Then i noticed that the libraries such as libmkl_intel_lp64.a are in two places :

$(MKLROOT)/lib/intel64_lin_mic/libmkl_lapack95_lp64.a
$(MKLROOT)/lib/intel64_lin/libmkl_lapack95_lp64.a

My first question is what is the difference?

The first option (_lin_mic) seems to work better.

I still get a linking error though

ld: /opt/intel/compilers_and_libraries_2017.0.098/linux/mkl/lib/intel64_lin_mic/libmkl_intel_lp64.a(_dsytrf_lp64.o): Relocations in generic ELF (EM: 181)
/opt/intel/compilers_and_libraries_2017.0.098/linux/mkl/lib/intel64_lin_mic/libmkl_intel_lp64.a: could not read symbols: File in wrong format

Does anyone know what is going wrong ?

Regards,

Richard

 

0 Kudos
3 Replies
mecej4
Honored Contributor III
388 Views

The first option (_lin_mic) seems to work better.

I do not know by which criteria you say that, but note: unless you have MIC hardware or you are doing cross-development with the objective of eventually running the EXE on a target machine with MIC hardware, you should stay away from anything with "mic" in its name.

Typically, MIC hardware is located on an expensive PCIe board, and you would certainly know if you have a MIC board installed in your system/server.

See http://www.intel.com/content/www/us/en/architecture-and-technology/many-integrated-core/intel-many-integrated-core-architecture.html .

0 Kudos
Gennady_F_Intel
Moderator
388 Views

Richard, 

here description  of this difference extracted from MKL User's Guide (https://software.intel.com/en-us/node/528507)

lib/intel64_lin

Static libraries and shared objects for the Intel® 64 architecture

lib/intel64_lin_mic

Static libraries and shared objects for the Intel® MIC architecture

and we would also recommend to check MKL Linker Adviser in the case if some similar issues will be encountered.

regards.

0 Kudos
Richard_Kerr
Beginner
388 Views

Thanks, I now understand the difference between intel_lin and intel_lin_mc

But I still don't know why I am getting the "Relocations in generic ELF (EM: 181)" and "could not read symbols: File in wrong format" messages.

I have looked at the Linker Advisor and there is nothing there that I haven't tried. I tested both the openMP and sequential threading layer options.

0 Kudos
Reply