Tpetra parallel linear algebra
Version of the Day
|
Profile the given scope. More...
#include <Tpetra_Details_Profiling.hpp>
Public Member Functions | |
ProfilingRegion (const char name[]) | |
Open region to profile; name the region name . More... | |
~ProfilingRegion () | |
Close region to profile. More... | |
Profile the given scope.
This class implements a "scope guard" for profiling a region of code, using Kokkos Profiling.
If you disable Kokkos Profiling by setting some configuration option such that KOKKOS_ENABLE_PROFILING is not defined, then this class is harmless, but will do NOTHING.
Tpetra currently uses Kokkos::Profiling::pushRegion(name) to start the region to profile, and Kokkos::Profiling::popRegion() to close the region to profile. The "scope guard" idiom means that the destructor automatically closes the region, no matter how the scope exits, even if an exception is thrown.
Here is an example of how to use this class:
It's critical that you not forget to name the ProfilingRegion variable. If you forget, you will create a temporary ProfilingRegion object that will first open, then immediately close the "region" before anything else happens. This is not what you want.
You may name regions whatever you like. They don't have to have the same name as the region variable. Kokkos Profiling has a length limit of 512 characters for region names.
For details about Kokkos Profiling, see the kokkos-tools wiki:
https://github.com/kokkos/kokkos-tools/wiki
Definition at line 100 of file Tpetra_Details_Profiling.hpp.
Tpetra::Details::ProfilingRegion::ProfilingRegion | ( | const char | name[] | ) |
Open region to profile; name the region name
.
Definition at line 57 of file Tpetra_Details_Profiling.cpp.
Tpetra::Details::ProfilingRegion::~ProfilingRegion | ( | ) |
Close region to profile.
Definition at line 61 of file Tpetra_Details_Profiling.cpp.