Skip to content

Commit

Permalink
#900 pmpi- add vt_trace_pmpi flag to enable tracing
Browse files Browse the repository at this point in the history
- If nothing else, this allows tests to easily pass.
  • Loading branch information
pnstickne authored and lifflander committed Aug 4, 2020
1 parent 7dfb5e3 commit c87c547
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/vt/configs/arguments/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace vt { namespace arguments {

/*static*/ bool ArgConfig::vt_trace = false;
/*static*/ bool ArgConfig::vt_trace_mpi = false;
/*static*/ bool ArgConfig::vt_trace_pmpi = false;
/*static*/ std::string ArgConfig::vt_trace_file = "";
/*static*/ std::string ArgConfig::vt_trace_dir = "";
/*static*/ int32_t ArgConfig::vt_trace_mod = 0;
Expand Down Expand Up @@ -276,8 +277,10 @@ void addTraceArgs(CLI::App& app) {
* Flags to control tracing output
*/
auto trace = "Enable tracing (must be compiled with trace_enabled)";
auto trace_mpi = "Enable tracing of MPI calls (must be compiled with "
"trace_enabled)";
auto trace_mpi = "Enable tracing of select internal MPI calls"
" (must be compiled with trace_enabled)";
auto trace_pmpi = "Enable tracing of external PMPI calls"
" (must be compiled with trace_enabled)";
auto tfile = "Name of trace files";
auto tdir = "Name of directory for trace files";
auto tmod = "Output trace file if (node % vt_stack_mod) == 0";
Expand All @@ -294,6 +297,7 @@ void addTraceArgs(CLI::App& app) {
auto tirecv = "Trace MPI_Irecv request polling";
auto n = app.add_flag("--vt_trace", ArgConfig::vt_trace, trace);
auto nm = app.add_flag("--vt_trace_mpi", ArgConfig::vt_trace_mpi, trace_mpi);
auto no = app.add_flag("--vt_trace_pmpi", ArgConfig::vt_trace_pmpi, trace_pmpi);
auto o = app.add_option("--vt_trace_file", ArgConfig::vt_trace_file, tfile, "");
auto p = app.add_option("--vt_trace_dir", ArgConfig::vt_trace_dir, tdir, "");
auto q = app.add_option("--vt_trace_mod", ArgConfig::vt_trace_mod, tmod, 1);
Expand All @@ -312,6 +316,7 @@ void addTraceArgs(CLI::App& app) {
auto traceGroup = "Tracing Configuration";
n->group(traceGroup);
nm->group(traceGroup);
no->group(traceGroup);
o->group(traceGroup);
p->group(traceGroup);
q->group(traceGroup);
Expand Down
1 change: 1 addition & 0 deletions src/vt/configs/arguments/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct ArgConfig {

static bool vt_trace;
static bool vt_trace_mpi;
static bool vt_trace_pmpi;
static bool vt_trace_sys_all;
static bool vt_trace_sys_term;
static bool vt_trace_sys_location;
Expand Down
2 changes: 2 additions & 0 deletions src/vt/pmpi/pmpi_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

namespace vt { namespace pmpi {

/*static*/ bool PMPIComponent::trace_pmpi = false;

// n.b. This is exepcted to be generated by the generated pmpi wrapper code.
// void PMPIComponent::registerEventHandlers() {}

Expand Down
12 changes: 11 additions & 1 deletion src/vt/pmpi/pmpi_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,38 @@ namespace vt { namespace pmpi {
*/
struct PMPIComponent : runtime::component::Component<PMPIComponent> {

using ArgType = vt::arguments::ArgConfig;

PMPIComponent() {
}

std::string name() override { return "PMPI"; }

void startup() override {
registerEventHandlers();

trace_pmpi = ArgType::vt_trace_pmpi;
}

void finalize() override {
trace_pmpi = false;
}

/**
* \internal
* \brief Return true iff a PMPI call should be logged in the current context.
*/
static bool shouldLogCall() {
return runtime::ScopedMPIAccess::mpiCallsTraced();
return trace_pmpi and runtime::ScopedMPIAccess::mpiCallsTraced();
}

private:

// n.b. This is exepcted to be generated by the generated pmpi wrapper code.
void registerEventHandlers();

static bool trace_pmpi;

};

}} //end namespace vt::pmpi
Expand Down
7 changes: 6 additions & 1 deletion src/vt/runtime/runtime_banner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ void Runtime::printStartupBanner() {
fmt::print("{}\t{}{}", vt_pre, f12, reset);
}
if (ArgType::vt_trace_mpi) {
auto f11 = fmt::format("Tracing MPI invocations");
auto f11 = fmt::format("Tracing MPI invocations (select internal calls)");
auto f12 = opt_on("--vt_trace_mpi", f11);
fmt::print("{}\t{}{}", vt_pre, f12, reset);
}
if (ArgType::vt_trace_pmpi) {
auto f11 = fmt::format("Tracing PMPI invocations (external calls)");
auto f12 = opt_on("--vt_trace_mpi", f11);
fmt::print("{}\t{}{}", vt_pre, f12, reset);
}
Expand Down

0 comments on commit c87c547

Please sign in to comment.