As a proof of concept and a means for experimentation, we implemented OPARI (OpenMP Pragma And Region Instrumentor). It is a source-to-source translator which performs the OpenMP directive and API call transformations described in this paper, including the new proposed directives and !$POMP INST alternative sentinel. The current prototype implements full Fortran77 and Fortran90 OpenMP 2.0 and full C/C++ OpenMP 1.0 support. The instrumentation of user functions (based on PDT ) is under way. The tool consists of about 2000 lines of C++ code.
Being just a source-to-source translator based on a (very) fuzzy parser, and not a full compiler, OPARI has a few small limitations:
We did not find these limitations overly restrictive during our tests and experiments. They rarely apply for well-written code. If they do, the original source code can easily be fixed. Of course, it is possible to remove these limitations by enhancing OPARI's parsing capabilities.
Finally, if the performance measurement environment does not support the automatic recording of user functions entries and exits, and therefore cannot automatically instrument the program's main function, the OPARI runtime measurement library has to be initialized by a !$OMP INST INIT directive / pragma prior to any other OpenMP pragma.