ARGOBOTS
Functions
Scheduler

Functions

int ABT_sched_create (ABT_sched_def *def, int num_pools, ABT_pool *pools, ABT_sched_config config, ABT_sched *newsched)
 Create a new user-defined scheduler and return its handle through newsched. More...
 
int ABT_sched_create_basic (ABT_sched_predef predef, int num_pools, ABT_pool *pools, ABT_sched_config config, ABT_sched *newsched)
 Create a predefined scheduler. More...
 
int ABT_sched_free (ABT_sched *sched)
 Release the scheduler object associated with sched handle. More...
 
int ABT_sched_get_num_pools (ABT_sched sched, int *num_pools)
 Get the number of pools associated with scheduler. More...
 
int ABT_sched_get_pools (ABT_sched sched, int max_pools, int idx, ABT_pool *pools)
 Get the pools of the scheduler sched. More...
 
int ABT_sched_finish (ABT_sched sched)
 Ask a scheduler to finish. More...
 
int ABT_sched_exit (ABT_sched sched)
 Ask a scheduler to stop as soon as possible. More...
 
int ABT_sched_has_to_stop (ABT_sched sched, ABT_bool *stop)
 Check if the scheduler needs to stop. More...
 
int ABT_sched_set_data (ABT_sched sched, void *data)
 Set the specific data of the target user-defined scheduler. More...
 
int ABT_sched_get_data (ABT_sched sched, void **data)
 Retrieve the specific data of the target user-defined scheduler. More...
 
int ABT_sched_get_size (ABT_sched sched, size_t *size)
 Get the sum of the sizes of the pool of sched. More...
 
int ABT_sched_get_total_size (ABT_sched sched, size_t *size)
 Get the sum of the sizes of the pool of sched. More...
 

Detailed Description

This group is for Scheduler.

Function Documentation

int ABT_sched_create ( ABT_sched_def def,
int  num_pools,
ABT_pool pools,
ABT_sched_config  config,
ABT_sched newsched 
)

Create a new user-defined scheduler and return its handle through newsched.

The pools used by the new scheduler are provided by pools. The contents of this array is copied, so it can be freed. If a pool in the array is ABT_POOL_NULL, the corresponding pool is automatically created. The config must have been created by ABT_sched_config_create, and will be used as argument in the initialization. If no specific configuration is required, the parameter will be ABT_CONFIG_NULL.

Parameters
[in]defdefinition required for scheduler creation
[in]num_poolsnumber of pools associated with this scheduler
[in]poolspools associated with this scheduler
[in]configspecific config used during the scheduler creation
[out]newschedhandle to a new scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 36 of file sched.c.

int ABT_sched_create_basic ( ABT_sched_predef  predef,
int  num_pools,
ABT_pool pools,
ABT_sched_config  config,
ABT_sched newsched 
)

Create a predefined scheduler.

ABT_sched_create_basic() creates a predefined scheduler and returns its handle through newsched. The pools used by the new scheduler are provided by pools. The contents of this array is copied, so it can be freed. If a pool in the array is ABT_POOL_NULL, the corresponding pool is automatically created. The pool array can be NULL. In this case, all the pools will be created automatically. The config must have been created by ABT_sched_config_create(), and will be used as argument in the initialization. If no specific configuration is required, the parameter can be ABT_CONFIG_NULL.

NOTE: The new scheduler will be automatically freed when it is not used anymore or its associated ES is terminated. Accordingly, the pools associated with the new scheduler will be automatically freed if they are exclusive to the scheduler and are not user-defined ones (i.e., created by ABT_pool_create_basic() or implicitly created because pools is NULL or a pool in the pools array is ABT_POOL_NULL). If the pools were created using ABT_pool_create() by the user, they have to be freed explicitly with ABT_pool_free().

Parameters
[in]predefpredefined scheduler
[in]num_poolsnumber of pools associated with this scheduler
[in]poolspools associated with this scheduler
[in]configspecific config used during the scheduler creation
[out]newschedhandle to a new scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 93 of file sched.c.

int ABT_sched_exit ( ABT_sched  sched)

Ask a scheduler to stop as soon as possible.

The scheduler will stop even if its pools are not empty. It is the user's responsibility to ensure that the left work will be done by another scheduler.

Parameters
[in]schedhandle to the target scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 252 of file sched.c.

int ABT_sched_finish ( ABT_sched  sched)

Ask a scheduler to finish.

The scheduler will stop when its pools will be empty.

Parameters
[in]schedhandle to the target scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 223 of file sched.c.

int ABT_sched_free ( ABT_sched sched)

Release the scheduler object associated with sched handle.

If this routine successfully returns, sched is set as ABT_SCHED_NULL. The scheduler will be automatically freed. If sched is currently being used by an ES or in a pool, freeing sched is not allowed. In this case, this routine fails and returns ABT_ERR_SCHED.

Parameters
[in,out]schedhandle to the target scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 127 of file sched.c.

int ABT_sched_get_data ( ABT_sched  sched,
void **  data 
)

Retrieve the specific data of the target user-defined scheduler.

This function will be called by the user in a user-defined function of his user-defined scheduler.

Parameters
[in]schedhandle to the scheduler
[out]dataspecific data of the scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 404 of file sched.c.

int ABT_sched_get_num_pools ( ABT_sched  sched,
int *  num_pools 
)

Get the number of pools associated with scheduler.

ABT_sched_get_num_pools returns the number of pools associated with the target scheduler sched through num_pools.

Parameters
[in]schedhandle to the target scheduler
[out]num_poolsthe number of all pools associated with sched
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_INV_SCHEDinvalid scheduler

Definition at line 162 of file sched.c.

int ABT_sched_get_pools ( ABT_sched  sched,
int  max_pools,
int  idx,
ABT_pool pools 
)

Get the pools of the scheduler sched.

Parameters
[in]schedhandle to the target scheduler
[in]max_poolsmaximum number of pools to get
[in]idxindex of the first pool to get
[out]poolsarray of handles to the pools
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 190 of file sched.c.

int ABT_sched_get_size ( ABT_sched  sched,
size_t *  size 
)

Get the sum of the sizes of the pool of sched.

The size does not include the blocked and migrating ULTs.

Parameters
[in]schedhandle to the scheduler
[out]sizetotal number of work units
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 432 of file sched.c.

int ABT_sched_get_total_size ( ABT_sched  sched,
size_t *  size 
)

Get the sum of the sizes of the pool of sched.

The size includes the blocked and migrating ULTs.

Parameters
[in]schedhandle to the scheduler
[out]sizetotal number of work units
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 475 of file sched.c.

int ABT_sched_has_to_stop ( ABT_sched  sched,
ABT_bool stop 
)

Check if the scheduler needs to stop.

Check if there has been an exit or a finish request and if the conditions are respected (empty pool for a finish request). If we are on the primary ES, we will jump back to the main ULT, if the scheduler has nothing to do.

It is the user's responsibility to take proper measures to stop the scheduling loop, depending on the value given by stop.

Parameters
[in]schedhandle to the target scheduler
[out]stopindicate if the scheduler has to stop
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 285 of file sched.c.

int ABT_sched_set_data ( ABT_sched  sched,
void *  data 
)

Set the specific data of the target user-defined scheduler.

This function will be called by the user during the initialization of his user-defined scheduler.

Parameters
[in]schedhandle to the scheduler
[in]dataspecific data of the scheduler
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 377 of file sched.c.