Merged
Conversation
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.
Member
Author
|
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 |
bendudson
reviewed
Jul 11, 2017
| //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 |
Contributor
There was a problem hiding this comment.
Can this just check #ifdef PRETTY_FUNCTION rather than checking in configure?
Member
There was a problem hiding this comment.
Unfortunately not, because __PRETTY_FUNCTION__ (and __func__) are actually variables and not preprocessor macros
Member
Author
There was a problem hiding this comment.
Yes can confirm what @ZedThree says about this -- slightly painful but the configure check is relatively easy.
ZedThree
approved these changes
Jul 11, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a configure flag to turn on
scorepprofiling support and some helper macros. This has two main effects:MPICXX) to usescorepwith the options--userand--nocompiler. For example if initiallyMPICXX=mpicxxthen when configured--with-scorepthis will becomeMPICXX=scorep --user --nocompiler mpicxx. The option--nocompilerdisables automatic instrumentation of every routine (found to cause too much overhead due to large number of calls to small routines). The--useroption enables user defined instrumentation. By default there are no user defined regions so the profiled code will only typically record time inMPIroutines.SCOREP0, SCOREP1etc. which can be placed at the start of routines the user wishes to instrument. The number signifies the "level", withSCOREPLVLdefining which levels are to be included. This follows the same approach as the assert macros.The variable
__func__is part of thec++11standard 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
SCOREPNin any of the source code, and hence configuring with--with-scorepdoes 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 aBOUT_FUNCTION_HEADERmacro that includes things like theSCOREPNmacro, theTRACEmacro and any other common items (alternatively we could imagine including theSCOREPNmacro inside theTRACEmacro).