ICC on Linux: link to OpenMP

It comes with its own implementation apparently. You don't need to specify additional libraries as long as you compile with the -openmp flag.

$ icc -openmp t.c
$ ldd ./a.out 
    ...
    libiomp5.so => /opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.so (0x00007fd8e7ac6000)
    ...

The Intel C++ Compiler provides its own OpenMP library, it does not link against libgomp. You can use the -static-intel flag with icc/icpc to get rid of the libiomp5.so dependency, this way your binary runs on systems that do not have installed the Intel C++ Compiler.

$ icpc -openmp -static-intel t.cpp
$ ./a.out

You should use icc's builtin openmp implementation. Just pass the -openmp switch on the commandline, that's it!

Tags:

C++

Openmp