Autonomic Performance Environment for eXascale (APEX)
2.3.1
|
Go to the documentation of this file.
13 #ifndef DOXYGEN_SHOULD_SKIP_THIS
19 #ifdef APEX_HAVE_HPX_CONFIG
20 #include <hpx/config.hpp>
24 #include "apex_options.hpp"
25 #include "apex_export.h"
26 #include "profiler.hpp"
27 #include "profile.hpp"
28 #include "task_wrapper.hpp"
41 class apex_tuning_request;
80 APEX_EXPORT uint64_t
init(
const char * thread_name,
81 const uint64_t comm_rank,
const uint64_t comm_size);
119 APEX_EXPORT
void cleanup(
void);
139 APEX_EXPORT profiler *
start(
const std::string &timer_name);
170 APEX_EXPORT
void start(std::shared_ptr<task_wrapper> task_wrapper_ptr);
184 APEX_EXPORT
void stop(profiler * the_profiler,
bool cleanup=
true);
197 APEX_EXPORT
void stop(std::shared_ptr<task_wrapper> task_wrapper_ptr);
212 APEX_EXPORT
void yield(profiler * the_profiler);
227 APEX_EXPORT
void yield(std::shared_ptr<task_wrapper> task_wrapper_ptr);
246 APEX_EXPORT profiler *
resume(
const std::string &timer_name);
283 APEX_EXPORT
void resume(std::shared_ptr<task_wrapper> task_wrapper_ptr);
299 APEX_EXPORT
void reset(
const std::string &timer_name);
320 APEX_EXPORT
void set_state(apex_thread_state state);
337 APEX_EXPORT
void sample_value(
const std::string &name,
double value);
353 APEX_EXPORT std::shared_ptr<task_wrapper>
new_task(
354 const std::string &name,
355 const uint64_t task_id = UINTMAX_MAX,
371 APEX_EXPORT std::shared_ptr<task_wrapper>
new_task(
373 const uint64_t task_id = UINTMAX_MAX,
385 APEX_EXPORT std::shared_ptr<task_wrapper>
update_task(
386 std::shared_ptr<task_wrapper> wrapper,
387 const std::string &name);
398 APEX_EXPORT std::shared_ptr<task_wrapper>
update_task(
399 std::shared_ptr<task_wrapper> wrapper,
436 APEX_EXPORT std::string&
version(
void);
481 std::function<
int(apex_context
const&)> f);
498 std::set<apex_event_type> when, std::function<
int(apex_context
const&)> f);
512 unsigned long period, std::function<
int(apex_context
const&)> f);
527 unsigned long period,
const std::string & counter_name);
576 APEX_EXPORT apex_profile*
get_profile(
const std::string &timer_name);
578 #ifndef DOXYGEN_SHOULD_SKIP_THIS
600 APEX_EXPORT
double current_power_high(
void);
602 #endif // DOXYGEN_SHOULD_SKIP_THIS
680 apex_event_type event_type,
int num_inputs,
long ** inputs,
long * mins,
681 long * maxs,
long * steps);
704 num_inputs,
long ** inputs,
long * mins,
long * maxs,
long * steps);
718 apex_tuning_request & request);
739 unsigned long update_interval);
741 #ifndef DOXYGEN_SHOULD_SKIP_THIS
742 APEX_EXPORT
int startup_throttling(
void);
763 #ifndef DOXYGEN_SHOULD_SKIP_THIS // test API stuff
764 APEX_EXPORT
int get_input2(
void);
785 APEX_EXPORT std::vector<std::pair<std::string,long*>> &
825 APEX_EXPORT
void send (uint64_t tag, uint64_t size, uint64_t target);
841 APEX_EXPORT
void recv (uint64_t tag, uint64_t size,
842 uint64_t source_rank, uint64_t source_thread);
855 std::shared_ptr<apex::task_wrapper> twp;
882 scoped_timer(uint64_t func, std::shared_ptr<apex::task_wrapper> parent)
883 : twp(nullptr), timing(true) {
894 std::shared_ptr<apex::task_wrapper> parent)
895 : twp(nullptr), timing(true) {
988 #define APEX_SCOPED_TIMER \
989 std::ostringstream _s_foo; \
990 _s_foo << __func__ << " [" << __FILE__ << ":" << __LINE__ << "]"; \
991 apex::scoped_timer __foo(_s_foo.str());
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).
void yield(profiler *the_profiler)
Stop a timer, but don't increment the number of calls.
void stop(profiler *the_profiler, bool cleanup=true)
Stop a timer.
void register_thread(const std::string &name)
Register a new thread.
void reset(const std::string &timer_name)
Reset a timer or counter.
Typedef for enumerating the different event types.
void cleanup(void)
Cleanup APEX.
void get_best_values(apex_tuning_session_handle h)
Set a tuning session's values to the best known values.
scoped_thread(const std::string &thread_name)
Constructor.
Definition: apex_api.hpp:968
void deregister_policy(apex_policy_handle *handle)
Deregister a policy with APEX.
apex_event_type register_custom_event(const std::string &name)
Register an event type with APEX.
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.
apex_policy_handle * register_policy(const apex_event_type when, std::function< int(apex_context const &)> f)
Register a policy with APEX.
scoped_timer(uint64_t func, std::shared_ptr< apex::task_wrapper > parent)
Register a new thread with APEX, then construct and start an APEX timer.
Definition: apex_api.hpp:882
apex_policy_handle * register_periodic_policy(unsigned long period, std::function< int(apex_context const &)> f)
Register a policy with APEX.
scoped_timer(uint64_t func)
Construct and start an APEX timer.
Definition: apex_api.hpp:863
std::shared_ptr< apex::task_wrapper > get_task_wrapper(void)
Get the internal task wrapper object.
Definition: apex_api.hpp:949
void stop_all_async_threads(void)
Stop all asynchronous APEX background threads.
A convenience class for using APEX in C++ applications.
Definition: apex_api.hpp:853
scoped_timer(std::string func, std::shared_ptr< apex::task_wrapper > parent)
Register a new thread with APEX, then construct and start an APEX timer.
Definition: apex_api.hpp:893
uint64_t init(const char *thread_name, const uint64_t comm_rank, const uint64_t comm_size)
Intialize APEX.
bool has_session_converged(apex_tuning_session_handle handle)
Check whether a tuning session has converged.
int get_thread_cap(void)
Get the current thread cap set by the throttling.
The main APEX namespace.
Definition: apex_api.hpp:50
uint32_t apex_tuning_session_handle
Definition: apex_types.h:212
profiler * start(const std::string &timer_name)
Start a timer.
void custom_event(apex_event_type event_type, void *custom_data)
Trigger a custom event.
void stop(void)
Stop the APEX timer.
Definition: apex_api.hpp:913
void start(void)
Start the APEX timer.
Definition: apex_api.hpp:903
void exit_thread(void)
Exit a thread.
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.
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.
apex_profile * get_profile(apex_function_address function_address)
Get the current profile for the specified function address.
void set_thread_cap(int new_cap)
Set the current thread cap for throttling.
~scoped_timer()
Destructor.
Definition: apex_api.hpp:942
static std::shared_ptr< task_wrapper > null_task_wrapper(nullptr)
declare a default "null" pointer for std::shared_ptr<task_wrapper>& references
void yield(void)
Yield the APEX timer.
Definition: apex_api.hpp:923
scoped_timer(std::string func)
Construct and start an APEX timer.
Definition: apex_api.hpp:872
profiler * resume(const std::string &timer_name)
Resume a timer.
std::string & version(void)
Return the APEX version.
A convenience class for creating a scoped thread.
Definition: apex_api.hpp:962
std::vector< std::pair< std::string, long * > > & get_tunable_params(apex_tuning_session_handle h)
Return a vector of the current tunable parameters.
uintptr_t apex_function_address
Definition: apex_types.h:36
apex_optimization_method_t
Definition: apex_types.h:122
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.
void finalize(void)
Finalize APEX.
int setup_power_cap_throttling(void)
Initialize the power cap throttling policy.
void set_state(apex_thread_state state)
Set the thread state.
std::shared_ptr< task_wrapper > update_task(std::shared_ptr< task_wrapper > wrapper, const std::string &name)
Update a task (dependency).
int shutdown_throttling(void)
Terminate the throttling policy.
void sample_value(const std::string &name, double value)
Sample a state value.
apex_optimization_criteria_t
Definition: apex_types.h:110
void resume(void)
Resume the APEX timer.
Definition: apex_api.hpp:933
std::string dump(bool reset)
Dump output from APEX.
void print_options(void)
Print out all configuration settings for APEX.
apex_policy_handle * sample_runtime_counter(unsigned long period, const std::string &counter_name)
Periodically sample a runtime counter.
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.
~scoped_thread()
Destructor.
Definition: apex_api.hpp:974