Deprecate OMNITRACE_USE_PERFETTO, OMNITRACE_USE_TIMEMORY (#306)

* Rename OMNITRACE_USE_PERFETTO to OMNITRACE_TRACE

* Rename OMNITRACE_USE_TIMEMORY to OMNITRACE_PROFILE

* Revert change to Perfetto.cmake

* Fix formatting

clang-format-11 was complaining about formatting

[ROCm/rocprofiler-systems commit: 5de4163d66]
This commit is contained in:
Ben Richard
2024-01-10 08:20:54 -05:00
committed by GitHub
parent 5e4d7f7f84
commit 857eee18c2
20 changed files with 91 additions and 82 deletions
@@ -337,8 +337,8 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
if(_lomni && !_romni) return true;
if(_romni && !_lomni) return false;
for(const auto* itr :
{ "OMNITRACE_CONFIG", "OMNITRACE_MODE", "OMNITRACE_USE_PERFETTO",
"OMNITRACE_USE_TIMEMORY", "OMNITRACE_USE_SAMPLING",
{ "OMNITRACE_CONFIG", "OMNITRACE_MODE", "OMNITRACE_TRACE",
"OMNITRACE_PROFILE", "OMNITRACE_USE_SAMPLING",
"OMNITRACE_USE_PROCESS_SAMPLING", "OMNITRACE_USE_ROCTRACER",
"OMNITRACE_USE_ROCM_SMI", "OMNITRACE_USE_KOKKOSP",
"OMNITRACE_USE_OMPT", "OMNITRACE_USE", "OMNITRACE_OUTPUT" })
@@ -197,8 +197,8 @@ get_initial_environment()
update_env(_env, "OMNITRACE_MODE", "causal");
update_env(_env, "OMNITRACE_USE_CAUSAL", true);
update_env(_env, "OMNITRACE_USE_SAMPLING", false);
update_env(_env, "OMNITRACE_USE_PERFETTO", false);
update_env(_env, "OMNITRACE_USE_TIMEMORY", false);
update_env(_env, "OMNITRACE_TRACE", false);
update_env(_env, "OMNITRACE_PROFILE", false);
update_env(_env, "OMNITRACE_USE_PROCESS_SAMPLING", false);
update_env(_env, "OMNITRACE_CRITICAL_TRACE", false);
update_env(_env, "OMNITRACE_THREAD_POOL_SIZE",
@@ -52,7 +52,7 @@ main(int argc, char** argv)
{
omnitrace_init_library();
// config::set_setting_value("OMNITRACE_USE_PERFETTO", true);
// config::set_setting_value("OMNITRACE_TRACE", true);
config::set_setting_value("OMNITRACE_CRITICAL_TRACE", true);
// config::set_setting_value("OMNITRACE_CRITICAL_TRACE_DEBUG", true);
config::set_setting_value<int64_t>("OMNITRACE_CRITICAL_TRACE_COUNT", 500);
@@ -876,7 +876,7 @@ main(int argc, char** argv)
"defaults in the executable");
parser.add_argument({ "--env" },
"Environment variables to add to the runtime in form "
"VARIABLE=VALUE. E.g. use '--env OMNITRACE_USE_TIMEMORY=ON' to "
"VARIABLE=VALUE. E.g. use '--env OMNITRACE_PROFILE=ON' to "
"default to using timemory instead of perfetto");
parser
.add_argument({ "--mpi" },
@@ -419,7 +419,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.add_argument({ "-T", "--trace" }, "Generate a detailed trace (perfetto output)")
.max_count(1)
.action([&](parser_t& p) {
update_env(_env, "OMNITRACE_USE_PERFETTO", p.get<bool>("trace"));
update_env(_env, "OMNITRACE_TRACE", p.get<bool>("trace"));
});
parser
.add_argument(
@@ -428,7 +428,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.max_count(1)
.conflicts({ "flat-profile" })
.action([&](parser_t& p) {
update_env(_env, "OMNITRACE_USE_TIMEMORY", p.get<bool>("profile"));
update_env(_env, "OMNITRACE_PROFILE", p.get<bool>("profile"));
});
parser
.add_argument({ "-F", "--flat-profile" },
@@ -436,7 +436,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.max_count(1)
.conflicts({ "profile" })
.action([&](parser_t& p) {
update_env(_env, "OMNITRACE_USE_TIMEMORY", p.get<bool>("flat-profile"));
update_env(_env, "OMNITRACE_PROFILE", p.get<bool>("flat-profile"));
update_env(_env, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
});
parser
@@ -566,7 +566,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.choices({ "text", "json", "console" })
.action([&](parser_t& p) {
auto _v = p.get<std::set<std::string>>("profile");
update_env(_env, "OMNITRACE_USE_TIMEMORY", true);
update_env(_env, "OMNITRACE_PROFILE", true);
if(!_v.empty())
{
update_env(_env, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
@@ -29,8 +29,8 @@ function(OMNITRACE_ADD_BIN_TEST)
if(NOT TEST_ENVIRONMENT)
set(TEST_ENVIRONMENT
"OMNITRACE_USE_PERFETTO=ON"
"OMNITRACE_USE_TIMEMORY=ON"
"OMNITRACE_TRACE=ON"
"OMNITRACE_PROFILE=ON"
"OMNITRACE_USE_SAMPLING=ON"
"OMNITRACE_TIME_OUTPUT=OFF"
"LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:${OMNITRACE_DYNINST_API_RT_DIR}:$ENV{LD_LIBRARY_PATH}"
@@ -314,7 +314,7 @@ omnitrace_add_bin_test(
TIMEOUT 45
PASS_REGEX
"ENVIRONMENT VARIABLE,[ \n]+OMNITRACE_THREAD_POOL_SIZE,[ \n]+OMNITRACE_USE_PID,[ \n]+"
FAIL_REGEX "OMNITRACE_USE_PERFETTO|OMNITRACE_ABORT_FAIL_REGEX")
FAIL_REGEX "OMNITRACE_TRACE|OMNITRACE_ABORT_FAIL_REGEX")
string(REPLACE "+" "\\\+" _AVAIL_CFG_PATH
"${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-avail/omnitrace-")
@@ -345,7 +345,7 @@ omnitrace_add_bin_test(
json xml --force
TIMEOUT 45
LABELS "omnitrace-avail"
ENVIRONMENT "OMNITRACE_USE_PERFETTO=OFF;OMNITRACE_USE_TIMEMORY=ON"
ENVIRONMENT "OMNITRACE_TRACE=OFF;OMNITRACE_PROFILE=ON"
PASS_REGEX
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)"
)
@@ -249,7 +249,7 @@ Options:
-d, --default-components Default components to instrument (only useful when timemory is enabled in omnitrace
library)
--env Environment variables to add to the runtime in form VARIABLE=VALUE. E.g. use '--env
OMNITRACE_USE_TIMEMORY=ON' to default to using timemory instead of perfetto
OMNITRACE_PROFILE=ON' to default to using timemory instead of perfetto
--mpi Enable MPI support (requires omnitrace built w/ full or partial MPI support). NOTE: this
will automatically be activated if MPI_Init, MPI_Init_thread, MPI_Finalize,
MPI_Comm_rank, or MPI_Comm_size are found in the symbol table of target
@@ -16,8 +16,8 @@ E.g. with the base configuration:
export OMNITRACE_OUTPUT_PATH=omnitrace-example-output
export OMNITRACE_TIME_OUTPUT=ON
export OMNITRACE_USE_PID=OFF
export OMNITRACE_USE_TIMEMORY=ON
export OMNITRACE_USE_PERFETTO=ON
export OMNITRACE_PROFILE=ON
export OMNITRACE_TRACE=ON
```
```shell
@@ -115,7 +115,7 @@ if __name__ == "__main__":
run(20)
```
Using `omnitrace-python ./example.py` with `OMNITRACE_USE_TIMEMORY=ON` and `OMNITRACE_TIMEMORY_COMPONENTS=trip_count` would produce:
Using `omnitrace-python ./example.py` with `OMNITRACE_PROFILE=ON` and `OMNITRACE_TIMEMORY_COMPONENTS=trip_count` would produce:
```console
|-------------------------------------------------------------------------------------------|
@@ -24,8 +24,8 @@ and tweak some sampling default values:
```console
# ...
OMNITRACE_USE_PERFETTO = true
OMNITRACE_USE_TIMEMORY = true
OMNITRACE_TRACE = true
OMNITRACE_PROFILE = true
OMNITRACE_USE_SAMPLING = true
OMNITRACE_USE_PROCESS_SAMPLING = true
# ...
@@ -50,7 +50,7 @@ match to nearly all common expressions for boolean logic: ON, OFF, YES, NO, TRUE
### Exploring Components
[OmniTrace](https://github.com/AMDResearch/omnitrace) uses [timemory](https://github.com/NERSC/timemory) extensively to provide various capabilities and manage
data and resources. By default, when `OMNITRACE_USE_TIMEMORY=ON`, omnitrace will only collect wall-clock
data and resources. By default, when `OMNITRACE_PROFILE=ON`, omnitrace will only collect wall-clock
timing values; however, by modifying the `OMNITRACE_TIMEMORY_COMPONENTS` setting, omnitrace can be configured to
collect hardware counters, CPU-clock timers, memory usage, context-switches, page-faults, network statistics,
and many more. In fact, omnitrace can actually be used as a dynamic instrumentation vehicle for other 3rd-party profiling
@@ -179,8 +179,8 @@ $ cat ~/.omnitrace.cfg
OMNITRACE_CONFIG_FILE =
OMNITRACE_MODE = trace
OMNITRACE_USE_PERFETTO = true
OMNITRACE_USE_TIMEMORY = false
OMNITRACE_TRACE = true
OMNITRACE_PROFILE = false
OMNITRACE_USE_SAMPLING = false
OMNITRACE_USE_PROCESS_SAMPLING = true
OMNITRACE_USE_ROCTRACER = true
@@ -352,13 +352,13 @@ $ omnitrace-avail -S -bd
| OMNITRACE_USE_CODE_COVERAGE | Enable support for code coverage |
| OMNITRACE_USE_KOKKOSP | Enable support for Kokkos Tools |
| OMNITRACE_USE_OMPT | Enable support for OpenMP-Tools |
| OMNITRACE_USE_PERFETTO | Enable perfetto backend |
| OMNITRACE_TRACE | Enable perfetto backend |
| OMNITRACE_USE_PID | Enable tagging filenames with proces... |
| OMNITRACE_USE_ROCM_SMI | Enable sampling GPU power, temp, uti... |
| OMNITRACE_USE_ROCTRACER | Enable ROCM tracing |
| OMNITRACE_USE_SAMPLING | Enable statistical sampling of call-... |
| OMNITRACE_USE_PROCESS_SAMPLING | Enable a background thread which sam... |
| OMNITRACE_USE_TIMEMORY | Enable timemory backend |
| OMNITRACE_PROFILE | Enable timemory backend |
| OMNITRACE_VERBOSE | Verbosity level |
| OMNITRACE_WIDTH | Set the global output width for comp... |
|-----------------------------------------|-----------------------------------------|
@@ -1192,8 +1192,8 @@ $ENABLE = ON
$SAMPLE = OFF
# use fields
OMNITRACE_USE_PERFETTO = $ENABLE
OMNITRACE_USE_TIMEMORY = $ENABLE
OMNITRACE_TRACE = $ENABLE
OMNITRACE_PROFILE = $ENABLE
OMNITRACE_USE_SAMPLING = $SAMPLE
OMNITRACE_USE_PROCESS_SAMPLING = $SAMPLE
@@ -235,7 +235,7 @@ OMNITRACE_TRACE_THREAD_SPIN_LOCKS=true
OMNITRACE_USE_KOKKOSP=true
OMNITRACE_USE_MPIP=true
OMNITRACE_USE_OMPT=true
OMNITRACE_USE_PERFETTO=true
OMNITRACE_TRACE=true
OMNITRACE_USE_PROCESS_SAMPLING=true
OMNITRACE_USE_RCCLP=true
OMNITRACE_USE_ROCM_SMI=true
@@ -243,7 +243,7 @@ OMNITRACE_USE_ROCPROFILER=true
OMNITRACE_USE_ROCTRACER=true
OMNITRACE_USE_ROCTX=true
OMNITRACE_USE_SAMPLING=true
OMNITRACE_USE_TIMEMORY=true
OMNITRACE_PROFILE=true
OMP_TOOL_LIBRARIES=/opt/omnitrace/lib/libomnitrace-dl.so.1.7.1
ROCP_TOOL_LIB=/opt/omnitrace/lib/libomnitrace.so.1.7.1
@@ -267,7 +267,7 @@ OMNITRACE_TRACE_THREAD_SPIN_LOCKS=false
OMNITRACE_USE_KOKKOSP=false
OMNITRACE_USE_MPIP=false
OMNITRACE_USE_OMPT=false
OMNITRACE_USE_PERFETTO=true
OMNITRACE_TRACE=true
OMNITRACE_USE_PROCESS_SAMPLING=true
OMNITRACE_USE_RCCLP=false
OMNITRACE_USE_ROCM_SMI=false
@@ -275,7 +275,7 @@ OMNITRACE_USE_ROCPROFILER=false
OMNITRACE_USE_ROCTRACER=false
OMNITRACE_USE_ROCTX=false
OMNITRACE_USE_SAMPLING=true
OMNITRACE_USE_TIMEMORY=true
OMNITRACE_PROFILE=true
...
```
@@ -297,7 +297,7 @@ OMNITRACE_TRACE_THREAD_SPIN_LOCKS=false
OMNITRACE_USE_KOKKOSP=false
OMNITRACE_USE_MPIP=false
OMNITRACE_USE_OMPT=false
OMNITRACE_USE_PERFETTO=true
OMNITRACE_TRACE=true
OMNITRACE_USE_PROCESS_SAMPLING=true
OMNITRACE_USE_RCCLP=false
OMNITRACE_USE_ROCM_SMI=false
@@ -305,7 +305,7 @@ OMNITRACE_USE_ROCPROFILER=false
OMNITRACE_USE_ROCTRACER=false
OMNITRACE_USE_ROCTX=false
OMNITRACE_USE_SAMPLING=true
OMNITRACE_USE_TIMEMORY=true
OMNITRACE_PROFILE=true
[omnitrace][omnitrace_init_tooling] Instrumentation mode: Sampling
@@ -396,7 +396,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
"Generate a detailed trace (perfetto output)")
.max_count(1)
.action([&](parser_t& p) {
update_env(_data, "OMNITRACE_USE_PERFETTO", p.get<bool>("trace"));
update_env(_data, "OMNITRACE_TRACE", p.get<bool>("trace"));
});
_data.processed_environs.emplace("trace");
@@ -411,7 +411,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
.max_count(1)
.conflicts({ "flat-profile" })
.action([&](parser_t& p) {
update_env(_data, "OMNITRACE_USE_TIMEMORY", p.get<bool>("profile"));
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("profile"));
});
_data.processed_environs.emplace("profile");
@@ -425,7 +425,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
.max_count(1)
.conflicts({ "profile" })
.action([&](parser_t& p) {
update_env(_data, "OMNITRACE_USE_TIMEMORY", p.get<bool>("flat-profile"));
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("flat-profile"));
update_env(_data, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
});
@@ -874,7 +874,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
.choices({ "text", "json", "console" })
.action([&](parser_t& p) {
auto _v = p.get<strset_t>("profile-format");
update_env(_data, "OMNITRACE_USE_TIMEMORY", true);
update_env(_data, "OMNITRACE_PROFILE", true);
if(!_v.empty())
{
update_env(_data, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
@@ -230,8 +230,7 @@ configure_settings(bool _init)
auto _config = settings::shared_instance();
// if using timemory, default to perfetto being off
auto _default_perfetto_v =
!tim::get_env<bool>("OMNITRACE_USE_TIMEMORY", false, false);
auto _default_perfetto_v = !tim::get_env<bool>("OMNITRACE_PROFILE", false, false);
auto _system_backend =
tim::get_env("OMNITRACE_PERFETTO_BACKEND_SYSTEM", false, false);
@@ -272,13 +271,21 @@ configure_settings(bool _init)
get_env<size_t>("OMNITRACE_NUM_THREADS", 1), "threading", "performance",
"sampling", "parallelism", "advanced");
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_PERFETTO", "Enable perfetto backend",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_TRACE", "Enable perfetto backend",
_default_perfetto_v, "backend", "perfetto");
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_TIMEMORY", "Enable timemory backend",
!_config->get<bool>("OMNITRACE_USE_PERFETTO"), "backend",
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_PERFETTO",
"[DEPRECATED] Renamed to OMNITRACE_TRACE",
_default_perfetto_v, "backend", "perfetto", "deprecated");
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_PROFILE", "Enable timemory backend",
!_config->get<bool>("OMNITRACE_TRACE"), "backend",
"timemory");
OMNITRACE_CONFIG_SETTING(
bool, "OMNITRACE_USE_TIMEMORY", "[DEPRECATED] Renamed to OMNITRACE_PROFILE",
!_config->get<bool>("OMNITRACE_TRACE"), "backend", "timemory", "deprecated");
OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_CAUSAL",
"Enable causal profiling analysis", false, "backend",
"causal", "analysis");
@@ -1076,6 +1083,8 @@ configure_settings(bool _init)
handle_deprecated_setting("OMNITRACE_USE_THREAD_SAMPLING",
"OMNITRACE_USE_PROCESS_SAMPLING");
handle_deprecated_setting("OMNITRACE_OUTPUT_FILE", "OMNITRACE_PERFETTO_FILE");
handle_deprecated_setting("OMNITRACE_USE_PERFETTO", "OMNITRACE_TRACE");
handle_deprecated_setting("OMNITRACE_USE_TIMEMORY", "OMNITRACE_PROFILE");
scope::get_fields()[scope::flat::value] = _config->get_flat_profile();
scope::get_fields()[scope::timeline::value] = _config->get_timeline_profile();
@@ -1137,8 +1146,8 @@ configure_mode_settings(const std::shared_ptr<settings>& _config)
if(get_mode() == Mode::Coverage)
{
set_default_setting_value("OMNITRACE_USE_CODE_COVERAGE", true);
_set("OMNITRACE_USE_PERFETTO", false);
_set("OMNITRACE_USE_TIMEMORY", false);
_set("OMNITRACE_TRACE", false);
_set("OMNITRACE_PROFILE", false);
_set("OMNITRACE_USE_CAUSAL", false);
_set("OMNITRACE_USE_ROCM_SMI", false);
_set("OMNITRACE_USE_ROCTRACER", false);
@@ -1153,8 +1162,8 @@ configure_mode_settings(const std::shared_ptr<settings>& _config)
else if(get_mode() == Mode::Causal)
{
_set("OMNITRACE_USE_CAUSAL", true);
_set("OMNITRACE_USE_PERFETTO", false);
_set("OMNITRACE_USE_TIMEMORY", false);
_set("OMNITRACE_TRACE", false);
_set("OMNITRACE_PROFILE", false);
_set("OMNITRACE_CRITICAL_TRACE", false);
_set("OMNITRACE_USE_SAMPLING", false);
_set("OMNITRACE_USE_PROCESS_SAMPLING", false);
@@ -1202,8 +1211,8 @@ configure_mode_settings(const std::shared_ptr<settings>& _config)
if(!_config->get_enabled())
{
_set("OMNITRACE_USE_PERFETTO", false);
_set("OMNITRACE_USE_TIMEMORY", false);
_set("OMNITRACE_USE_TRACE", false);
_set("OMNITRACE_PROFILE", false);
_set("OMNITRACE_USE_CAUSAL", false);
_set("OMNITRACE_USE_ROCM_SMI", false);
_set("OMNITRACE_USE_ROCTRACER", false);
@@ -1388,8 +1397,8 @@ configure_disabled_settings(const std::shared_ptr<settings>& _config)
_handle_use_option("OMNITRACE_USE_PROCESS_SAMPLING", "process_sampling");
_handle_use_option("OMNITRACE_USE_CAUSAL", "causal");
_handle_use_option("OMNITRACE_USE_KOKKOSP", "kokkos");
_handle_use_option("OMNITRACE_USE_PERFETTO", "perfetto");
_handle_use_option("OMNITRACE_USE_TIMEMORY", "timemory");
_handle_use_option("OMNITRACE_USE_TRACE", "perfetto");
_handle_use_option("OMNITRACE_PROFILE", "timemory");
_handle_use_option("OMNITRACE_USE_OMPT", "ompt");
_handle_use_option("OMNITRACE_USE_RCCLP", "rcclp");
_handle_use_option("OMNITRACE_USE_ROCM_SMI", "rocm_smi");
@@ -1854,14 +1863,14 @@ get_verbose()
bool&
get_use_perfetto()
{
static auto _v = get_config()->find("OMNITRACE_USE_PERFETTO");
static auto _v = get_config()->find("OMNITRACE_TRACE");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
bool&
get_use_timemory()
{
static auto _v = get_config()->find("OMNITRACE_USE_TIMEMORY");
static auto _v = get_config()->find("OMNITRACE_PROFILE");
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}