next up previous
Next: Compiling instrumented C Up: Investigating code segments with Previous: Example using OpenMP (FORTRAN)

Compiling instrumented Fortran

As explained before all files containing instrumentation need to contain the statement

  #include "f_hpm.h"
which is not standard Fortran and needs to be interpreted by the preprocessor. On HPCx the preprocessor can be invoked easily with the -qsuffix option of the xlf Fortran compiler
depending on whether the file is called filename.f or filename.f90.

To compile the instrumented code my_prog.f90 on HPCx and link it against the HPM toolkit use

  mpxlf90_r -qsuffix=cpp=f90 -o my_prog.x my_prog.f90 \
    -I/usr/local/packages/actc/hpmtk/include  \
    -L/usr/local/packages/actc/hpmtk/pwr4/lib -lhpm -lpmapi
For a code old_prog.f this becomes:
  mpxlf_r -qsuffix=cpp=f -o old_prog.x old_prog.f \
    -I/usr/local/packages/actc/hpmtk/include \ 
    -L/usr/local/packages/actc/hpmtk/pwr4/lib -lhpm -lpmapi
For an code using OpenMP, the -lhpm has to be replaced by -lhpm_r and the option -qsmp=omp has to be added.

Joachim Hein