STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Classes | Public Member Functions | Static Public Member Functions | Public Types
stapl::runtime::runqueue Class Reference

Queue for scheduling requests. More...

Classes

class  impl
 Location RMI and RPC runqueue. More...
 
struct  lock_type
 Locks the runqueue at construction, unlocks at destruction. More...
 

Public Member Functions

 runqueue (void *, location_md &)
 
 runqueue (runqueue const &)=delete
 
runqueueoperator= (runqueue const &)=delete
 
implget_impl (void) noexcept
 
unsigned int yield_intensity (void) const noexcept
 Returns a positive integer with how intense yielding will be, or 0 if yielding should be avoided.
 
void fence_enter (void)
 Notifies that the location entered a fence.
 
void fence_exit (const epoch_type)
 Notifies that the location exited a fence.
 
void advance_epoch (const epoch_type)
 Make runnable anything that was blocked because of future epoch.
 
void undefer_requests (void)
 
void defer_requests (void)
 
bool try_defer_requests (void)
 

Static Public Member Functions

static void initialize (option const &opts)
 Sets up the process. More...
 
static void finalize (void)
 Tears-down the process.
 
static process_id get_process_id (void) noexcept
 Returns the current process id.
 
static size_type get_num_processes (void) noexcept
 Returns the number of processes.
 
static void exit (int exit_code)
 Exits with exit code exit_code. More...
 
static void set_overloaded (const bool) noexcept
 Receives notification that the process is overloaded.
 
static void add (const process_id pid, message_ptr m)
 Schedules the requests in m to execute in process pid. More...
 
static void add_all (process_id_range r, message_ptr m)
 Schedules the requests in m to execute in the processes in range r. More...
 
static void add (gang_md &g, const location_id lid, const bool on_shmem, message_ptr m)
 Schedules the requests in m to execute in the location lid of gang g. More...
 
static void add_managed (gang_md &g, location_id_range r, const bool ordered, message_ptr m)
 Schedules the requests in m to execute in the range r of locally managed locations of gang g. More...
 
static void add_all (gang_md &g, const bool ordered, message_ptr m)
 Schedules the requests in m to execute in all locations of the gang g. More...
 
static void forward (const gang_id gid, message_ptr m)
 Forwards the requests to the owner of the gang with id gid. More...
 
static void yield (const unsigned int intensity=2)
 Yields to the runqueue and executes all requests that are pending. More...
 
static void wait (std::function< bool(void)> const &pred)
 Yields to the runqueue, informing it that the caller is blocked until pred returns true. More...
 
static std::size_t required_size (void) noexcept
 
static std::size_t required_alignment (void) noexcept
 

Public Types

enum  yield_status { YIELDED, IDLE_CANNOT_BLOCK, IDLE_CAN_BLOCK }
 Status of the yield call. More...
 
using size_type = process_id
 
using epoch_type = logical_clock::time_type
 
using location_id_range = any_range< location_id >
 
using process_id_range = any_range< process_id >
 

Detailed Description

Queue for scheduling requests.

The static functions are the entry point for all remote calls. They are well-known function pointers that they can be used to schedule requests in any process.

Member Enumeration Documentation

◆ yield_status

Status of the yield call.

Enumerator
YIELDED 

Caller has yielded.

IDLE_CANNOT_BLOCK 

Caller has not yielded and cannot block.

IDLE_CAN_BLOCK 

Caller has not yielded and can block.

Member Function Documentation

◆ initialize()

void stapl::runtime::runqueue::initialize ( option const &  opts)
static

Sets up the process.

Parameters
optsoption object to initialize the environment with.

◆ exit()

void stapl::runtime::runqueue::exit ( int  exit_code)
static

Exits with exit code exit_code.

◆ add() [1/2]

void stapl::runtime::runqueue::add ( const process_id  pid,
message_ptr  m 
)
static

Schedules the requests in m to execute in process pid.

Warning
The current process id cannot be pid.

◆ add_all() [1/2]

void stapl::runtime::runqueue::add_all ( process_id_range  r,
message_ptr  m 
)
static

Schedules the requests in m to execute in the processes in range r.

Warning
The current process id cannot be in the range v.

◆ add() [2/2]

void stapl::runtime::runqueue::add ( gang_md g,
const location_id  lid,
const bool  on_shmem,
message_ptr  m 
)
static

Schedules the requests in m to execute in the location lid of gang g.

on_shmem defines if the requests' source and destination are on shared memory.

◆ add_managed()

void stapl::runtime::runqueue::add_managed ( gang_md g,
location_id_range  r,
const bool  ordered,
message_ptr  m 
)
static

Schedules the requests in m to execute in the range r of locally managed locations of gang g.

If r is empty, then m is scheduled on all locally managed locations.

Warning
All the locations in r have to be in the current process.

◆ add_all() [2/2]

void stapl::runtime::runqueue::add_all ( gang_md g,
const bool  ordered,
message_ptr  m 
)
static

Schedules the requests in m to execute in all locations of the gang g.

◆ forward()

void stapl::runtime::runqueue::forward ( const gang_id  gid,
message_ptr  m 
)
static

Forwards the requests to the owner of the gang with id gid.

Warning
This function always forwards to the gang id owner, even if the metadata is locally available. This may degrade performance.

◆ yield()

void stapl::runtime::runqueue::yield ( const unsigned int  intensity = 2)
static

Yields to the runqueue and executes all requests that are pending.

Parameters
intensityA positive number indicating how intense yielding should be.

◆ wait()

void stapl::runtime::runqueue::wait ( std::function< bool(void)> const &  pred)
static

Yields to the runqueue, informing it that the caller is blocked until pred returns true.

A backoff algorithm guarantees that contention will be minimized when multiple threads call this function. When contention is detected, then the caller will avoid concurrency::hardware_concurrency() times to declare itself as leader, therefore it will avoid any calls to the communication layer.

Parameters
predPredicate to satisfy before exiting the function.

The documentation for this class was generated from the following files: