Skip to content

Commit

Permalink
Split and shorten config recipe strings
Browse files Browse the repository at this point in the history
  • Loading branch information
daboehme committed Oct 23, 2024
1 parent 402e432 commit 6e4b448
Show file tree
Hide file tree
Showing 28 changed files with 1,830 additions and 1,889 deletions.
55 changes: 52 additions & 3 deletions src/caliper/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ namespace cali

// defined in controllers/controllers.cpp
extern const ConfigManager::ConfigInfo* builtin_controllers_table[];
extern const char* builtin_option_specs;

extern const char* builtin_base_option_specs;
extern const char* builtin_gotcha_option_specs;
extern const char* builtin_libdw_option_specs;
extern const char* builtin_mpi_option_specs;
extern const char* builtin_openmp_option_specs;
extern const char* builtin_cuda_option_specs;
extern const char* builtin_rocm_option_specs;
extern const char* builtin_pcp_option_specs;
extern const char* builtin_umpire_option_specs;
extern const char* builtin_papi_option_specs;
extern const char* builtin_kokkos_option_specs;

extern void add_submodule_controllers_and_services();

Expand All @@ -32,6 +43,40 @@ extern void add_submodule_controllers_and_services();
namespace
{

const char* builtin_option_specs_list[] =
{
builtin_base_option_specs,
#ifdef CALIPER_HAVE_GOTCHA
builtin_gotcha_option_specs,
#endif
#ifdef CALIPER_HAVE_MPI
builtin_mpi_option_specs,
#endif
#ifdef CALIPER_HAVE_OMPT
builtin_openmp_option_specs,
#endif
#ifdef CALIPER_HAVE_CUPTI
builtin_cuda_option_specs,
#endif
#if defined(CALIPER_HAVE_ROCTRACER) || defined(CALIPER_HAVE_ROCPROFILER)
builtin_rocm_option_specs,
#endif
#ifdef CALIPER_HAVE_LIBDW
builtin_libdw_option_specs,
#endif
#ifdef CALIPER_HAVE_PAPI
builtin_papi_option_specs,
#endif
#ifdef CALIPER_HAVE_PCP
builtin_pcp_option_specs,
#endif
#ifdef CALIPER_HAVE_UMPIRE
builtin_umpire_option_specs,
#endif
builtin_kokkos_option_specs,
nullptr
};

ChannelController* make_basic_channel_controller(
const char* name,
const config_map_t& initial_cfg,
Expand Down Expand Up @@ -997,7 +1042,7 @@ struct ConfigManager::ConfigManagerImpl {
if (m_global_opts.error())
set_error(m_global_opts.error_msg());
if (!ok)
set_error(std::string("parse error: ") + util::clamp_string(builtin_option_specs, 48));
set_error(std::string("parse error: ") + util::clamp_string(json, 48));
}

void import_builtin_config_specs()
Expand Down Expand Up @@ -1360,7 +1405,11 @@ struct ConfigManager::ConfigManagerImpl {
return ret;
}

ConfigManagerImpl() { add_global_option_specs(builtin_option_specs); }
ConfigManagerImpl()
{
for (const char** spec_p = builtin_option_specs_list; *spec_p; ++spec_p)
add_global_option_specs(*spec_p);
}
};

ConfigManager::ConfigManager() : mP(new ConfigManagerImpl)
Expand Down
50 changes: 25 additions & 25 deletions src/caliper/controllers/CudaActivityProfileController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,31 @@ cali::ChannelController* make_controller(
}

const char* controller_spec = R"json(
{
"name" : "cuda-activity-profile",
"description" : "Record CUDA activities and a write profile",
"categories" : [ "adiak", "metric", "cuptitrace.metric", "output", "region", "event" ],
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
},
"defaults" : { "node.order": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},
{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
}
]
};
{
"name" : "cuda-activity-profile",
"description" : "Record CUDA activities and a write profile",
"categories" : [ "adiak", "metric", "cuptitrace.metric", "output", "region", "event" ],
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
},
"defaults" : { "node.order": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},
{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
}
]
};
)json";

} // namespace
Expand Down
60 changes: 30 additions & 30 deletions src/caliper/controllers/CudaActivityReportController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,36 +115,36 @@ cali::ChannelController* make_controller(
}

const char* controller_spec = R"json(
{
"name" : "cuda-activity-report",
"description" : "Record and print CUDA activities (kernel executions, memcopies, etc.)",
"categories" : [ "output", "region", "cuptitrace.metric", "treeformatter", "event" ],
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
},
"defaults" : { "order_as_visited": "true", "output.append": "true" },
"options":
[
{
"name": "aggregate_across_ranks",
"type": "bool",
"description": "Aggregate results across MPI ranks"
},
{
"name": "show_kernels",
"type": "bool",
"description": "Show kernel names"
},
{
"name": "output.append",
"type": "bool",
"description": "Use append mode when writing to files"
}
]
}
{
"name" : "cuda-activity-report",
"description" : "Record and print CUDA activities (kernel executions, memcopies, etc.)",
"categories" : [ "output", "region", "cuptitrace.metric", "treeformatter", "event" ],
"services" : [ "aggregate", "cupti", "cuptitrace", "event" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_CUPTITRACE_SNAPSHOT_DURATION" : "true"
},
"defaults" : { "order_as_visited": "true", "output.append": "true" },
"options":
[
{
"name": "aggregate_across_ranks",
"type": "bool",
"description": "Aggregate results across MPI ranks"
},
{
"name": "show_kernels",
"type": "bool",
"description": "Show kernel names"
},
{
"name": "output.append",
"type": "bool",
"description": "Use append mode when writing to files"
}
]
}
)json";

} // namespace
Expand Down
73 changes: 34 additions & 39 deletions src/caliper/controllers/HatchetRegionProfileController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,47 +120,42 @@ cali::ChannelController* make_controller(
}

const char* controller_spec = R"json(
{
"name" : "hatchet-region-profile",
"description" : "Record a region time profile for processing with hatchet",
"categories" : [ "adiak", "metadata", "metric", "output", "region", "event" ],
"services" : [ "aggregate", "event", "timer" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_TIMER_UNIT" : "sec"
},
"defaults" : { "node.order": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
},{
"name": "time.inclusive",
"type": "bool",
"category": "metric",
"description": "Add inclusive time metric",
"query":
[
{
"name" : "hatchet-region-profile",
"description" : "Record a region time profile for processing with hatchet",
"categories" : [ "adiak", "metadata", "metric", "output", "region", "event" ],
"services" : [ "aggregate", "event", "timer" ],
"config" :
{ "CALI_CHANNEL_FLUSH_ON_EXIT" : "false",
"CALI_EVENT_ENABLE_SNAPSHOT_INFO" : "false",
"CALI_TIMER_UNIT" : "sec"
},
"defaults" : { "node.order": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},
{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
},
{
"name": "time.inclusive",
"type": "bool",
"category": "metric",
"description": "Add inclusive time metric",
"query":
[
{
"level" : "local",
"select" :
[
"inclusive_scale(sum#time.duration.ns,1e-9) as \"time (inc)\" unit sec"
]
}
]
}
]
"level" : "local",
"select" : [ "inclusive_scale(sum#time.duration.ns,1e-9) as \"time (inc)\" unit sec" ]
}
]
}
]
}
)json";

} // namespace
Expand Down
71 changes: 34 additions & 37 deletions src/caliper/controllers/HatchetSampleProfileController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,44 +140,41 @@ cali::ChannelController* make_controller(
}

const char* controller_spec = R"json(
{
"name" : "hatchet-sample-profile",
"description" : "Record a sampling profile for processing with hatchet",
"services" : [ "sampler", "trace" ],
"categories" : [ "adiak", "metadata", "sampling", "output" ],
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" },
"defaults" : { "callpath": "true", "source.module": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},
{
"name": "sample.frequency",
"type": "int",
"description": "Sampling frequency in Hz. Default: 200"
},
{
"name": "callpath",
"type": "bool",
"description": "Perform call-stack unwinding",
"services": [ "callpath", "symbollookup" ],
"query":
[
{ "level": "local", "group by": "source.function#callpath.address",
"select": [ "source.function#callpath.address" ]
}
]
},
{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
}
]
{
"name" : "hatchet-sample-profile",
"description" : "Record a sampling profile for processing with hatchet",
"services" : [ "sampler", "trace" ],
"categories" : [ "adiak", "metadata", "sampling", "output" ],
"config" : { "CALI_CHANNEL_FLUSH_ON_EXIT": "false" },
"defaults" : { "callpath": "true", "source.module": "true" },
"options":
[
{
"name": "output.format",
"type": "string",
"description": "Output format ('hatchet', 'cali', 'json')"
},{
"name": "sample.frequency",
"type": "int",
"description": "Sampling frequency in Hz. Default: 200"
},{
"name": "callpath",
"type": "bool",
"description": "Perform call-stack unwinding",
"services": [ "callpath", "symbollookup" ],
"query":
[
{ "level": "local", "group by": "source.function#callpath.address",
"select": [ "source.function#callpath.address" ]
}
]
},{
"name": "use.mpi",
"type": "bool",
"description": "Merge results into a single output stream in MPI programs"
}
]
}
)json";

} // namespace
Expand Down
Loading

0 comments on commit 6e4b448

Please sign in to comment.