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

Intel® Parallel Studio XE 2019 On linux

zidane__ali
Beginner
1,373 Views

Hi,

I've been using parallel studio xe 2019 for evaluation on linux. I had a problem when compiling a very simple test fortran code using

"ifort source.f90 -mkl -qopenmp" it was working on the development machine but when used on a different machine where the parallel studio is not installed i was getting the error: "error while loading shared libraries". What i did is i copied the file libiomp5.so to usr/lib in the virgin machine so that the simple code with print number of threads works. However, when i just introduced to the code the pardiso solver from mkl, the code works on the development machine but on the virgin machine i'm getting: "kmp_aligned_malloc version VERSION not defined in file libiomp5.so with link time reference".

Any help is appreciated.

Thanks !

0 Kudos
1 Solution
Pamela_H_Intel
Moderator
1,373 Views

Hi Ali,

I'm sorry it's not working on your target.

  1. My mistake about the dll. You are using Linux, so you need the so.
  2. Please check your environment variables, for example, is LD_LIBRARY_PATH pointing at /usr/lib?

Try that. Let me know how it goes. Meanwhile, I will look into it a bit more.

Pamela

View solution in original post

0 Kudos
13 Replies
Pamela_H_Intel
Moderator
1,373 Views

Ali,

I see you are using dynamic linking. That means that where ever you run your code, you will need access to all of the dependencies. So if you don't have MKL installed on the "virgin" machine, then you are likely missing some dependencies other than libiomp.so.

Try linking statically so that all dependencies are included.

Pamela

0 Kudos
zidane__ali
Beginner
1,373 Views

Thank you Pamela, I'm using intel parallel studio xe for evaluation, before we can buy it we need to make sure the executable would be running on our clients machine. I've tried to add -static-library when i complied the code but didn't do anything, the code only works on the development machine. For testing i'm using a very simple code the one that comes with the pardiso manual. It works fine on the machine where parallel studio is installed but not on others. 
When i compile i use: ifort source.f90 -mkl -qopenmp

If i add -static-library i still get the same message on the other machine. I don't know how to make the linking fully static !

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Ali - Have you tried using the Link Line Advisor? I've attached a sample from the details you give. Here is the Link Line URL - https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor . Go to the URL, enter your details and you will get the link line and compiler line. As you can see at the bottom of the screen shot, there are several libraries that need to be linked for static compilationLinkLineAdvisor.PNG.

Pamela

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Ali,

Try the link line advisor suggestion first. If it works, fantastic.

If it does not work we will have to link a little differently in order to ensure your code grabs the right OpenMP library. Here's why:

  • There are often other OpenMP implementations (in 3rd party software). The compiler may pick the first one it finds, which could cause conflicts.

Pamela

0 Kudos
zidane__ali
Beginner
1,373 Views

Thanks Pamela, this one does not work either, i've used the following to compile as once suggested by Steve:

ifort -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl -c Source.f90 -o output

But also did not work, he suggested that i move my question to Inel MKL forum. 

I've also used ifort -static-intel also does not work !

Any help is really appreciated !

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Okay. So, I am assuming you are still getting the same error on the target machine: "error while loading shared libraries". If this is the case, then there are some possible solutions.

First, let me explain the issues around OpenMP. Generally, when you link statically, you are creating a single binary with everything you need. EXCEPT, it doesn't work that way with OpenMP. When using OpenMP, linking statically includes everything except for the OpenMP library. The reason for this is that statically linking the OpenMP library can lead to multiple copies of the library in your process, and each copy would maintain its own thread pool, which could make a mess of threads probably degrading your performance. (As an absolute LAST RESORT - risk performance degradation by statically linking (openmp-link:static).) The two much better options:

  1. You can link statically on your dev machine (which will not link OpenMP. Ensure that there is no other application on the target that has a different version of OpenMP! To your target device: Add the statically linked binary; and Add the MKL OpenMP library (libiomp5md.dll).
  2. You can dynamically link on the dev machine (as you originally did). Then put the resulting binary on the target and install MKL on the target. 

If the target device is embedded and not large enough for comfortably installing MKL, use option 1. Otherwise, either solution should work.

NOTE: MKL is free for 90 days, renewable.

0 Kudos
zidane__ali
Beginner
1,373 Views

I've copied the libiomp5md.dll to the virgin machine and compiled the code on the development machine using ifort -static-intel -mkl -qopenmp source.f90

The code works well on the development machine but on the other machine, even when the libiomp5md.dll is copied to usr/lib in linux i get the following error:

kmp_aligned_malloc version VERSION not defined in file libiomp5.so with link time reference

0 Kudos
Pamela_H_Intel
Moderator
1,374 Views

Hi Ali,

I'm sorry it's not working on your target.

  1. My mistake about the dll. You are using Linux, so you need the so.
  2. Please check your environment variables, for example, is LD_LIBRARY_PATH pointing at /usr/lib?

Try that. Let me know how it goes. Meanwhile, I will look into it a bit more.

Pamela

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Ali,

There is one other thing: after making sure there are no 3rd party OpenMP libraries on your target, put libiomp5md.so in /usr/lib, and make sure /usr/lib is listed as the first item in LD_LIBRARY_PATH

Pamela

0 Kudos
zidane__ali
Beginner
1,373 Views

Hi Pamela, i did just that and included in my shell.sh file the following

LD_LIBRARY_PATH="usr/lib:$LD_LIBRARY_PATH"

ifort source.f90 static-intel -mkl -qopenmp

The executable only works where intel parallel studio is installed, on the other machine, even when libiomp5.so file is copied to usr/lib (note there no such file in intel folder called libiomp5md.so). So on the virgin machine i get the following error:

 kmp_aligned_malloc version VERSION not defined in file libiomp5.so with link time reference

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Did you export the path after you set it? Or are you running in the same shell as shell.sh?

You can check with echo $LD_LIBRARY_PATH - from where ever you are running your binary.

0 Kudos
zidane__ali
Beginner
1,373 Views

i just typed export LD_LIBRARY_PATH and now it's working just fine !

Many thanks Pamela, you're the best !

0 Kudos
Pamela_H_Intel
Moderator
1,373 Views

Cool. Glad I could help.

So, for future reference . . . the way Linux works with shells appears tricky till you know what's going on. If you set a variable in one shell (window) you can't access it from another shell, not even from a subshell. And the thing is, when you invoke a program from any shell, the OS spawns a subshell for that program to run in - thereby making it so that you cannot access variables that you just set . . . unless you exported them :)

Cheers!

0 Kudos
Reply