Skip to content

Commit

Permalink
Merge pull request #2772 from STEllAR-GROUP/papi_counters
Browse files Browse the repository at this point in the history
Adding documentation for PAPI counters
  • Loading branch information
hkaiser committed Jul 24, 2017
2 parents 5640334 + 29095fd commit 53804aa
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 26 deletions.
65 changes: 55 additions & 10 deletions docs/manual/existing_performance_counters.qbk
Expand Up @@ -471,7 +471,8 @@ system and application performance.
executing one __hpx__-thread for all worker threads separately.
This counter is available only if the configuration time constants
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` (default: ON) and
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).]
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/time/average-overhead`]
Expand Down Expand Up @@ -499,7 +500,8 @@ system and application performance.
one __hpx__-thread for all worker threads separately.
This counter is available only if the configuration time constants
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` (default: ON) and
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).]
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/count/cumulative-phases`]
Expand Down Expand Up @@ -527,7 +529,8 @@ system and application performance.
the counter will return the overall number of executed __hpx__-thread
phases for all worker threads separately.
This counter is available only if the configuration time constant
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` is set to `ON` (default: ON).]
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` is set to `ON` (default: ON).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/time/average-phase`]
Expand Down Expand Up @@ -556,7 +559,8 @@ system and application performance.
__hpx__-thread phase for all worker threads separately.
This counter is available only if the configuration time constants
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` (default: ON) and
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).]
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/time/average-phase-overhead`]
Expand Down Expand Up @@ -586,7 +590,8 @@ system and application performance.
for all worker threads separately. This counter is available only
if the configuration time constants
`HPX_WITH_THREAD_CUMULATIVE_COUNTS` (default: ON) and
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).]
`HPX_WITH_THREAD_IDLE_RATES` are set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/time/overall`]
Expand All @@ -613,8 +618,9 @@ system and application performance.
(cores) on that locality. If the instance name is `worker-thread#*`
the counter will return the overall time spent running the scheduler
for all worker threads separately. This counter is available only
if the configuration time constant
`HPX_WITH_THREAD_IDLE_RATES` is set to `ON` (default: OFF).]
if the configuration time constant
`HPX_WITH_THREAD_IDLE_RATES` is set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/time/cumulative`]
Expand Down Expand Up @@ -672,7 +678,8 @@ system and application performance.
all __hpx__-threads for all worker threads separately.
This counter is available only if the configuration time constants
`HPX_THREAD_MAINTAIN_CUMULATIVE_COUNTS` (default: ON) and
`HPX_THREAD_MAINTAIN_IDLE_RATES` are set to `ON` (default: OFF).]
`HPX_THREAD_MAINTAIN_IDLE_RATES` are set to `ON` (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/count/instantaneous/<thread-state>`
Expand Down Expand Up @@ -745,7 +752,8 @@ system and application performance.

These counters are available only if the compile time constant
`HPX_WITH_THREAD_QUEUE_WAITTIME` was defined while compiling the
__hpx__ core library (default: OFF).]
__hpx__ core library (default: OFF).
The unit of measure for this counter is nanosecond [ns].]
[None]
]
[ [`/threads/idle-rate`]
Expand Down Expand Up @@ -1047,7 +1055,7 @@ system and application performance.
(instantaneous) scheduler utilization queried for. The locality id
(given by `*`) is a (zero based) number identifying the locality.
]
[Returns the total scheduler (instantaneous) utilization. This is the
[Returns the total (instantaneous) scheduler utilization. This is the
current percentage of scheduler threads executing __hpx__ threads.]
[Percent]
]
Expand Down Expand Up @@ -1282,6 +1290,43 @@ system and application performance.
]
]

[/////////////////////////////////////////////////////////////////////////////]
[table Performance Counters exposing PAPI hardware counters
[[Counter Type] [Counter Instance Formatting] [Description] [Parameters]]
[ [`/papi/<papi_event>`

where:[br] `<papi_event>` is the name of the PAPI event to expose as
a performance counter (such as `PAPI_SR_INS`). Note that the list of
available PAPI events changes depending on the used architecture.

For a full list of available PAPI events and their (short) description
use the `--hpx:list-counters` and --papi-event-info=all command line
options.
]
[`locality#*/total` or[br]
`locality#*/worker-thread#*`

where:[br]
`locality#*` is defining the locality for which the current
current accumulated value of all busy-loop counters of all worker
threads should be queried. The locality id
(given by `*`) is a (zero based) number identifying the locality.

`worker-thread#*` is defining the worker thread for which the
current value of the busy-loop counter should be queried
for. The worker thread number (given by the `*`) is a (zero based)
worker thread number (given by the `*`) is a (zero based) number
identifying the worker thread. The number of available worker threads
is usually specified on the command line for the application using the
option [hpx_cmdline `--hpx:threads`].
]
[This counter returns the current count of occurrences of the specified
PAPI event. This counter is available only if the configuration time
constant `HPX_WITH_PAPI` is set to `ON` (default: OFF).]
[None]
]
]

[/////////////////////////////////////////////////////////////////////////////]
[table Performance Counters for General Statistics
[[Counter Type] [Counter Instance Formatting] [Description] [Parameters]]
Expand Down
4 changes: 2 additions & 2 deletions src/components/performance_counters/papi/papi_startup.cpp
Expand Up @@ -292,9 +292,9 @@ namespace hpx { namespace performance_counters { namespace papi

// deferred options
variables_map vm = util::get_options();
if (vm.count("papi-event-info"))
if (vm.count("hpx:papi-event-info"))
{
std::string v = vm["papi-event-info"].as<std::string>();
std::string v = vm["hpx:papi-event-info"].as<std::string>();
util::list_events(v);
}
}
Expand Down
37 changes: 23 additions & 14 deletions src/components/performance_counters/papi/util/papi.cpp
Expand Up @@ -51,7 +51,7 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
if (it == papi_domain_map.end())
HPX_THROW_EXCEPTION(hpx::commandline_option_error,
NS_STR "check_options()",
"invalid argument "+s+" to --papi-domain");
"invalid argument "+s+" to --hpx:papi-domain");
return it->second;
}

Expand All @@ -66,7 +66,7 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
// description of PAPI counter specific options
options_description papi_opts("PAPI counter options");
papi_opts.add_options()
("papi-domain", value<std::string>()->default_value("user"),
("hpx:papi-domain", value<std::string>()->default_value("user"),
"sets monitoring scope to one of:\n"
" user - user context only,\n"
" kernel - kernel/OS context only,\n"
Expand All @@ -75,9 +75,9 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
" all - all above contexts,\n"
" min - smallest available context,\n"
" max - largest available context.")
("papi-multiplex", value<long>()->implicit_value(0),
("hpx:papi-multiplex", value<long>()->implicit_value(0),
"enable low level counter multiplexing.")
("papi-event-info", value<std::string>()->implicit_value("preset"),
("hpx:papi-event-info", value<std::string>()->implicit_value("preset"),
"display detailed information about events available on local host;"
" the optional argument is one of:\n"
" preset - show available predefined events,\n"
Expand Down Expand Up @@ -111,7 +111,16 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
vm["hpx:print-counter"].as<std::vector<std::string> >();
std::vector<std::string>::iterator it;
for (it = names.begin(); it != names.end(); it++)
if (it->substr(0, 6) == "/papi{")
if (it->substr(0, 5) == "/papi")
return true;
}
if (vm.count("hpx:print-counter-reset"))
{
std::vector<std::string> names =
vm["hpx:print-counter-reset"].as<std::vector<std::string> >();
std::vector<std::string>::iterator it;
for (it = names.begin(); it != names.end(); it++)
if (it->substr(0, 5) == "/papi")
return true;
}
return false;
Expand All @@ -121,33 +130,33 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
bool check_options(variables_map const& vm)
{
bool needed = need_papi_component(vm);
if (vm.count("papi-event-info"))
if (vm.count("hpx:papi-event-info"))
{
std::string v = vm["papi-event-info"].as<std::string>();
std::string v = vm["hpx:papi-event-info"].as<std::string>();
if (v != "preset" && v != "native" && v != "all")
HPX_THROW_EXCEPTION(hpx::commandline_option_error,
NS_STR "check_options()",
"unsupported mode "+v+" in --papi-event-info");
"unsupported mode "+v+" in --hpx:papi-event-info");
}
if (vm.count("papi-domain"))
if (vm.count("hpx:papi-domain"))
{
std::string v = vm["papi-domain"].as<std::string>();
std::string v = vm["hpx:papi-domain"].as<std::string>();
int dom = map_domain(v); // throws if not found
papi_call(PAPI_set_domain(dom),
"could not switch to \""+v+"\" domain monitoring",
NS_STR "check_options()");
needed = true;
}
// FIXME: implement multiplexing properly and uncomment below when done
if (vm.count("papi-multiplex"))
if (vm.count("hpx:papi-multiplex"))
HPX_THROW_EXCEPTION(hpx::not_implemented,
NS_STR "check_options()",
"counter multiplexing is currently not supported");
#if 0
if (vm.count("papi-multiplex") && vm["papi-multiplex"].as<long>() < 0)
if (vm.count("hpx:papi-multiplex") && vm["hpx:papi-multiplex"].as<long>() < 0)
HPX_THROW_EXCEPTION(hpx::commandline_option_error,
NS_STR "check_options()",
"argument to --papi-multiplex must be positive");
"argument to --hpx:papi-multiplex must be positive");
#endif
return needed;
}
Expand Down Expand Up @@ -176,7 +185,7 @@ namespace hpx { namespace performance_counters { namespace papi { namespace util
return s;
}

// determine depndencies of a derived event
// determine dependencies of a derived event
std::string dependencies(event_info const& info)
{
if (info.count <= 1) return std::string("none");
Expand Down

0 comments on commit 53804aa

Please sign in to comment.