diff --git a/src/vt/pmpi/generate_mpi_wrappers.pl b/src/vt/pmpi/generate_mpi_wrappers.pl index f9c8931eaf..7f5309d993 100644 --- a/src/vt/pmpi/generate_mpi_wrappers.pl +++ b/src/vt/pmpi/generate_mpi_wrappers.pl @@ -100,7 +100,7 @@ sub register_event { sub log_event { my ($name) = @_; say "#if backend_check_enabled(trace_enabled)"; - say " auto scopedEvent = vt::trace::TraceScopedEvent(event_${name});"; + say " auto scopedEvent = vt::trace::TraceScopedEvent(vt::thePMPI()->shouldLogCall() ? event_${name} : vt::trace::no_user_event_id);"; say "#endif"; } diff --git a/src/vt/pmpi/pmpi_component.h b/src/vt/pmpi/pmpi_component.h index ddf25ec752..46feafbb4f 100644 --- a/src/vt/pmpi/pmpi_component.h +++ b/src/vt/pmpi/pmpi_component.h @@ -72,6 +72,14 @@ struct PMPIComponent : runtime::component::Component { registerEventHandlers(); } + /** + * \internal + * \brief Return true iff a PMPI call should be logged in the current context. + */ + bool shouldLogCall() { + return true; + } + private: // n.b. This is exepcted to be generated by the generated pmpi wrapper code. @@ -81,6 +89,10 @@ struct PMPIComponent : runtime::component::Component { }} //end namespace vt::pmpi +namespace vt { + extern pmpi::PMPIComponent* thePMPI(); +} + #endif // backend_check_enabled(pmpi_access_guards) #endif /*INCLUDED_PMPI_PMPI_COMPONENT*/ diff --git a/src/vt/runtime/runtime_component_fwd.h b/src/vt/runtime/runtime_component_fwd.h index c33e15d331..26146c5e3d 100644 --- a/src/vt/runtime/runtime_component_fwd.h +++ b/src/vt/runtime/runtime_component_fwd.h @@ -111,6 +111,11 @@ namespace trace { struct Trace; } #endif +#if backend_check_enabled(mpi_access_guards) +namespace pmpi { +struct PMPIComponent; +} +#endif } /* end namespace vt */ diff --git a/src/vt/runtime/runtime_get.cc b/src/vt/runtime/runtime_get.cc index 2d76bef022..febaefa5d5 100644 --- a/src/vt/runtime/runtime_get.cc +++ b/src/vt/runtime/runtime_get.cc @@ -132,7 +132,10 @@ vrt::collection::balance::StatsRestartReader* theStatsReader() { return CUR_RT-> vrt::collection::balance::LBManager* theLBManager() { return CUR_RT->theLBManager; } #if backend_check_enabled(trace_enabled) -trace::Trace* theTrace() { return CUR_RT->theTrace; } +trace::Trace* theTrace() { return CUR_RT->theTrace; } +#endif +#if backend_check_enabled(mpi_access_guards) +pmpi::PMPIComponent* thePMPI() { return CUR_RT->thePMPI; } #endif #undef CUR_RT