Skip to content

Commit

Permalink
#900 pmpi- add basic runtime 'should log' control point
Browse files Browse the repository at this point in the history
- This should (eventually) use option flags and/or the scheduler
  runtime depth information to determine if a PMPI call should
  be logged, regardless of overall tracing status.

  This also finishes up some component registration and exposure,
  as needed to be accessed from the free functions.
  • Loading branch information
pnstickne committed Jul 14, 2020
1 parent 588153c commit 2fa95e3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vt/pmpi/generate_mpi_wrappers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
12 changes: 12 additions & 0 deletions src/vt/pmpi/pmpi_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ struct PMPIComponent : runtime::component::Component<PMPIComponent> {
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.
Expand All @@ -81,6 +89,10 @@ struct PMPIComponent : runtime::component::Component<PMPIComponent> {

}} //end namespace vt::pmpi

namespace vt {
extern pmpi::PMPIComponent* thePMPI();
}

#endif // backend_check_enabled(pmpi_access_guards)

#endif /*INCLUDED_PMPI_PMPI_COMPONENT*/
5 changes: 5 additions & 0 deletions src/vt/runtime/runtime_component_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ namespace trace {
struct Trace;
}
#endif
#if backend_check_enabled(mpi_access_guards)
namespace pmpi {
struct PMPIComponent;
}
#endif

} /* end namespace vt */

Expand Down
5 changes: 4 additions & 1 deletion src/vt/runtime/runtime_get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2fa95e3

Please sign in to comment.