OpenMP code generated by the compiler

General OpenMP discussion

OpenMP code generated by the compiler

Postby » 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,
Posts: 6
Joined: Thu Feb 06, 2014 5:37 pm

Re: OpenMP code generated by the compiler

Postby MarkB » Tue Feb 11, 2014 5:42 am

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,
Posts: 772
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: OpenMP code generated by the compiler

Postby grindaah » Tue Apr 07, 2015 10:21 pm

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
Posts: 2
Joined: Thu Jan 29, 2015 10:17 am

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 2 guests