Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling OpenMP code to C code

Is there a way I can compile code with OpenMP to C code (With OpenMP part translated to plain C), so that I can know what kind of code is being generated by OpenMP. I am using gcc 4.4 compiler.

like image 211
MetallicPriest Avatar asked May 16 '12 10:05

MetallicPriest


1 Answers

Like the other commenters pointed out gcc doesn't translate OpenMP directives to plain C.

But if you want to get an idea of what gcc does with your directives you can compile with the -fdump-tree-optimized option. This will generate the intermediate representation of the program which is at least C-like.

There are several stages that can be dumped (check the man page for gcc), at the optimized stage the OpenMP directives have been replaced with calls to the GOMP runtime library. Looking at that representation might give you some insights into what's happening.

like image 117
johlo Avatar answered Sep 21 '22 00:09

johlo