Autonomic Performance Environment for eXascale (APEX)
2.3.1
|
The main APEX namespace. More...
Classes | |
class | scoped_thread |
A convenience class for creating a scoped thread. More... | |
class | scoped_timer |
A convenience class for using APEX in C++ applications. More... | |
struct | task_wrapper |
A wrapper around APEX tasks. More... | |
Functions | |
static std::shared_ptr< task_wrapper > | null_task_wrapper (nullptr) |
declare a default "null" pointer for std::shared_ptr<task_wrapper>& references More... | |
uint64_t | init (const char *thread_name, const uint64_t comm_rank, const uint64_t comm_size) |
Intialize APEX. More... | |
std::string | dump (bool reset) |
Dump output from APEX. More... | |
void | finalize (void) |
Finalize APEX. More... | |
void | cleanup (void) |
Cleanup APEX. More... | |
profiler * | start (const std::string &timer_name) |
Start a timer. More... | |
profiler * | start (const apex_function_address function_address) |
Start a timer. More... | |
void | start (std::shared_ptr< task_wrapper > task_wrapper_ptr) |
Start a timer. More... | |
void | stop (profiler *the_profiler, bool cleanup=true) |
Stop a timer. More... | |
void | stop (std::shared_ptr< task_wrapper > task_wrapper_ptr) |
Stop a timer. More... | |
void | yield (profiler *the_profiler) |
Stop a timer, but don't increment the number of calls. More... | |
void | yield (std::shared_ptr< task_wrapper > task_wrapper_ptr) |
Stop a timer, but don't increment the number of calls. More... | |
profiler * | resume (const std::string &timer_name) |
Resume a timer. More... | |
profiler * | resume (const apex_function_address function_address) |
Resume a timer. More... | |
void | resume (std::shared_ptr< task_wrapper > task_wrapper_ptr) |
Resume a timer. More... | |
void | reset (const std::string &timer_name) |
Reset a timer or counter. More... | |
void | reset (apex_function_address function_address) |
Reset a timer. More... | |
void | set_state (apex_thread_state state) |
Set the thread state. More... | |
void | sample_value (const std::string &name, double value) |
Sample a state value. More... | |
std::shared_ptr< task_wrapper > | new_task (const std::string &name, const uint64_t task_id=UINTMAX_MAX, const std::shared_ptr< apex::task_wrapper > parent_task=null_task_wrapper) |
Create a new task (dependency). More... | |
std::shared_ptr< task_wrapper > | new_task (const apex_function_address function_address, const uint64_t task_id=UINTMAX_MAX, const std::shared_ptr< apex::task_wrapper > parent_task=null_task_wrapper) |
Create a new task (dependency). More... | |
std::shared_ptr< task_wrapper > | update_task (std::shared_ptr< task_wrapper > wrapper, const std::string &name) |
Update a task (dependency). More... | |
std::shared_ptr< task_wrapper > | update_task (std::shared_ptr< task_wrapper > wrapper, const apex_function_address function_address) |
Update a task wrapper (dependency). More... | |
apex_event_type | register_custom_event (const std::string &name) |
Register an event type with APEX. More... | |
void | custom_event (apex_event_type event_type, void *custom_data) |
Trigger a custom event. More... | |
std::string & | version (void) |
Return the APEX version. More... | |
void | register_thread (const std::string &name) |
Register a new thread. More... | |
void | exit_thread (void) |
Exit a thread. More... | |
apex_policy_handle * | register_policy (const apex_event_type when, std::function< int(apex_context const &)> f) |
Register a policy with APEX. More... | |
std::set< apex_policy_handle * > | register_policy (std::set< apex_event_type > when, std::function< int(apex_context const &)> f) |
Register a policy with APEX. More... | |
apex_policy_handle * | register_periodic_policy (unsigned long period, std::function< int(apex_context const &)> f) |
Register a policy with APEX. More... | |
apex_policy_handle * | sample_runtime_counter (unsigned long period, const std::string &counter_name) |
Periodically sample a runtime counter. More... | |
void | deregister_policy (apex_policy_handle *handle) |
Deregister a policy with APEX. More... | |
void | stop_all_async_threads (void) |
Stop all asynchronous APEX background threads. More... | |
apex_profile * | get_profile (apex_function_address function_address) |
Get the current profile for the specified function address. More... | |
apex_profile * | get_profile (const std::string &timer_name) |
Get the current profile for the specified function address. More... | |
int | setup_power_cap_throttling (void) |
Initialize the power cap throttling policy. More... | |
int | setup_timer_throttling (apex_function_address the_address, apex_optimization_criteria_t criteria, apex_optimization_method_t method, unsigned long update_interval) |
Setup throttling to optimize for the specified function. More... | |
int | setup_throughput_tuning (apex_function_address the_address, apex_optimization_criteria_t criteria, apex_event_type event_type, int num_inputs, long **inputs, long *mins, long *maxs, long *steps) |
Setup throttling to optimize for the specified function, using multiple input criteria. More... | |
apex_tuning_session_handle | setup_custom_tuning (std::function< double(void)> metric, apex_event_type event_type, int num_inputs, long **inputs, long *mins, long *maxs, long *steps) |
Setup tuning of specified parameters to optimize for a custom metric, using multiple input criteria. More... | |
apex_tuning_session_handle | setup_custom_tuning (apex_tuning_request &request) |
Setup tuning of specified parameters to optimize for a custom metric, using multiple input criteria of potentially multiple types. More... | |
int | setup_timer_throttling (const std::string &the_name, apex_optimization_criteria_t criteria, apex_optimization_method_t method, unsigned long update_interval) |
Setup throttling to optimize for the specified function or counter. More... | |
int | shutdown_throttling (void) |
Terminate the throttling policy. More... | |
int | get_thread_cap (void) |
Get the current thread cap set by the throttling. More... | |
void | set_thread_cap (int new_cap) |
Set the current thread cap for throttling. More... | |
std::vector< std::pair< std::string, long * > > & | get_tunable_params (apex_tuning_session_handle h) |
Return a vector of the current tunable parameters. More... | |
bool | has_session_converged (apex_tuning_session_handle handle) |
Check whether a tuning session has converged. More... | |
void | get_best_values (apex_tuning_session_handle h) |
Set a tuning session's values to the best known values. More... | |
void | print_options (void) |
Print out all configuration settings for APEX. More... | |
void | send (uint64_t tag, uint64_t size, uint64_t target) |
Notify APEX that the current thread is sending a parcel/message to another rank/locality/process. More... | |
void | recv (uint64_t tag, uint64_t size, uint64_t source_rank, uint64_t source_thread) |
Notify APEX that the current thread is receiving a parcel/message from another rank/locality/process. More... | |
The main APEX namespace.
The C++ interface for APEX uses the apex namespace. In comparison, The C interface has functions that start with "apex_".
void apex::cleanup | ( | void | ) |
Cleanup APEX.
The cleanup method will free all allocated memory for APEX.
void apex::custom_event | ( | apex_event_type | event_type, |
void * | custom_data | ||
) |
Trigger a custom event.
This function will pass a custom event to the APEX event listeners. Each listeners' custom event handler will handle the custom event. Policy functions will be passed the custom event name in the event context.
event_type | The type of the custom event |
custom_data | Data specific to the custom event |
void apex::deregister_policy | ( | apex_policy_handle * | handle | ) |
Deregister a policy with APEX.
This function will deregister the specified policy. In order to enable the policy again, it should be registered using apex::register_policy or apex::register_periodic_policy.
handle | The handle of the policy to be deregistered. |
std::string apex::dump | ( | bool | reset | ) |
Dump output from APEX.
The stop measurement method will terminate all measurement and optionally:
reset | Whether to reset all statistics |
void apex::exit_thread | ( | void | ) |
Exit a thread.
For multithreaded applications, exit this thread and clean up.
void apex::finalize | ( | void | ) |
Finalize APEX.
The stop measurement method will terminate all measurement and optionally:
void apex::get_best_values | ( | apex_tuning_session_handle | h | ) |
Set a tuning session's values to the best known values.
h | The handle for the tuning session of interest. |
apex_profile* apex::get_profile | ( | apex_function_address | function_address | ) |
Get the current profile for the specified function address.
This function will return the current profile for the specified address. Because profiles are updated out-of-band, it is possible that this profile value is out of date.
function_address | The address of the function. |
apex_profile* apex::get_profile | ( | const std::string & | timer_name | ) |
Get the current profile for the specified function address.
This function will return the current profile for the specified address. Because profiles are updated out-of-band, it is possible that this profile value is out of date. This profile can be either a timer or a sampled value.
timer_name | The name of the function |
int apex::get_thread_cap | ( | void | ) |
Get the current thread cap set by the throttling.
This function will return the current thread cap based on the throttling policy.
std::vector<std::pair<std::string,long*> >& apex::get_tunable_params | ( | apex_tuning_session_handle | h | ) |
Return a vector of the current tunable parameters.
bool apex::has_session_converged | ( | apex_tuning_session_handle | handle | ) |
Check whether a tuning session has converged.
handle | The handle for the tuning session of interest. |
uint64_t apex::init | ( | const char * | thread_name, |
const uint64_t | comm_rank, | ||
const uint64_t | comm_size | ||
) |
Intialize APEX.
thread_name | The name of the thread, or NULL. The lifetime of the thread will be timed with a timer using this same name. |
comm_rank | The rank of this process within the full distributed application, i.e. MPI rank or HPX locality. |
comm_size | The total number of processes within the full distributed application, i.e. MPI comm_size or total number of HPX localities. |
std::shared_ptr<task_wrapper> apex::new_task | ( | const apex_function_address | function_address, |
const uint64_t | task_id = UINTMAX_MAX , |
||
const std::shared_ptr< apex::task_wrapper > | parent_task = null_task_wrapper |
||
) |
Create a new task (dependency).
This function will note a task dependency between the current timer (task) and the new task.
function_address | The function address of the timer. |
task_id | The ID of the task (default of -1 implies none provided by runtime) |
parent_task | The apex::task_wrapper (if available) that is the parent task of this task |
std::shared_ptr<task_wrapper> apex::new_task | ( | const std::string & | name, |
const uint64_t | task_id = UINTMAX_MAX , |
||
const std::shared_ptr< apex::task_wrapper > | parent_task = null_task_wrapper |
||
) |
Create a new task (dependency).
This function will note a task dependency between the current timer (task) and the new task.
name | The name of the timer. |
task_id | The ID of the task (default of UINTMAX_MAX implies none provided by runtime) |
parent_task | The apex::task_wrapper (if available) that is the parent task of this task |
|
static |
declare a default "null" pointer for std::shared_ptr<task_wrapper>& references
void apex::print_options | ( | void | ) |
Print out all configuration settings for APEX.
void apex::recv | ( | uint64_t | tag, |
uint64_t | size, | ||
uint64_t | source_rank, | ||
uint64_t | source_thread | ||
) |
Notify APEX that the current thread is receiving a parcel/message from another rank/locality/process.
This method notifies APEX that the current thread is receiving a parcel/message from another rank/locality/process. The tag is meant to be an identifier for the message, not required to be unique. The source value is the APEX rank of the source of the message.
tag | The message identifier |
size | The message size (in bytes) |
source_rank | The message source (as a rank/locality index) |
source_thread | The message source (as a worker index - 0 if unknown) |
apex_event_type apex::register_custom_event | ( | const std::string & | name | ) |
Register an event type with APEX.
Create a user-defined event type for APEX.
name | The name of the custom event |
apex_policy_handle* apex::register_periodic_policy | ( | unsigned long | period, |
std::function< int(apex_context const &)> | f | ||
) |
Register a policy with APEX.
Apex provides the ability to call an application-specified function periodically. This assigns the passed in function to be called on a periodic basis. The context for the event will be passed to the registered function.
period | How frequently the function should be called (in microseconds) |
f | The function to be called when that event is handled by APEX. |
apex_policy_handle* apex::register_policy | ( | const apex_event_type | when, |
std::function< int(apex_context const &)> | f | ||
) |
Register a policy with APEX.
Apex provides the ability to call an application-specified function when certain events occur in the APEX library, or periodically. This assigns the passed in function to the event, so that when that event occurs in APEX, the function is called. The context for the event will be passed to the registered function.
when | The APEX event when this function should be called |
f | The function to be called when that event is handled by APEX. |
std::set<apex_policy_handle*> apex::register_policy | ( | std::set< apex_event_type > | when, |
std::function< int(apex_context const &)> | f | ||
) |
Register a policy with APEX.
Apex provides the ability to call an application-specified function when certain events occur in the APEX library, or periodically. This assigns the passed in function to the event, so that when that event occurs in APEX, the function is called. The context for the event will be passed to the registered function.
when | The set of APEX events when this function should be called |
f | The function to be called when that event is handled by APEX. |
void apex::register_thread | ( | const std::string & | name | ) |
Register a new thread.
For multithreaded applications, register a new thread with APEX.
name | The name that will be assigned to the new thread. |
void apex::reset | ( | apex_function_address | function_address | ) |
Reset a timer.
This function will reset the profile associated with the specified timer to zero.
function_address | The function address of the timer. |
void apex::reset | ( | const std::string & | timer_name | ) |
Reset a timer or counter.
This function will reset the profile associated with the specified timer or counter name to zero.
timer_name | The name of the timer. |
profiler* apex::resume | ( | const apex_function_address | function_address | ) |
Resume a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the address passed in to this function. The difference between this function and the apex::start function is that the number of calls to that timer will not be incremented.
function_address | The address of the function to be timed |
profiler* apex::resume | ( | const std::string & | timer_name | ) |
Resume a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the name passed in to this function. The difference between this function and the apex::start function is that the number of calls to that timer will not be incremented.
timer_name | The name of the timer. |
void apex::resume | ( | std::shared_ptr< task_wrapper > | task_wrapper_ptr | ) |
Resume a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the address passed in to this function. The difference between this function and the apex::start function is that the number of calls to that timer will not be incremented.
task_wrapper_ptr | A pointer to an apex::task_wrapper created by apex::new_task. APEX will use this to store the profiler data. |
apex_policy_handle* apex::sample_runtime_counter | ( | unsigned long | period, |
const std::string & | counter_name | ||
) |
Periodically sample a runtime counter.
Apex provides the ability to call an application-specified function periodically. This assigns the passed in function to be called on a periodic basis. The context for the event will be passed to the registered function.
period | How frequently the counter should be called (in microseconds) |
counter_name | The name of the counter to sample |
void apex::sample_value | ( | const std::string & | name, |
double | value | ||
) |
Sample a state value.
This function will retain a sample of some value. The profile for this sampled value will store the min, mean, max, total and standard deviation for this value for all times it is sampled.
name | The name of the sampled value |
value | The sampled value |
void apex::send | ( | uint64_t | tag, |
uint64_t | size, | ||
uint64_t | target | ||
) |
Notify APEX that the current thread is sending a parcel/message to another rank/locality/process.
This method notifies APEX that the current thread is sending a parcel/message to another rank/locality/process. The tag is meant to be an identifier for the message, not required to be unique. The target value is the APEX rank of the target of the message.
tag | The message identifier |
size | The message size (in bytes) |
target | The message target (as an APEX rank) |
void apex::set_state | ( | apex_thread_state | state | ) |
Set the thread state.
This function will set the thread state in APEX for 3rd party observation
state | The state of the thread. |
void apex::set_thread_cap | ( | int | new_cap | ) |
Set the current thread cap for throttling.
This function will set the current thread cap based on an external throttling policy.
new_cap | The current thread cap value. |
apex_tuning_session_handle apex::setup_custom_tuning | ( | apex_tuning_request & | request | ) |
Setup tuning of specified parameters to optimize for a custom metric, using multiple input criteria of potentially multiple types.
This function will initialize a policy to optimize a custom metric, using metric and parameters specified in the tuning request. The system tries to minimize the custom metric.
request | An apex_tuning_request object that specifies the tuning parameters. |
apex_tuning_session_handle apex::setup_custom_tuning | ( | std::function< double(void)> | metric, |
apex_event_type | event_type, | ||
int | num_inputs, | ||
long ** | inputs, | ||
long * | mins, | ||
long * | maxs, | ||
long * | steps | ||
) |
Setup tuning of specified parameters to optimize for a custom metric, using multiple input criteria.
This function will initialize a policy to optimize a custom metric, using the list of tunable parameters. The system tries to minimize the custom metric. After evaluating the state of the system, the policy will assign new values to the inputs.
metric | A function returning the value to be minimized. |
event_type | The apex_event_type that should trigger this policy |
num_inputs | The number of tunable inputs for optimization |
inputs | An array of addresses to inputs for optimization |
mins | An array of minimum values for each input |
maxs | An array of maximum values for each input |
steps | An array of step values for each input |
int apex::setup_power_cap_throttling | ( | void | ) |
Initialize the power cap throttling policy.
This function will initialize APEX for power cap throttling. There are several environment variables that control power cap throttling:
After evaluating the state of the system, the policy will set the thread cap, which can be queried using apex::get_thread_cap().
int apex::setup_throughput_tuning | ( | apex_function_address | the_address, |
apex_optimization_criteria_t | criteria, | ||
apex_event_type | event_type, | ||
int | num_inputs, | ||
long ** | inputs, | ||
long * | mins, | ||
long * | maxs, | ||
long * | steps | ||
) |
Setup throttling to optimize for the specified function, using multiple input criteria.
This function will initialize a policy to optimize the specified function, using the list of tunable inputs for the specified function. The optimization criteria include maximizing throughput, minimizing or maximizing time spent in the specified function. After evaluating the state of the system, the policy will assign new values to the inputs.
the_address | The address of the function to be optimized. |
criteria | The optimization criteria. |
event_type | The apex_event_type that should trigger this policy |
num_inputs | The number of tunable inputs for optimization |
inputs | An array of addresses to inputs for optimization |
mins | An array of minimum values for each input |
maxs | An array of maximum values for each input |
steps | An array of step values for each input |
int apex::setup_timer_throttling | ( | apex_function_address | the_address, |
apex_optimization_criteria_t | criteria, | ||
apex_optimization_method_t | method, | ||
unsigned long | update_interval | ||
) |
Setup throttling to optimize for the specified function.
This function will initialize the throttling policy to optimize for the specified function. The optimization criteria include maximizing throughput, minimizing or maximizing time spent in the specified function. After evaluating the state of the system, the policy will set the thread cap, which can be queried using apex::get_thread_cap().
the_address | The address of the function to be optimized. |
criteria | The optimization criteria. |
method | The optimization method. |
update_interval | The time between observations, in microseconds. |
int apex::setup_timer_throttling | ( | const std::string & | the_name, |
apex_optimization_criteria_t | criteria, | ||
apex_optimization_method_t | method, | ||
unsigned long | update_interval | ||
) |
Setup throttling to optimize for the specified function or counter.
This function will initialize the throttling policy to optimize for the specified function or counter. The optimization criteria include maximizing throughput, minimizing or maximizing time spent in the specified function or value sampled in the counter. After evaluating the state of the system, the policy will set the thread cap, which can be queried using apex::get_thread_cap().
the_name | The name of the function or counter to be optimized. |
criteria | The optimization criteria. |
method | The optimization method. |
update_interval | The time between observations, in microseconds. |
int apex::shutdown_throttling | ( | void | ) |
Terminate the throttling policy.
This function will terminate the throttling policy.
profiler* apex::start | ( | const apex_function_address | function_address | ) |
Start a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the address passed in to this function.
function_address | The address of the function to be timed |
profiler* apex::start | ( | const std::string & | timer_name | ) |
Start a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the name passed in to this function.
timer_name | The name of the timer. |
void apex::start | ( | std::shared_ptr< task_wrapper > | task_wrapper_ptr | ) |
Start a timer.
This function will create a profiler object in APEX, and return a handle to the object. The object will be associated with the task_wrapper passed in to this function.
task_wrapper_ptr | A pointer to an apex::task_wrapper created by apex::new_task. APEX will use this to store the profiler data. |
void apex::stop | ( | profiler * | the_profiler, |
bool | cleanup = true |
||
) |
Stop a timer.
This function will stop the specified profiler object, and queue the profiler to be processed out-of-band. The timer value will eventually added to the profile for the process.
the_profiler | The handle of the profiler object. |
cleanup | Internal use only. |
void apex::stop | ( | std::shared_ptr< task_wrapper > | task_wrapper_ptr | ) |
Stop a timer.
This function will stop the specified profiler object, and queue the profiler to be processed out-of-band. The timer value will eventually added to the profile for the process.
task_wrapper_ptr | an apex::task_wrapper pointer that was started |
void apex::stop_all_async_threads | ( | void | ) |
Stop all asynchronous APEX background threads.
This function will stop all background threads from all listeners, and force them to exit. This is necessary for stopping perodic policies that would otherwise prevent runtimes from finishing work and calling apex::finalize().
std::shared_ptr<task_wrapper> apex::update_task | ( | std::shared_ptr< task_wrapper > | wrapper, |
const apex_function_address | function_address | ||
) |
Update a task wrapper (dependency).
This function will update the function address that this task wrapper refers to.
wrapper | The existing apex::task_wrapper object |
function_address | The new function address of the timer. |
std::shared_ptr<task_wrapper> apex::update_task | ( | std::shared_ptr< task_wrapper > | wrapper, |
const std::string & | name | ||
) |
Update a task (dependency).
This function will update the name that this task wrapper refers to.
wrapper | The existing apex::task_wrapper object |
name | The new name of the timer. |
std::string& apex::version | ( | void | ) |
Return the APEX version.
void apex::yield | ( | profiler * | the_profiler | ) |
Stop a timer, but don't increment the number of calls.
This function will stop the specified profiler object, and queue the profiler to be processed out-of-band. The timer value will eventually added to the profile for the process. The number of calls will NOT be incremented - this "task" was yielded, not completed. It will be resumed by another thread at a later time.
the_profiler | The handle of the profiler object. |
void apex::yield | ( | std::shared_ptr< task_wrapper > | task_wrapper_ptr | ) |
Stop a timer, but don't increment the number of calls.
This function will stop the specified profiler object, and queue the profiler to be processed out-of-band. The timer value will eventually added to the profile for the process. The number of calls will NOT be incremented - this "task" was yielded, not completed. It will be resumed by another thread at a later time.
task_wrapper_ptr | an apex::task_wrapper pointer that was started |