开发者

ICC on Linux: link to OpenMP

开发者 https://www.devze.com 2023-03-15 06:03 出处:网络
What are the steps to link to OpenMP with Intel C++ compiler? Does Intel compiler ship with its own OpenMP library or should开发者_C百科 I link to libgom?It comes with its own implementation apparentl

What are the steps to link to OpenMP with Intel C++ compiler? Does Intel compiler ship with its own OpenMP library or should开发者_C百科 I link to libgom?


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!


Since icc version 17 openmp argument is deprecated:

icc: command line remark #10411: option '-openmp' is deprecated and will be removed in a future release. Please use the replacement option '-qopenmp'

And icc has own openmp library.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号