Intel compilers include two sets of OpenMP libraries:
The Compatibility OpenMP libraries, which provide compatibility with OpenMP support provided by certain versions of the Microsoft Visual C++* compiler on Windows* OS, certain versions of the GNU* compilers on Linux* OS and Mac OS* X, as well as the Intel compiler version 10.x (and later).
The Legacy OpenMP libraries, which provide compatibility with OpenMP support provided by Intel compilers, including Intel compilers prior to version 10.0.
To select the Compatibility (default) or Legacy OpenMP libraries, use the Intel compiler to link your application and specify the Intel compiler option /Qopenmp-lib (Windows OS) or -openmp-lib (Linux OS and Mac OS X) .
The term "object-level interoperability" refers to the ability to link object files and libraries generated by one compiler with object files and libraries generated by the second compiler, such that the resulting executable runs successfully. In contrast, "source compatibility" means that the entire application is compiled and linked by one compiler, and you do not need to modify the sources to get the resulting executable to run successfully.
Different compilers support different versions of the OpenMP specification. Based on the OpenMP features your application uses, determine what version of the OpenMP specification your application requires. If your application uses an OpenMP specification level equal or less than the OpenMP specification level supported by all the compilers, your application should have source compatibility with all compilers, but you need to link all object files and libraries with the same compiler's OpenMP libraries.
OpenMP Compatibility Libraries Provided by Intel Compilers
The Compatibility libraries provide source compatibility and object-level interoperability with the OpenMP support provided by:
On Windows* OS, certain versions of Microsoft Visual C++* that support OpenMP, starting with Microsoft Visual C++ 2005.
On Linux* OS and Mac OS* X, certain versions of GNU* gcc* that support OpenMP, starting with GNU* gcc* version 4.2.
Intel compilers versions 10.0 and later and their supplied OpenMP libraries.
For Fortran applications on Linux systems, it is not possible to link objects compiled by the Intel® Fortran Compiler (ifort) with objects compiled by the GNU* Fortran compiler (gfortran). Thus, for mixed-language C++ and Fortran applications, you can do one of the following:
Combine objects created by gfortran and Intel® C++ objects, if you specify the Intel OpenMP Compatibility libraries during linking.
Combine objects created by the Intel C++ compiler and the Intel Fortran Compiler, using Intel OpenMP Compatibility or Legacy libraries.
OpenMP Legacy Libraries Provided by Intel Compilers
The set of Legacy OpenMP libraries has been provided by Intel compilers for multiple releases and provide source compatibility and object-level interoperability with the current Legacy libraries and OpenMP libraries provided by previous Intel compiler versions, including those prior to version 10.0. The Legacy libraries are not compatible with OpenMP support from non-Intel compilers, such as Microsoft Visual C++*, GNU gcc*, or GNU Fortran.
You should only use the Legacy libraries if your application requires object-level interoperability with OpenMP library versions provided prior to Intel compilers version 10.0.
Guidelines for Using Different Intel Compiler Versions
To avoid possible linking or run-time problems, follow these guidelines:
If you compile your application using only the Intel compilers, avoid mixing the Compatibility and Legacy OpenMP runtime libraries. That is, you must link the entire application with either the Compatibility or Legacy libraries.
When using the Legacy libraries, use the most recent Intel compiler to link the entire application. However, be aware that the Legacy libraries are deprecated, so for a future release, you will need to link the entire application with the Compatibility libraries.
Use dynamic instead of static OpenMP libraries to avoid linking multiple copies of the libraries into a single program. For details, see OpenMP Support Libraries.
Guidelines for Using Intel and Non-Intel Compilers
To avoid possible linking or run-time problems, follow these guidelines:
Always link the entire application using the Intel compiler OpenMP Compatibility libraries. This avoids linking multiple copies of the OpenMP runtime libraries from different compilers. It is easiest if you use the Intel compiler command (driver) to link the application, but it is possible to link with the Intel compiler OpenMP Compatibility libraries when linking the application using the GNU* or Visual C++ compiler (or linker) commands.
If possible, compile all the OpenMP sources with the same compiler. If you compile (not link) using multiple compilers such as the Microsoft Visual C++* or GNU compilers that provide object-level interoperability with the Compatibility libraries, see the instructions in Using the OpenMP Compatibility Libraries.
Use dynamic instead of static OpenMP libraries to avoid linking multiple copies of the libraries into a single program. For details, see OpenMP Support Libraries.
Limitations When Using OpenMP Compatibility Libraries with Other Compilers
Limitations of threadprivate objects on object-level interoperability:
On Windows OS systems, the Microsoft Visual C++* compiler uses a different mechanism than the Intel compilers to reference threadprivate data. If you declare a variable as threadprivate in your code and you compile the code with both Intel compilers and Visual C++ compilers, the code compiled by the Intel compiler and the code compiled by the Visual C++* compiler will reference different locations for the variable even when referenced by the same thread. Thus, use the same compiler to compile all source modules that use the same threadprivate objects.
On Linux OS systems, the GNU* compilers use a different mechanism than the Intel compilers to reference threadprivate data. If you declare a variable as threadprivate in your code and you compile the code with both Intel compilers and GNU compilers, the code compiled by the Intel compiler and the code compiled by the GNU compiler will reference different locations for the variable even when referenced by the same thread. Thus, use the same compiler to compile all source modules that use the same threadprivate objects.
On Mac OS* X systems, the operating system does not currently support the mechanism used by the GNU* compiler to support threadprivate data. Threadprivate data objects will only be accessible by name from object files compiled by the Intel compilers.