FAQInstrumentingFortran

From Tau Wiki
Jump to: navigation, search

Tips for instrumenting Fortran code with TAU

Some things to check before you begin

  • Are you using #define, #ifdef, #endif macros any other preprocessing macros in Fortran source code? If so you will need to use to option -optPreProcess. This option is given to tau_compiler.sh like this:
tau_f90.sh -tau_options=-optPreProcess foo.f

If your Fortran code uses free format in .f files (fixed is default for .f) we need to pass the "-R free" option to the TAU parser. TAU options can be specified either on the command line or as the TAU_OPTIONS environment variable:

setenv TAU_OPTIONS ‘-optPdtF95Opts=“-R free” -optVerbose ’
tau_f90.sh foo.f

You may also use TAU's new compiler based instrumentation feature that allows the compiler to insert instrumentation that activates TAU's measurement probes. To use this feature please use -optCompInst TAU option as follows:

setenv TAU_OPTIONS '-optCompInst -optVerbose'
tau_f90.sh foo.f

Compiler based instrumentation does not permit loop level instrumentation. Instrumentation is active at routine level only. You may use TAU's selective instrumentation file to exclude a list of files. Selective instrumentation is not supported by most compilers at the routine level. To use this, please use BEGIN_FILE_EXCLUDE_LIST/END_FILE_EXCLUDE_LIST in the file (say select.tau) and pass it to the compiler using:

setenv TAU_OPTIONS '-optCompInst -optTauSelectFile=/path/to/select.tau -optVerbose'
tau_f90.sh foo.f