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 as described in this paper, including the proposed !$OMP INST directives. 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 the following 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.
To integrate performance tools with the proposed OpenMP performance interface, two issues must be addressed. First, the OpenMP program must be instrumented with the appropriate performance calls. We have shown how OPARI provides the necessary directive transformations to do this automatically. Second, a performance library must be developed to implement the OpenMP performance API for the particular performance tool. The following describes two performance tools, EXPERT and TAU that have been integrated with the proposed OpenMP performance interface. In each case, both OpenMP applications and hybrid (OpenMP+MPI) applications are supported. The latter demonstrates the ability to combine the OpenMP performance interface with other performance interface mechanisms in a seamless manner.