Page 1 of 1

OpenMP code generated by the compiler

PostPosted: Thu Feb 06, 2014 5:55 pm
Hi all,

I'm new in the forum and in OpenMP. I'm glad to have the possibility to join you, learn and try to give my contribution.

I have a question about compilation of OpenMP code.
In my understanding, in general, an OpenMP code is transformed by the compiler in a normal thread program.
Does exist a way to show how the code is transformed by a compiler like GCC, clang or icc?

Best Regards,

Re: OpenMP code generated by the compiler

PostPosted: Tue Feb 11, 2014 5:42 am
by MarkB
Hi Simone,

In general, "commercial" compilers (including gcc) translate OpenMP to standard C (or C++, or Fortran) with calls to an OpenMP runtime library
(e.g. libgomp for gcc) which is in turn implemented on top of standard threading libraries. However, they don't actually generate source code as
an intermediate step: the process is more tightly integrated into the overall compilation process, and there's usually no facility to generate a source code representation of the transformed code. The nearest you can get is to dump an intermediate representation which is C-like, but not C, for example with the gcc flag -fdump-tree-optimized. This will contain calls to libgomp, for which the source code is public. However, from a programmer's point of view, this probably isn't especially useful.

Some research compilers, for example OpenUH , can actually produce the transformed source code.

Hope that helps,

Re: OpenMP code generated by the compiler

PostPosted: Tue Apr 07, 2015 10:21 pm
by grindaah
Topic is pretty old, but if some on interested in same, i can say, that Mercurium compiler has some flags to show you the transformed code
You can find it as a part of OmpSS project