0
votes

I have a Fortran MPI program that uses openMP and MKL. On my personal computer I would compile with the Intel compiler by calling something like mpiifort Program.F90 -i8 -qmkl -fopenmp -o run, and then run the program as mpirun ./run.

I would like to run this program on a cluster, where I have access to Intel MPI but no other libraries. Hence I need to link MKL statically. From the Intel MKL Link Line Advisor I obtain the following,

-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -liomp5 -lpthread -lm -ldl

This line is set up such that MKL will parallelize with openMP, which I want for my code. However if I try to run this code on the cluster, I get the error: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory. Seemingly my attempt to link parallelized MKL has not been fully static, since it still tries to link dynamically. Is there any way in which I can circumvent this problem, i.e. link the openMP threaded version of MKL in a fully static way?

Thanks!

Your link line has -liomp5. Spell that one out: use the explicit .a version. - Victor Eijkhout
Thanks! That seems to have fixed it - Jasper
Be very careful, though. Having more than one OpenMP runtime linked into the same code can lead to poor performance due to each using its own thread pool... ( What you're doing is likely OK as you'll still only have one OpenMNP runtime, whereas statically linking OpenMP into each static library when it is built is potentially not!) - Jim Cownie