Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Compiling with different OpenMP runtime library.

M__F__Mokbel
Beginner
1,152 Views
Hi all,

I'm having a problem when trying to compile OpenMP code using Intel compiler with MS vcomp OpenMP runtime library. What I want is to build my OpenMP program with Intel compiler (V 11.1), but using different OpenMP runtime library and not the one provided by intel (libiomp5md). I'm trying to compile and link against MS Visual Studio 2008 OpenMP runtime library vcomp9 but to no avail. Please note that I've read the manual regarding this issue, and the compatibility one, but still I can't figure out how to compile AND link with Intel compiler using MS VS 08 OpenMP runtime library. It would be very helpful if anyone can provide the exact command line to do it.

Thanks in advance.
0 Kudos
1 Solution
JenniferJ
Moderator
1,152 Views
Quoting - mokbel
"vcomp.lib works only with MSVC OpenMP, not with intel C OpenMP or performance libraries."

Intel C++ Compiler DOES support vcomp.lib, you can mix the object compiled with ICL and VC. I think Tim is saying that you should not use two omp libs together in one application or use vcomp.lib and the intel performance libraries because some performance libaries use the intelc omp libs.

To achieve your goal, read this article: http://software.intel.com/en-us/articles/how-to-use-intelr-compiler-openmp-compatibility-libraries-on-windows/

Jennifer

View solution in original post

0 Kudos
6 Replies
TimP
Honored Contributor III
1,152 Views
vcomp.lib works only with MSVC OpenMP, not with intel C OpenMP or performance libraries. libiomp5 supports both the Microsoft and the Intel compilers. In order to use vcomp, you would have to ensure that OpenMP is active only in source files compiled by VC9. I don't recall that this was at all difficult, but I've done it only to verify the claim that libiomp5 out-performs vcomp. If you have any OpenMP compiled by Intel compilers, you must exclude vcomp and vcomp9.
0 Kudos
M__F__Mokbel
Beginner
1,152 Views
Quoting - tim18
vcomp.lib works only with MSVC OpenMP, not with intel C OpenMP or performance libraries. libiomp5 supports both the Microsoft and the Intel compilers. In order to use vcomp, you would have to ensure that OpenMP is active only in source files compiled by VC9. I don't recall that this was at all difficult, but I've done it only to verify the claim that libiomp5 out-performs vcomp. If you have any OpenMP compiled by Intel compilers, you must exclude vcomp and vcomp9.

"vcomp.lib works only with MSVC OpenMP, not with intel C OpenMP or performance libraries."
So, what you're saying here is that I can't build with vcomp.lib using Intel compiler.
"libiomp5 supports both the Microsoft and the Intel compilers"
But, I can build with Intel libiomp5md using MSVS 08.
"In order to use vcomp, you would have to ensure that OpenMP is active only in source files compiled by VC9"
However, I can compile with vcomp using MSVC 08 and link using Intel compiler provided that this condition is satisfied.
"I don't recall that this was at all difficult, but I've done it only to verify the claim that libiomp5 out-performs vcomp"
Exactly, that's what I'm trying to do, and indeed libiomp5md outperform MS and other compilers as well.
0 Kudos
JenniferJ
Moderator
1,153 Views
Quoting - mokbel
"vcomp.lib works only with MSVC OpenMP, not with intel C OpenMP or performance libraries."

Intel C++ Compiler DOES support vcomp.lib, you can mix the object compiled with ICL and VC. I think Tim is saying that you should not use two omp libs together in one application or use vcomp.lib and the intel performance libraries because some performance libaries use the intelc omp libs.

To achieve your goal, read this article: http://software.intel.com/en-us/articles/how-to-use-intelr-compiler-openmp-compatibility-libraries-on-windows/

Jennifer
0 Kudos
TimP
Honored Contributor III
1,152 Views

Intel C++ Compiler DOES support vcomp.lib, you can mix the object compiled with ICL and VC. I think Tim is saying that you should not use two omp libs together in one application or use vcomp.lib and the intel performance libraries because some performance libaries use the intelc omp libs.

To achieve your goal, read this article: http://software.intel.com/en-us/articles/how-to-use-intelr-compiler-openmp-compatibility-libraries-on-windows/

Jennifer
I just tried it again with current compilers on X64, but it wasn't so easy to link a mixture of Intel and VC9 .obj and run against vcomp or vcompd rather than libiomp5md.
As Jennifer mentions, linking against more than one OpenMP library may be a disaster; has even been known to produce wrong results without any clear warning.
0 Kudos
M__F__Mokbel
Beginner
1,152 Views

Intel C++ Compiler DOES support vcomp.lib, you can mix the object compiled with ICL and VC. I think Tim is saying that you should not use two omp libs together in one application or use vcomp.lib and the intel performance libraries because some performance libaries use the intelc omp libs.

To achieve your goal, read this article: http://software.intel.com/en-us/articles/how-to-use-intelr-compiler-openmp-compatibility-libraries-on-windows/

Jennifer

Thanks for providing the reference, that's exactly what I want. (Even though I've already manged to cross compile and link but with the same libiomp5md library). Actually, I'm aware of the mixing usage of libraries, it is already addressed in the documenttion, but thanks for the clarifications.
0 Kudos
DarioMangoni
Beginner
1,152 Views

I resume the post to help me clarify. Please correct me if/where I'm wrong.

Both MSVC and Intel Compilers (both icc and ifort) can link objects that are compiled either with vcomp or iomp.
But I should avoid to mix objects linking different OpenMP libraries, otherwise the output file will depend on both.

MSVC
can compile either with:
- vcomp (default)
- iomp (with -nodefaultlib:vcomp.lib)(*)

Intel Compilers (both icc and ifort)
can compile with
- iomp (default)

but cannot compile with:
- vcomp (or at least, I cannot avoid to link iomp!)(**)

Now: I'm building shared libraries. One is built with MSVC, the other with Intel(***).
Because of (*) I can make both libraries depend on iomp (just avoid linking vcomp from MSVC and it's done).
But what if I would like to link both to vcomp? Because of (**) it seems to be a little tricky if ever possible.
How can I use two different dlls without previously agreeing on which OpenMP library to use?

P.S.(***) I have to compile the second library with Intel because it's written in Fortran so I need ifort!

0 Kudos
Reply