Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Intel® Parallel Studio XE 2019

zidane__ali
Beginner
1,919 Views

Hi,

I've been using intel composer for few years on windows. I've recently switched to linux and i'm evaluating the parallel studio xe.

My question is when i compile and output an executable on linux it does not work on another computer unless the mkl library is also installed on it. On windows i could give the executable to our clients without them needing to install the mkl library. Is it possible to have an executable on linux that works on every linux computer without installing the libraries ?

Any help is appreciated.

Thanks,

AZ

0 Kudos
16 Replies
Steve_Lionel
Honored Contributor III
1,919 Views

As on Windows, you need to specify that you want  to link to static libraries. My guess is that you are linking to the MKL shared objects.

0 Kudos
zidane__ali
Beginner
1,919 Views

Thank you Steve, on windows i use MVS IDE where i can easily set the libraries to be static. On Linux i use a terminal where i give the command: ifort -mkl -qopenmp source.f90 -o output

i guess from your reply this command does not specify the library to be static. I would be thankful if you can tell me what do i need to add to make it work.
Many thanks !

0 Kudos
Steve_Lionel
Honored Contributor III
1,919 Views

Try adding -static-intel  . I am unsure if that affects MKL, it may. Otherwise you should check out the MKL Link Line Advisor.

0 Kudos
zidane__ali
Beginner
1,919 Views

-static-intel didn't work

so i used the link line advisor (full command below) and it didn't work either, please advise what i'm doing wrong:

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

0 Kudos
Steve_Lionel
Honored Contributor III
1,919 Views

I suggest you ask in the MKL forum.

0 Kudos
mecej4
Honored Contributor III
1,919 Views

The presence of -c in the command line shown in #5 makes the whole undertaking pointless, since that option inhibits linking, and all the other options pertain to linking. Furthermore, since you also have a -o option, the object file resulting from the compilation is given an incorrect suffix, possibly rendering it useless.

Either no linking took place, or there is a different linking command in a makefile (?) that does not do what you want it to do.

0 Kudos
zidane__ali
Beginner
1,919 Views

Thank you mecej4, could you please advise how should i change the command line? I tried separating -c source.f90 into another command line but i still get the same error when running the code on a different machine where mkl is not installed !

0 Kudos
mecej4
Honored Contributor III
1,919 Views

So far, you have not shown us the command that produced an executable file, nor have you told us much about the source files and library routines that they use. We do not know the compiler version and the platform details. Without all this information being provided, there is no way that I can advise you what to do.

If you are going to do development in a command line environment, you need to learn about file types, file suffixes, and the basic procedures involved in producing object files and linking those to produce an executable.

0 Kudos
zidane__ali
Beginner
1,919 Views

the source is very simple for testing

program test

use omp_lib

implicit none

integer::i

i=omp_get_thread_num()

write(*,*)'test',i

end

to compile i write: ifort source.f90 -mkl -qopenmp

i'm using intel parallel studio xe 2019 as i've mentioned in the title

problem when i run a.out on a different computer where the parallel studio is not installed i get the following: error while loading shared libraries

 

0 Kudos
mecej4
Honored Contributor III
1,919 Views

Your program does not use MKL.Therefore, none of the extra MKL libraries that you specified in #5 were necessary.

What is the name of the missing shared library on the "different" machine? What is the output of the command

     ldd ./a.out

when run on the development machine?

It is probable that the only shared library needed is libiomp5.so. If so, you have to copy that file (assuming that your license permits this) to the second machine. Such dependencies are not uncommon on Linux, even when you compiled using static libraries.

0 Kudos
zidane__ali
Beginner
1,919 Views

this one doesn't, my original program calls pardiso solver, i've reduced the program to this simple one trying to find the root of the problem still couldn't. 
For this one true the missing library is libiomp5.so, and even if i copy this file from intel parallel studio folder to the same directory where the executable is i get the same error message. Even on the same development machine, if i open a new terminal trying to run the executable i get the same error message unless i do "source psxevars.sh" then it works on the development machine but not on another machine where parallel studio is not installed.
When i type ldd ./a.out i get the following:

linux-vdso.so.1 (0x00007fff5dff4000)
    libiomp5.so => /home/ali/intel/compilers_and_libraries_2019.2.187/linux/compiler/lib/intel64_lin/libiomp5.so (0x00007fe23d7ed000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe23d44f000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe23d230000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe23ce3f000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe23cc27000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe23ca23000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe23dbd5000)

Hope you can help with this !

0 Kudos
mecej4
Honored Contributor III
1,919 Views

On the second machine, where did you install libiomp5.so? If that was not in /usr/lib64 (for 64 bit) or /usr/lib, you need to make sure that the environment variable LD_LIBRARY_PATH contains the path to the directory within which libiomp5.so is located, and that the shared library has the correct permissions set.

On the development machine, one of the tasks that source psxevars.sh accomplishes is to set LD_LIBRARY_PATH. To see this, use the command echo $LD_LIBRARY_PATH before and after the command source psxevars.sh

0 Kudos
zidane__ali
Beginner
1,919 Views

i've copied the libiomp5.so to usr/lib, now when i run a.out i get "wrong ELF class" ! 

0 Kudos
Juergen_R_R
Valued Contributor I
1,919 Views

That means that you either used a 32bit library on a 64bit system or vice versa.

0 Kudos
mecej4
Honored Contributor III
1,919 Views

In situations like this, the Unix/Linux file command can be helpful in knowing more about the nature of a file:

      $ file /usr/lib/libiomp5.so

If the file is a 64-bit shared library, you should move it from /usr/lib to /usr/lib64 .

0 Kudos
zidane__ali
Beginner
1,919 Views

thank you this fixed this problem, however if i just introduce the pardiso solver from the manual it works on the development machine but on the virgin machine i get: 

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

i don't know if this could be fixed by copying another library ?

0 Kudos
Reply