Execution context of a task or request. More...
Public Member Functions | |
| context (id const &cid, location_md &l, const process_id src_pid) | |
| Constructs a new context object from the given id and associates it with the metadata. | |
| context (location_md &l) | |
| Constructs a new context object from the given metadata. More... | |
| ~context (void) | |
| Destroys this context object. More... | |
| context (context const &)=delete | |
| context & | operator= (context const &)=delete |
| id const & | get_id (void) const noexcept |
| full_location const & | get_initiator (void) const noexcept |
| Returns the gang id and location id as a full_location object that created this context object. | |
| full_location const & | get_current_location (void) const noexcept |
| Returns the gang id and location id associated with this context as a full_location object. | |
| gang_md const & | get_gang_md (void) const noexcept |
| gang_md & | get_gang_md (void) noexcept |
| location_md const & | get_location_md (void) const noexcept |
| location_md & | get_location_md (void) noexcept |
| gang_md::id | get_gang_id (void) const noexcept |
| location_md::id | get_location_id (void) const noexcept |
| process_id | get_source_process_id (void) const noexcept |
| bool | is_intragang (void) const noexcept |
| nesting_level | get_nesting (void) const noexcept |
| bool | is_base (void) const noexcept |
| void | set_epoch (const epoch_type e) |
| Sets the epoch this context is in. More... | |
| epoch_type | get_epoch (void) const noexcept |
| void * | allocate_return (const std::size_t size) |
| Allocates space for a return value request. | |
| aggregator_type & | get_aggregator (full_location const &loc) |
| Returns a request aggregator to the given destination. More... | |
| void | flush_requests (void) |
| Flushes all aggregated requests. | |
| void | flush (void) |
| Flushes all aggregated requests and fence metadata. | |
| void | count_pending (full_location const &loc) |
| Increases the count of pending buffers. More... | |
| void | count_pending (const gang_md::id dst_gid, const unsigned int N) |
Increases the count of pending buffers by N. More... | |
| void | count_processed (void) |
| Increases the count of processed buffers. More... | |
Public Types | |
| using | id = context_id |
| using | aggregator_type = context_impl::aggregator |
| using | epoch_type = logical_clock::time_type |
Execution context of a task or request.
All tasks and requests execute within a context defined by a context object. Each context has a unique context_id object that acts as its id.
Contexts of a new execution environment are called base contexts. A base context is not created by a request and therefore it has a nesting level of 0 and mirrors the epoch of the associated location_md object.
Every other context is created as the result of executing requests and they have nesting level that is that of the request source + 1 and mirror the epoch of the calling context.
Imposing an ordering between contexts is the backbone of request ordering. Each context object is associated with a queue of requests which will execute in a FIFO order. Therefore, changing the ordering of context objects changes the request execution order.
|
explicit |
Constructs a new context object from the given metadata.
This is base context, meaning that it executes code that was not triggered by a request. It will be pushed on the stack automatically.
| stapl::runtime::context::~context | ( | void | ) |
Destroys this context object.
All requests and metadata will be flushed. In the case that it was a base context, then it will be removed from the stack automatically.
| void stapl::runtime::context::set_epoch | ( | const epoch_type | e | ) |
Sets the epoch this context is in.
If epoch differs from the previous, requests will be flushed.
| aggregator_type& stapl::runtime::context::get_aggregator | ( | full_location const & | loc | ) |
Returns a request aggregator to the given destination.
The aggregator from the previous call to get_aggregator() is memoized unless flush() has been called.
| void stapl::runtime::context::count_pending | ( | full_location const & | loc | ) |
Increases the count of pending buffers.
This function is called when the destination of the requests in the buffer is loc.
| void stapl::runtime::context::count_pending | ( | const gang_md::id | dst_gid, |
| const unsigned int | N | ||
| ) |
Increases the count of pending buffers by N.
This function is called when the destination of the requests in the buffer is some or all locations in gang dst_gid.
| void stapl::runtime::context::count_processed | ( | void | ) |
Increases the count of processed buffers.
This function flushes the buffer containing return values, since blocking calls may be waiting for them.
1.8.13