OpenMPI
0.1.1
|
Progress engine for Open MPI. More...
Go to the source code of this file.
Typedefs | |
typedef int(* | opal_progress_callback_t )(void) |
Progress callback function typedef. More... | |
Functions | |
BEGIN_C_DECLS OPAL_DECLSPEC int | opal_progress_init (void) |
Initialize the progress engine. More... | |
OPAL_DECLSPEC int | opal_progress_finalize (void) |
Shut down the progress engine. More... | |
OPAL_DECLSPEC void | opal_progress (void) |
Progress all pending events. More... | |
OPAL_DECLSPEC int | opal_progress_set_event_flag (int flags) |
Control how the event library is called. More... | |
OPAL_DECLSPEC void | opal_progress_event_users_increment (void) |
Increase the number of users of the event library. More... | |
OPAL_DECLSPEC void | opal_progress_event_users_decrement (void) |
Decrease the number of users of the event library. More... | |
OPAL_DECLSPEC bool | opal_progress_set_yield_when_idle (bool yieldopt) |
Set whether opal_progress() should yield when idle. More... | |
OPAL_DECLSPEC void | opal_progress_set_event_poll_rate (int microseconds) |
Set time between calls into the event library. More... | |
OPAL_DECLSPEC int | opal_progress_register (opal_progress_callback_t cb) |
Register an event to be progressed. More... | |
OPAL_DECLSPEC int | opal_progress_unregister (opal_progress_callback_t cb) |
Deregister previously registered event. More... | |
static bool | opal_progress_threads (void) |
static bool | opal_progress_spin (volatile bool *complete) |
Progress until flag is true or poll iterations completed. | |
static uint32_t | opal_progress_recursion_depth (void) |
Return the current level of recursion – 0 means that we are not under an opal_progress() call at all. More... | |
Variables | |
OPAL_DECLSPEC volatile int32_t | opal_progress_thread_count |
OPAL_DECLSPEC int | opal_progress_spin_count |
OPAL_DECLSPEC uint32_t | opal_progress_recursion_depth_counter |
Progress engine for Open MPI.
typedef int(* opal_progress_callback_t)(void) |
Progress callback function typedef.
Prototype for the a progress function callback. Progress function callbacks can be registered with opal_progress_register() and deregistered with opal_progress_deregister(). It should be noted that either registering or deregistering a function callback is an extraordinarily expensive operation and should not be used for potentially short callback lifetimes.
OPAL_DECLSPEC void opal_progress | ( | void | ) |
Progress all pending events.
Progress all pending events. All registered event handlers will be called every call into opal_progress(). The event library will be called if opal_progress_event_users is greater than 0 (adjustments can be made by calling opal_progress_event_users_add() and opal_progress_event_users_delete()) or the time since the last call into the event library is greater than the progress tick rate (by default, 10ms).
References opal_atomic_add, and OPAL_THREAD_ADD32.
Referenced by mca_btl_sm_add_procs(), mca_btl_smcuda_add_procs(), mca_btl_udapl_put(), and opal_progress_spin().
OPAL_DECLSPEC void opal_progress_event_users_decrement | ( | void | ) |
Decrease the number of users of the event library.
Decrease the number of users of the event library. This count is used by opal_progress to determine if opal_event_loop() should be called every call to opal_progress() or only after a time has elapsed since the last call (by default, 10ms).
References OPAL_OUTPUT.
Referenced by mca_btl_sctp_del_procs(), mca_btl_sctp_finalize(), mca_btl_tcp_del_procs(), mca_btl_tcp_finalize(), and ompi_mpi_init().
OPAL_DECLSPEC void opal_progress_event_users_increment | ( | void | ) |
Increase the number of users of the event library.
Increase the number of users of the event library. This count is used by opal_progress to determine if opal_event_loop() should be called every call to opal_progress() or only after a time has elapsed since the last call (by default, 10ms). The count defaults to 0, meaning that opal_progress_event_users_increment() must be called at least once for the event loop to be called on every entry to opal_progress().
References OPAL_OUTPUT.
Referenced by mca_btl_sctp_add_procs(), mca_btl_tcp_add_procs(), ompi_mpi_finalize(), and opal_init().
OPAL_DECLSPEC int opal_progress_finalize | ( | void | ) |
Shut down the progress engine.
Shut down the progress engine. This includes deregistering all registered callbacks and freeing all resources. After finalize returns, no calls into the progress interface are allowed.
References opal_atomic_lock(), and opal_atomic_unlock().
Referenced by opal_finalize().
BEGIN_C_DECLS OPAL_DECLSPEC int opal_progress_init | ( | void | ) |
Initialize the progress engine.
Initialize the progress engine, including constructing the proper locks and allocating space for the progress registration functions. At this point, any function in the progress engine interface may be called.
References mca_base_param_find(), mca_base_param_lookup_int(), opal_atomic_init(), OPAL_OUTPUT, opal_output_open(), and opal_progress_set_event_poll_rate().
Referenced by opal_init().
|
inlinestatic |
Return the current level of recursion – 0 means that we are not under an opal_progress() call at all.
1 means that you're in the top-level opal_progress() function (i.e., not deep in recursion). Higher values mean that you're that many levels deep in recursion.
OPAL_DECLSPEC int opal_progress_register | ( | opal_progress_callback_t | cb | ) |
Register an event to be progressed.
Register an event to be progressed during calls to opal_progress(). Please read the note in opal_progress_callback_t.
References opal_atomic_lock(), and opal_atomic_unlock().
OPAL_DECLSPEC int opal_progress_set_event_flag | ( | int | flags | ) |
Control how the event library is called.
Adjust the flags argument used to call opal_event_loop() from opal_progress(). The default argument is OPAL_EVLOOP_ONELOOP, meaning that the call to opal_event_loop() will block pending events, but may block for a period of time.
flags | One of the valid vlags argument to opal_event_loop(). |
References OPAL_OUTPUT.
Referenced by ompi_mpi_finalize(), and ompi_mpi_init().
OPAL_DECLSPEC void opal_progress_set_event_poll_rate | ( | int | microseconds | ) |
Set time between calls into the event library.
Set time between calls into the event library when there are no users of the event library (set by opal_progress_event_users_increment() and opal_progress_event_users_decrement()).
polltime | Time (in microseconds) between calls to the event library |
References OPAL_OUTPUT.
Referenced by ompi_mpi_init(), and opal_progress_init().
OPAL_DECLSPEC bool opal_progress_set_yield_when_idle | ( | bool | yieldopt | ) |
Set whether opal_progress() should yield when idle.
Set whether opal_progress() should yield the processor (either by sched_yield() or SwitchToThread()) if no events were progressed during the progress loop. The return value of the callback functions is used to determine whether or not yielding is required. By default, the event loop will yield when the progress function is idle.
yieldopt | Whether to yield when idle. |
References OPAL_OUTPUT.
Referenced by ompi_mpi_init().
OPAL_DECLSPEC int opal_progress_unregister | ( | opal_progress_callback_t | cb | ) |
Deregister previously registered event.
Deregister an event to be progressed during calls to opal_progress(). Please read the note in opal_progress_callback_t.
References opal_atomic_lock(), and opal_atomic_unlock().