Skip to content

Scorep wrapper#605

Merged
ZedThree merged 5 commits intonextfrom
scorep_wrapper
Jul 11, 2017
Merged

Scorep wrapper#605
ZedThree merged 5 commits intonextfrom
scorep_wrapper

Conversation

@d7919
Copy link
Member

@d7919 d7919 commented Jul 10, 2017

Adds a configure flag to turn on scorep profiling support and some helper macros. This has two main effects:

  1. Update the compiler command (MPICXX) to use scorep with the options --user and --nocompiler. For example if initially MPICXX=mpicxx then when configured --with-scorep this will become MPICXX=scorep --user --nocompiler mpicxx. The option --nocompiler disables automatic instrumentation of every routine (found to cause too much overhead due to large number of calls to small routines). The --user option enables user defined instrumentation. By default there are no user defined regions so the profiled code will only typically record time in MPI routines.
  2. Provides macros of the form SCOREP0, SCOREP1 etc. which can be placed at the start of routines the user wishes to instrument. The number signifies the "level", with SCOREPLVL defining which levels are to be included. This follows the same approach as the assert macros.

The variable __func__ is part of the c++11 standard and gives the current routine name. This is used within the macros to ensure that the profiler records an appropriate name for each instrumented region. However, some compilers provide a __PRETTY_FUNCTION__ variable which provides the entire function signature. This is used if available instead of __func__ as it provides more information. A test for this support is a part of the configure stage.

Currently there are no uses of SCOREPN in any of the source code, and hence configuring with --with-scorep does not provide any timing information. It's possible that we may want to include some of these macros in the committed code at some point (and also possible that we don't). But this may lead to more clutter than desirable so we might want to think about having a BOUT_FUNCTION_HEADER macro that includes things like the SCOREPN macro, the TRACE macro and any other common items (alternatively we could imagine including the SCOREPN macro inside the TRACE macro).

d7919 added 5 commits July 6, 2017 15:51
routines for user instrumentation. To be active requires
`BOUT_HAS_SCOREP` to be defined (need to add this to configure).

Need to add a test to configure to see if the compiler being used
supports `__PRETTY_FUNCTION__` (should be supported by gcc, clang and
intel at least). If so then we should define `__HAS_PRETTY_FUNCTION`.

Finally the "level" of the instrumentation to be used is controlled by
`SCOREPLVL`, set negative to disable all instrumentation.
Adds the option `--with-scorep`, can point to the directory containing
the `scorep` executable otherwise try to find it in `PATH` using `which`
Update configure.ac to use better practice approach.
@d7919
Copy link
Member Author

d7919 commented Jul 10, 2017

Not sure if this is the sort of thing that we want to include with the main code, but it is quite helpful for those wishing to profile with scorep (/scalasca).

//check if __PRETTY_FUNCITON__ is defined or not. Instead we need to say if we support this
//or not by defining HAS_PRETTY_FUNCTION (to be implemented in configure)

#ifdef HAS_PRETTY_FUNCTION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this just check #ifdef PRETTY_FUNCTION rather than checking in configure?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, because __PRETTY_FUNCTION__ (and __func__) are actually variables and not preprocessor macros

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes can confirm what @ZedThree says about this -- slightly painful but the configure check is relatively easy.

@ZedThree ZedThree merged commit 0aa3161 into next Jul 11, 2017
@ZedThree ZedThree deleted the scorep_wrapper branch July 11, 2017 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants