25#ifndef TIMEMORY_SETTINGS_SETTINGS_CPP_
26#define TIMEMORY_SETTINGS_SETTINGS_CPP_ 1
30#include "timemory/backends/dmp.hpp"
31#include "timemory/backends/process.hpp"
32#include "timemory/defines.h"
36#include "timemory/tpls/cereal/archives.hpp"
47#include <initializer_list>
57std::shared_ptr<settings>
62 static auto _instance = shared_instance<TIMEMORY_API>();
75 return _instance.get();
82settings::command_line()
100settings::get_global_environment()
102#if defined(TIMEMORY_UNIX)
108 _environ.push_back(
environ[idx++]);
112 return std::vector<std::string>();
126 if(std::strftime(mbstr,
sizeof(mbstr), dt_format, std::localtime(dt_curr)) != 0)
192 if(
_dir.find(_local_datetime) == std::string::npos)
196 _dir += _local_datetime;
213 auto& _cmdline = command_line();
215 for(
int i = 0; i < argc; ++i)
224 auto& _cmdline = command_line();
230 if(!_cmdline.empty())
232 _arg0_string += _cmdline.at(0);
233 _argv_string += _cmdline.at(0);
234 for(
size_t i = 1; i < _cmdline.size(); ++i)
236 _argv_string += _cmdline.at(i);
237 _argt_string += _cmdline.at(i);
238 _args_string += _cmdline.at(i);
245 auto _slurm_job_id = get_env<std::string>(
"SLURM_JOB_ID",
"0",
false);
246 auto _slurm_proc_id = get_env<std::string>(
"SLURM_PROCID", _dmp_rank,
false);
248 auto _replace = [&_fpath](
const auto& itr) {
249 auto pos = std::string::npos;
250 while((
pos = _fpath.find(itr.first)) != std::string::npos)
251 _fpath.replace(
pos, itr.first.length(), itr.second);
253 using strpairinit_t = std::initializer_list<std::pair<std::string, std::string>>;
254 for(
auto&& itr : strpairinit_t{ {
"--",
"-" }, {
"__",
"_" }, {
"//",
"/" } })
259 if(_fpath.find(
'%') == std::string::npos)
262 for(
auto&& itr : strpairinit_t{ {
"%arg0%", _arg0_string },
264 {
"%argv%", _arg0_string },
266 {
"%argt%", _argt_string },
268 {
"%args%", _args_string },
270 {
"%tag%", _tag0_string },
272 {
"%pid%", _proc_id },
273 {
"%job%", _slurm_job_id },
274 {
"%rank%", _slurm_proc_id },
275 {
"%size%", _dmp_size },
278 {
"%j", _slurm_job_id },
279 {
"%r", _slurm_proc_id },
280 {
"%s", _dmp_size } })
295 if(_ext.find(
'.') != 0)
299 auto _ext_pos = _tag.length() - _ext.length();
300 if(_tag.find(_ext) == _ext_pos)
301 _tag = _tag.substr(0, _ext_pos);
303 auto plast =
static_cast<intmax_t
>(
_prefix.length()) - 1;
311 _global_tag = _instance->
get_tag();
323 int32_t _output_suffix,
bool _make_dir,
326 bool _is_explicit = (!_explicit.empty());
335 auto only_ascii = [](
char c) {
return isascii(c) == 0; };
341 if(_is_explicit && _make_dir)
349 auto _suffix = (_use_suffix && _output_suffix >= 0)
350 ? (
std::string(
"-") + std::to_string(_output_suffix))
356 return filepath::osrepr(_fpath);
375 auto only_ascii = [](
char c) {
return isascii(c) == 0; };
380 auto _suffix = (_use_suffix && _output_suffix >= 0)
381 ? (
std::string(
"-") + std::to_string(_output_suffix))
387 return filepath::osrepr(_fpath);
420 static auto _once =
false;
423 PRINT_HERE(
"%s",
"settings parsing has been suppressed");
450, m_order(rhs.m_order)
451, m_command_line(rhs.m_command_line)
452, m_environment(rhs.m_environment)
454 for(
const auto& itr : rhs.m_data)
455 m_data.emplace(itr.first, itr.second->clone());
456 for(
auto& itr : m_order)
458 if(m_data.find(itr) == m_data.end())
460 auto ritr = rhs.m_data.find(itr);
461 if(ritr == rhs.m_data.end())
467 m_data.emplace(itr, ritr->second->clone());
483 for(
const auto& itr : rhs.m_data)
484 m_data[itr.first] = itr.second->clone();
485 m_order = rhs.m_order;
486 m_command_line = rhs.m_command_line;
487 m_environment = rhs.m_environment;
488 for(
auto& itr : m_order)
490 if(m_data.find(itr) == m_data.end())
492 auto ritr = rhs.m_data.find(itr);
493 if(ritr == rhs.m_data.end())
499 m_data.emplace(itr, ritr->second->clone());
514 if(command_line().empty())
517 if(command_line().empty())
520 auto _pos = std::string::npos;
521 while((_pos = _tag.find_last_of(
'_')) == _tag.length() - 1)
522 _tag = _tag.substr(0, _tag.length() - 1);
526 _tag = command_line().front();
528 while(_tag.find(
'\\') != std::string::npos)
529 _tag = _tag.substr(_tag.find_last_of(
'\\') + 1);
531 while(_tag.find(
'/') != std::string::npos)
532 _tag = _tag.substr(_tag.find_last_of(
'/') + 1);
536 if(_tag.find(itr) != std::string::npos)
537 _tag.erase(_tag.find(itr), itr.length() + 1);
551 if(command_line().empty() && !m_command_line.empty())
552 command_line() = m_command_line;
564settings::initialize_core()
567 auto homedir = get_env<string_t>(
"HOME");
571 "Configuration file for timemory",
580 "Disable processing of setting configuration files",
false,
581 strvector_t({
"--timemory-suppress-config",
"--timemory-no-config" }));
585 "Disable parsing environment",
false,
586 strvector_t({
"--timemory-suppress-parsing" }), -1, 1);
593 "Verbosity level", 0,
597 "Enable debug output",
false,
602 "Set the label hierarchy mode to default to "
605 strvector_t({
"--timemory-flat-profile" }), -1, 1);
609 "Set the label hierarchy mode to default to timeline",
611 strvector_t({
"--timemory-timeline-profile" }), -1, 1);
615 "Set the maximum depth of label hierarchy reporting",
623settings::initialize_components()
628 "A specification of components which is used by multiple variadic bundlers "
630 "user_bundles as the fall-back set of components if their specific variable "
632 "not set. E.g. user_mpip_bundle will use this if TIMEMORY_MPIP_COMPONENTS is "
635 "",
strvector_t({
"--timemory-global-components" }));
639 "A specification of components which will be added "
640 "to structures containing the 'user_ompt_bundle'. Priority: TRACE_COMPONENTS "
642 "PROFILER_COMPONENTS -> COMPONENTS -> GLOBAL_COMPONENTS",
643 "",
strvector_t({
"--timemory-ompt-components" }));
647 "A specification of components which will be added "
648 "to structures containing the 'user_mpip_bundle'. Priority: TRACE_COMPONENTS "
650 "PROFILER_COMPONENTS -> COMPONENTS -> GLOBAL_COMPONENTS",
651 "",
strvector_t({
"--timemory-mpip-components" }));
655 "A specification of components which will be added "
656 "to structures containing the 'user_ncclp_bundle'. Priority: MPIP_COMPONENTS "
658 "TRACE_COMPONENTS -> PROFILER_COMPONENTS -> COMPONENTS -> GLOBAL_COMPONENTS",
659 "",
strvector_t({
"--timemory-ncclp-components" }));
663 "A specification of components which will be used by the interfaces which "
665 "designed for full profiling. These components will be subjected to "
667 "Priority: COMPONENTS -> GLOBAL_COMPONENTS",
668 "",
strvector_t({
"--timemory-trace-components" }));
672 "A specification of components which will be used by the interfaces which "
674 "designed for full python profiling. This specification will be overridden "
676 "trace_components specification. Priority: COMPONENTS -> GLOBAL_COMPONENTS",
677 "",
strvector_t({
"--timemory-profiler-components" }));
681 "A specification of components which will be used by the interfaces which "
683 "designed for kokkos profiling. Priority: TRACE_COMPONENTS -> "
684 "PROFILER_COMPONENTS -> COMPONENTS -> GLOBAL_COMPONENTS",
685 "",
strvector_t({
"--timemory-kokkos-components" }));
689 "A specification of components which is used by "
690 "the library interface. This "
691 "falls back to TIMEMORY_GLOBAL_COMPONENTS.",
699settings::initialize_io()
704 "Generate output at application termination",
true,
709 true,
strvector_t({
"--timemory-cout-output" }), -1, 1);
713 true,
strvector_t({
"--timemory-file-output" }), -1, 1);
717 "Write text output files",
true,
722 "Write json output files",
true,
727 "Write hierarchical json output files",
true,
732 "Write dart measurements for CDash",
false,
737 "Output data to subfolder w/ a timestamp (see also: TIMEMORY_TIME_FORMAT)",
false,
747 "Generate a difference output vs. a pre-existing output (see also: "
748 "TIMEMORY_INPUT_PATH and TIMEMORY_INPUT_PREFIX)",
749 false,
strvector_t({
"--timemory-diff-output" }), -1, 1);
753 "Write a json output for flamegraph visualization (use chrome://tracing)",
true,
754 strvector_t({
"--timemory-flamegraph-output" }), -1, 1);
758 "Write a CTestNotes.txt for each text output",
false,
763 "Explicitly specify the output folder for results",
"timemory-output",
769 "Explicitly specify a prefix for all output files",
775 "Explicitly specify the input folder for difference "
776 "comparisons (see also: TIMEMORY_DIFF_OUTPUT)",
781 "Explicitly specify the prefix for input files used in difference "
783 "(see also: TIMEMORY_DIFF_OUTPUT)",
784 "",
strvector_t({
"--timemory-input-prefix" }), 1);
788 "File extensions used when searching for input files used in difference "
789 "comparisons (see also: TIMEMORY_DIFF_OUTPUT)",
790 "json,xml",
strvector_t({
"--timemory-input-extensions" }));
797settings::initialize_format()
802 "Customize the folder generation when TIMEMORY_TIME_OUTPUT is enabled (see "
805 "%F_%I.%M_%p",
strvector_t({
"--timemory-time-format" }), 1);
809 "Set the global output precision for components",
813 "Set the global output width for components", -1,
818 "Set the maximum width for component label outputs",
823 "Set the global numerical reporting to scientific format",
false,
828 "Set the precision for components with 'is_timing_category' type-trait", -1);
832 "Set the output width for components with 'is_timing_category' type-trait", -1);
836 "Set the units for components with "
837 "'uses_timing_units' type-trait",
838 "",
strvector_t({
"--timemory-timing-units" }), 1);
842 "Set the numerical reporting format for components "
843 "with 'is_timing_category' type-trait",
848 "Set the precision for components with 'is_memory_category' type-trait", -1);
852 "Set the output width for components with 'is_memory_category' type-trait", -1);
856 "Set the units for components with "
857 "'uses_memory_units' type-trait",
858 "",
strvector_t({
"--timemory-memory-units" }), 1);
862 "Set the numerical reporting format for components "
863 "with 'is_memory_category' type-trait",
868 "Frequency of dashed separator lines in text output", 0);
875settings::initialize_parallel()
880 "Maximum number of times a worker thread bookmarks "
881 "the call-graph location w.r.t."
882 " the master thread. Higher values tend to "
883 "increase the finalization merge time",
888 "Enable/disable combining thread-specific data",
true,
889 strvector_t({
"--timemory-collapse-threads" }), -1, 1);
893 "Enable/disable combining process-specific data",
true,
894 strvector_t({
"--timemory-collapse-processes" }), -1, 1);
898 "Enable pinning threads to CPUs (Linux-only)",
false,
899 strvector_t({
"--timemory-cpu-affinity" }), -1, 1);
903 "Process ID for the components which require this", process::get_target_id());
906 "Enable/disable timemory calling MPI_Init / "
907 "MPI_Init_thread during certain "
908 "timemory_init(...) invocations",
914 "Enable/disable timemory calling MPI_Finalize during "
915 "timemory_finalize(...) invocations",
916 false,
strvector_t({
"--timemory-mpi-finalize" }), -1, 1);
920 "Call MPI_Init_thread instead of MPI_Init (see also: TIMEMORY_MPI_INIT)",
921 mpi::use_mpi_thread(),
strvector_t({
"--timemory-mpi-thread" }), -1, 1);
925 "MPI_Init_thread mode: 'single', 'serialized', "
926 "'funneled', or 'multiple' (see also: "
927 "TIMEMORY_MPI_INIT and TIMEMORY_MPI_THREAD)",
928 mpi::use_mpi_thread_type(),
strvector_t({
"--timemory-mpi-thread-type" }), 1);
932 "Enable/disable timemory calling upcxx::init() during certain "
933 "timemory_init(...) invocations",
934 false,
strvector_t({
"--timemory-upcxx-init" }), -1, 1);
938 "Enable/disable timemory calling upcxx::finalize() during "
939 "timemory_finalize()",
940 false,
strvector_t({
"--timemory-upcxx-finalize" }), -1, 1);
944 "Total number of nodes used in application. Setting this value > 1 will "
946 "in aggregating N processes into groups of N / NODE_COUNT",
954settings::initialize_tpls()
959 "Enable multithreading support when using PAPI",
true,
960 strvector_t({
"--timemory-papi-threading" }), -1, 1);
964 "Enable multiplexing when using PAPI",
false,
965 strvector_t({
"--timemory-papi-multiplexing" }), -1, 1);
969 "Configure PAPI errors to trigger a runtime error",
false,
970 strvector_t({
"--timemory-papi-fail-on-error" }), -1, 1);
974 "Configure suppression of reporting PAPI errors/warnings",
false,
979 "PAPI presets and events to collect (see also: "
984 "Configure PAPI to attach to another process (see "
985 "also: TIMEMORY_TARGET_PID)",
990 "Value at which PAPI hw counters trigger an "
992 0,
strvector_t({
"--timemory-papi-overflow" }), 1);
996 "Batch size for create cudaEvent_t in cuda_event components", 5);
1000 "Use cudaDeviceSync when stopping NVTX marker (vs. cudaStreamSychronize)",
true);
1004 "Default group of kinds tracked via CUpti Activity API", 1,
1005 strvector_t({
"--timemory-cupti-activity-level" }), 1);
1009 "Specific cupti activity kinds to track",
"",
1010 strvector_t({
"--timemory-cupti-activity-kinds" }));
1014 "Hardware counter event types to collect on NVIDIA "
1020 "Hardware counter metric types to collect on "
1026 "Target device for CUPTI data collection", 0,
1029 insert<int>(
"TIMEMORY_CUPTI_PCSAMPLING_PERIOD",
"cupti_pcsampling_period",
1030 "The period for PC sampling. Must be >= 5 and <= 31", 8,
1031 strvector_t{
"--timemory-cupti-pcsampling-period" });
1033 insert<bool>(
"TIMEMORY_CUPTI_PCSAMPLING_PER_LINE",
"cupti_pcsampling_per_line",
1034 "Report the PC samples per-line or collapse into one entry for entire "
1036 false,
strvector_t{
"--timemory-cupti-pcsampling-per-line" });
1038 insert<bool>(
"TIMEMORY_CUPTI_PCSAMPLING_REGION_TOTALS",
1039 "cupti_pcsampling_region_totals",
1040 "When enabled, region markers will report total samples from all child "
1042 true,
strvector_t{
"--timemory-cupti-pcsampling-region-totals" });
1044 insert<bool>(
"TIMEMORY_CUPTI_PCSAMPLING_SERIALIZED",
"cupti_pcsampling_serialized",
1045 "Serialize all the kernel functions",
false,
1046 strvector_t{
"--timemory-cupti-pcsampling-serialize" });
1048 insert<size_t>(
"TIMEMORY_CUPTI_PCSAMPLING_NUM_COLLECT",
1049 "cupti_pcsampling_num_collect",
"Number of PCs to be collected",
1051 strvector_t{
"--timemory-cupti-pcsampling-num-collect" });
1053 insert<std::string>(
"TIMEMORY_CUPTI_PCSAMPLING_STALL_REASONS",
1054 "cupti_pcsampling_stall_reasons",
1055 "The PC sampling stall reasons to count",
std::string{},
1056 strvector_t{
"--timemory-cupti-pcsampling-stall-reasons" });
1060 "Configure the CrayPAT categories to collect (same as PAT_RT_PERFCTR)",
1061 get_env<std::string>(
"PAT_RT_PERFCTR",
"",
false))
1073settings::initialize_roofline()
1078 "Configure the roofline collection mode. Options: 'op' 'ai'.",
"op",
1083 "Configure the roofline collection mode for CPU "
1084 "specifically. Options: 'op', "
1086 "op",
strvector_t({
"--timemory-cpu-roofline-mode" }), 1, 1,
1091 "Configure the roofline collection mode for GPU specifically. Options: 'op' "
1093 static_cast<tsettings<string_t>*
>(
1096 strvector_t({
"--timemory-gpu-roofline-mode" }), 1, 1,
1101 "Configure custom hw counters to add to the cpu roofline",
"");
1105 "Configure custom hw counters to add to the gpu roofline",
"");
1109 "Configure roofline labels/descriptions/output-files "
1110 "encode the list of data types",
1115 "Configure labels, etc. for the roofline components "
1116 "for CPU (see also: TIMEMORY_ROOFLINE_TYPE_LABELS)",
1117 static_cast<tsettings<bool>*
>(
1123 "Configure labels, etc. for the roofline components "
1124 "for GPU (see also: TIMEMORY_ROOFLINE_TYPE_LABELS)",
1125 static_cast<tsettings<bool>*
>(
1131 "Configure the roofline to include the hw counters "
1132 "required for generating an instruction roofline",
1139settings::initialize_miscellaneous()
1144 "Enable/disable components adding secondary (child) entries when available. "
1146 "suppress individual CUDA kernels, etc. when using Cupti components",
1147 true,
strvector_t({
"--timemory-add-secondary" }), -1, 1);
1151 "Minimum number of laps before checking whether a key should be throttled", 10000,
1156 "Average call time in nanoseconds when # laps > throttle_count that triggers "
1158 10000,
strvector_t({
"--timemory-throttle-value" }), 1);
1162 "Enable signals in timemory_init",
false,
1163 strvector_t({
"--timemory-enable-signal-handler" }), -1, 1)
1167 "Allow signal handling to be activated", signal_settings::allow(),
1168 strvector_t({
"--timemory-allow-signal-handler" }), -1, 1);
1180 "Configure default setting for auto_{list,tuple,hybrid} to write to stdout "
1182 " destruction of the bundle",
1183 false,
strvector_t({
"--timemory-destructor-report" }), -1, 1);
1187 "Enable/disable stopping any markers still running during finalization",
true,
1188 strvector_t({
"--timemory-stack-clearing" }), -1, 1);
1192 "Notify about tim::manager creation and destruction",
1198 strvector_t({
"--timemory-network-interface" }), -1, 1);
1205settings::initialize_ert()
1210 "Number of threads to use when running ERT", 0);
1214 "Number of threads to use when running ERT on CPU",
1215 std::thread::hardware_concurrency());
1219 "Number of threads which launch kernels when running ERT on the GPU", 1);
1223 "Number of streams to use when launching kernels in ERT on the GPU", 1);
1227 "Configure the grid size (number of blocks) for ERT on "
1228 "GPU (0 == auto-compute)",
1233 "Configure the block size (number of threads per block) for ERT on GPU", 1024);
1237 "Configure the alignment (in bits) when running ERT on "
1238 "CPU (0 == 8 * sizeof(T))",
1243 "Configure the minimum working size when running ERT (0 == device specific)", 0);
1247 "Configure the minimum working size when running ERT "
1253 "Configure the minimum working size when running ERT "
1259 "Configure the max data size when running ERT on CPU", 0);
1263 "Configure the max data size when running ERT on CPU", 0);
1267 "Configure the max data size when running ERT on GPU", 500 * 1000 * 1000);
1271 "Skip these number of ops (i.e. ERT_FLOPS) when were set at compile time",
"");
1278settings::initialize_dart()
1283 "Only echo this measurement type (see also: "
1284 "TIMEMORY_DART_OUTPUT)",
1289 "Only echo this number of dart tags (see also: "
1290 "TIMEMORY_DART_OUTPUT)",
1295 "Echo the category instead of the label (see also: TIMEMORY_DART_OUTPUT)",
true,
1307 m_data.reserve(160);
1310 initialize_components();
1312 initialize_format();
1313 initialize_parallel();
1315 initialize_roofline();
1316 initialize_miscellaneous();
1327#if defined(TIMEMORY_UNIX)
1328 auto file_exists = [](
const std::string& _fname) {
1329 struct stat _buffer;
1330 if(stat(_fname.c_str(), &_buffer) == 0)
1331 return (S_ISREG(_buffer.st_mode) != 0 || S_ISLNK(_buffer.st_mode) != 0);
1335 auto file_exists = [](
const std::string&) {
return true; };
1338 if(file_exists(inp))
1340 std::ifstream ifs{ inp };
1343 return read(ifs, inp);
1359 if(m_read_configs.find(inp) != m_read_configs.end())
1361 PRINT_HERE(
"Warning! Re-reading config file: %s", inp.c_str());
1363 m_read_configs.emplace(inp);
1365 if(inp.find(
".json") != std::string::npos || inp ==
"json")
1371 ia->setNextName(
"timemory");
1376 ia->setNextName(
"metadata");
1379 (*ia)(cereal::make_nvp(
"settings", *
this));
1384 (*ia)(cereal::make_nvp(
"settings", *
this));
1388 }
catch(tim::cereal::Exception& e)
1390 PRINT_HERE(
"Exception reading %s :: %s", inp.c_str(), e.what());
1391#if defined(TIMEMORY_INTERNAL_TESTING)
1398#if defined(TIMEMORY_USE_XML)
1399 else if(inp.find(
".xml") != std::string::npos || inp ==
"xml")
1403 ia->setNextName(
"timemory");
1408 ia->setNextName(
"metadata");
1411 (*ia)(cereal::make_nvp(
"settings", *
this));
1416 (*ia)(cereal::make_nvp(
"settings", *
this));
1432 auto _spos = _s.find_first_of(
" \t\n\r\v\f");
1433 auto _cpos = _s.find_first_not_of(
" \t\n\r\v\f");
1434 if(_spos < _cpos && _cpos != std::string::npos)
1435 _s = _s.substr(_cpos);
1440 for(
const auto& itr : _s)
1443 if(std::isgraph(itr, _lc))
1444 return (itr ==
'#');
1452 std::map<std::string, std::string> _variables{};
1460 static const char* _env_syntax =
"$env:";
1461 if(_v.find(_env_syntax) == 0)
1462 return _resolve_variable(
1463 get_env<std::string>(_v.substr(strlen(_env_syntax)),
""));
1464 auto vitr = _variables.find(_v);
1465 if(vitr != _variables.end())
1466 return _resolve_variable(vitr->second);
1469 for(
const auto& itr : *
this)
1471 if(itr.second->matches(_v))
1472 return _resolve_variable(itr.second->as_string());
1480 std::getline(ifs, line);
1481 if(!ifs || line.empty())
1485 if(get_debug() || get_verbose() > 4)
1486 fprintf(stderr,
"[timemory::settings]['%s']> %s\n", inp.c_str(),
1488 if(_is_comment(line))
1498 for(
size_t i = 1; i < delim.size(); ++i)
1500 if(delim.empty() || delim.at(i) ==
"#" || delim.at(i).at(0) ==
'#')
1502 val +=
"," + _resolve_variable(delim.at(i));
1505 if(val.length() > 0)
1506 val = val.substr(1);
1511 if(key ==
"#" || key.at(0) ==
'#')
1517 if(key.at(0) ==
'$')
1519 _variables.emplace(key, val);
1524 for(
const auto& itr : *
this)
1526 if(itr.second->matches(key))
1528 if(get_debug() || get_verbose() > 0)
1529 fprintf(stderr,
"[timemory::settings]['%s']> %-30s :: %s\n",
1530 inp.c_str(), key.c_str(), val.c_str());
1532 itr.second->parse(val);
1539 for(
auto& itr : _key)
1540 itr = std::toupper(itr);
1543 if(get_debug() || get_verbose() > 0)
1546 "[timemory::settings]['%s']> Unknown setting with "
1547 "recognized prefix ('%s') exported to environment: "
1548 "'%s' (value = '%s')\n",
1557 "[timemory::settings]['%s']> WARNING! Unknown setting "
1558 "ignored: '%s' (value = '%s')\n",
1559 inp.c_str(), key.c_str(), val.c_str());
1564 return (expected == valid);
1575 if(get_debug() || get_verbose() > 3)
1578 static const auto _dcfgs = std::set<std::string>{
1579 get_env<string_t>(
"HOME") +
std::string(
"/.timemory.cfg"),
1580 get_env<string_t>(
"HOME") +
std::string(
"/.timemory.json"),
1581 get_env<string_t>(
"HOME") +
std::string(
"/.config/timemory.cfg"),
1582 get_env<string_t>(
"HOME") +
std::string(
"/.config/timemory.json")
1585 auto _cfg = get_config_file();
1587 for(
const auto& citr : _files)
1590 if(get_suppress_config())
1594 if(!_search_default && _dcfgs.find(citr) != _dcfgs.end())
1597 if(m_read_configs.find(citr) != m_read_configs.end())
1600 std::ifstream ifs{ citr };
1604 m_read_configs.emplace(citr);
1606 else if(_dcfgs.find(citr) == _dcfgs.end())
1807#include "timemory/tpls/cereal/archives.hpp"
#define TIMEMORY_DEFAULT_ENABLED
#define TIMEMORY_DEFAULT_PLOTTING
#define TIMEMORY_PYTHON_PLOTTER
static bool & enable_all()
static bool & disable_all()
::tim::statistics< Tp > max(::tim::statistics< Tp > lhs, const Tp &rhs)
TIMEMORY_UTILITY_INLINE std::string compute_md5(const std::string &inp)
const string_t const string_t & _dir
input_type & get_fields()
TIMEMORY_SETTINGS_MEMBER_DEF(string_t, config_file, TIMEMORY_SETTINGS_KEY("CONFIG_FILE")) TIMEMORY_SETTINGS_MEMBER_DEF(bool
char const std::string & _prefix
void set_env(const std::string &env_var, const Tp &_val, int override)
TIMEMORY_SETTINGS_INLINE std::string get_local_datetime(const char *dt_format, std::time_t *dt_curr)
std::vector< std::string > read_command_line(pid_t _pid)
char argparse::argument_parser tim::settings * _settings
tim::mpl::apply< std::string > string
TIMEMORY_SETTINGS_KEY("SUPPRESS_PARSING")) TIMEMORY_SETTINGS_MEMBER_DEF(bool
int makedir(std::string _dir, int umask)
auto get(const auto_bundle< Tag, Types... > &_obj)
ContainerT delimit(const std::string &line, const std::string &delimiters="\"',;: ", PredicateT &&predicate=[](const std::string &s) -> std::string { return s;})
char const std::string const std::string & _suffix
#define TIMEMORY_SETTINGS_MEMBER_IMPL(TYPE, FUNC, ENV_VAR, DESC, INIT)
#define TIMEMORY_SETTINGS_HIDDEN_MEMBER_ARG_IMPL(TYPE, ENV_VAR, DESC, INIT,...)
#define TIMEMORY_SETTINGS_INLINE
#define TIMEMORY_SETTINGS_PREFIX
#define TIMEMORY_SETTINGS_MEMBER_ARG_IMPL(TYPE, FUNC, ENV_VAR, DESC, INIT,...)
#define TIMEMORY_SETTINGS_EXTERN_TEMPLATE(...)
#define TIMEMORY_SETTINGS_REFERENCE_ARG_IMPL(TYPE, FUNC, ENV_VAR, DESC, INIT,...)
#define TIMEMORY_SETTINGS_REFERENCE_IMPL(TYPE, FUNC, ENV_VAR, DESC, INIT)
#define TIMEMORY_SETTINGS_REFERENCE_DEF(TYPE, FUNC, ENV_VAR)
arg_result get(size_t _idx, Tp &_value)
bool read(const string_t &)
read a configuration file
static pointer_t shared_instance()
static void store_command_line(int argc, char **argv)
static string_t compose_output_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), bool _make_dir=false, std::string _explicit={})
static string_t get_global_output_prefix(bool _make_dir=false)
static string_t compose_input_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), std::string _explicit={})
Tp get(Sp &&_key, bool _exact=true)
static std::time_t * get_launch_time(Tag={})
static string_t toupper(string_t str)
static string_t get_global_input_prefix()
static std::string get_fallback_tag()
if the tag is not explicitly set, try to compute it. Otherwise use the TIMEMORY_SETTINGS_PREFIX_
std::unordered_map< string_view_t, value_type > data_type
settings & operator=(const settings &)
process::get_id()) static strvector_t get_global_environment()
strvector_t & get_environment()
static void parse(settings *=instance< TIMEMORY_API >())
static settings * instance()
static std::string format(std::string _fpath, const std::string &_tag)
void init_config(bool search_default=true)
std::vector< std::string > strvector_t
static string_t tolower(string_t str)
suppress_parsing enabled cout_output text_output tree_output time_output diff_output ctest_notes debug collapse_threads max_depth precision max_width timing_precision timing_units memory_precision memory_units output_path input_path input_extensions dart_count max_thread_bookmarks stack_clearing throttle_count global_components list_components mpip_components trace_components kokkos_components mpi_init mpi_thread upcxx_init papi_threading papi_fail_on_error papi_events papi_overflow nvtx_marker_device_sync cupti_activity_kinds cupti_metrics roofline_mode gpu_roofline_mode gpu_roofline_events roofline_type_labels_cpu instruction_roofline ert_num_threads_cpu ert_num_streams ert_block_size ert_min_working_size ert_min_working_size_gpu ert_max_data_size_cpu ert_skip_ops node_count python_exe enable_signal_handler enable_all_signals flat_profile static TIMEMORY_SETTINGS_REFERENCE_DECL(bool, timeline_profile) TIMEMORY_SETTINGS_REFERENCE_DECL(process strvector_t & environment()
std::string get_tag() const
the "tag" for settings should generally be the basename of exe
The declaration for the types for utility without definitions.
#define TIMEMORY_CONDITIONAL_DEMANGLED_BACKTRACE(CONDITION, DEPTH)
#define TIMEMORY_EXCEPTION(...)
#define TIMEMORY_JOIN(delim,...)