- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have a question about mixing Fortran/OpenMP application with C++/OpenMP library. For simplicity let us assume we are working on Linux with GCC and ifort (in reality we are also working on Windows/MSVC and macOS/clang). Mixing Fortran and C++ is not a problem. The problem is how to compile Fortran files with ifort, C++ files with GCC and link everything against one OpenMP implementation (ideally Intel's OpenMP implementation).
Using the OpenMP* Libraries suggests it possible and easy, but my experience and this stackoverflow question disagrees. The issue is that GCC transforms OpenMP command to GCC's function calls (e.g. GOMP_loop_nonmonotonic_dynamic_start) which are obviously not implemented in iomp5.
Is there any other way of mixing ifort/OpenMP, GCC/OpenMP and iomp5 other than using Intel's C++ compiler? With ifort, icpc and iomp5 everything works as expected but I am looking for alternative.
We are using ifort 18.0 and GCC 8.
Thank you in advance,
Goran
- Tags:
- Parallel Computing
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Libiomp5 accepts both libgomp and libiomp5 function calls. Either Intel C÷÷ or g÷÷ are supported together with ifort with both languages having full access to OpenMP. By linking explicitly to libiomp5 (or by using the Intel compiler to drive the linking), you satisfy all the dependencies on libgomp and avoid linking the latter. You must not link more than 1 copy of OpenMP library.
Similarly in Windows libiomp supports OpenMP in Microsoft C++ but with the limitation of OpenMP 2.0. Performance of libiomp5 should be better than vcomp. Again you must take care to link only one OpenMP library, likely with use of nodefaultlib to exclude vcomp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
thank you for the response. After some extra research I found one additional requirement which I was not aware of. I was mixing ifort with unsupported version of GCC (ifort 18.0 supports GCC up to version 6). Our code does not compile with GCC 6 so I tested with ifort 19.0 and GCC 8. To my big surprise everything works as expected.
Just to summarize: it is possible to mix Fortran code with OpenMP directives complied with ifort 19.0 and C/C++ code with OpenMP directives compiled with GCC 8 and link against iomp5 without any issues.
Kind regards,
Goran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's possible when a major version of gcc involves an ABI change that libiomp5 might not support it until a linux distro including that gcc is supported. This doesn't happen often, and it's not easy to infer from release notes exactly where that stands. Release notes (if they are even up to date) reflect which compatibilities undergo the full rounds of testing, rather than what the actual limits might be. OpenMP interfaces don't have much C++ as opposed to C and Fortran in them, so an ABI change in g++ alone may not be a problem. It's hard to believe that gcc 6 could be the limit of current working versions, even if that is what comes with RedHat.
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page