Registry for SPMD-registered objects. More...
Public Member Functions | |
bool | empty (void) const noexcept |
size_type | size (void) const noexcept |
handle_type | register_object (void *const p, const epoch_type e) |
Returns a handle associated with p in epoch e . | |
void | unregister_object (const handle_type h, const bool immediate=false) |
Unregisters the object associated with handle h . More... | |
void | commit_unregistrations (void) |
Makes all unregistered handles available. | |
void * | get_object (const handle_type h, const epoch_type e) const noexcept |
Returns a pointer to the object associated with handle h , registered in epoch e . More... | |
Public Types | |
using | handle_type = object_id |
using | epoch_type = logical_clock::time_type |
using | size_type = std::size_t |
Static Public Attributes | |
static const size_type | default_size = STAPL_RUNTIME_SPMD_REGISTRY_SIZE |
Registry for SPMD-registered objects.
The spmd_registry is an array of void*
that point to the registered objects. Handles are indices into the array, making translation an time operation.
The distributed object has to be registered in the same order in all locations of the gang, so that the handles will be created in the same order in each location.
Unregistration can happen in any order, having the drawback that all unregistrations have to be committed in the same point in the SPMD section, e.g., during an rmi_fence() call.
Although the registry will grow as needed, it is more efficient to allocate it beforehand if a known, constant number of objects will need to be registered. The size may be defined at compile time through the STAPL_RUNTIME_SPMD_REGISTRY_SIZE
macro (e.g., -DSTAPL_RUNTIME_SPMD_REGISTRY_SIZE=20
).
void stapl::runtime::spmd_registry::unregister_object | ( | const handle_type | h, |
const bool | immediate = false |
||
) |
Unregisters the object associated with handle h
.
If immediate
is false
, the handle remains unavailable until the next call to commit_unregistrations().
|
noexcept |
Returns a pointer to the object associated with handle h
, registered in epoch e
.
If e
is logical_clock::no_time, then the registration epoch of h
is not checked.