ARGOBOTS
1.1
|
This group is for Execution Stream. More...
Typedefs | |
typedef struct ABT_xstream_opaque * | ABT_xstream |
Execution stream handle type. More... | |
typedef enum ABT_xstream_state | ABT_xstream_state |
Execution stream state type. More... | |
Enumerations | |
enum | ABT_xstream_state { ABT_XSTREAM_STATE_RUNNING, ABT_XSTREAM_STATE_TERMINATED } |
State of an execution stream. More... | |
Functions | |
int | ABT_xstream_create (ABT_sched sched, ABT_xstream *newxstream) |
Create a new execution stream. More... | |
int | ABT_xstream_create_basic (ABT_sched_predef predef, int num_pools, ABT_pool *pools, ABT_sched_config config, ABT_xstream *newxstream) |
Create a new execution stream with a predefined scheduler. More... | |
int | ABT_xstream_create_with_rank (ABT_sched sched, int rank, ABT_xstream *newxstream) |
Create a new execution stream with a specific rank. More... | |
int | ABT_xstream_revive (ABT_xstream xstream) |
Revive a terminated execution stream. More... | |
int | ABT_xstream_free (ABT_xstream *xstream) |
Free an execution stream. More... | |
int | ABT_xstream_join (ABT_xstream xstream) |
Wait for an execution stream to terminate. More... | |
int | ABT_xstream_exit (void) |
Terminate an execution stream that is running the calling ULT. More... | |
int | ABT_xstream_cancel (ABT_xstream xstream) |
Send a cancellation request to an execution stream. More... | |
int | ABT_xstream_self (ABT_xstream *xstream) |
Get an execution stream that is running the calling work unit. More... | |
int | ABT_xstream_self_rank (int *rank) |
Return a rank of an execution stream associated with a caller. More... | |
int | ABT_xstream_set_rank (ABT_xstream xstream, int rank) |
Set a rank for an execution stream. More... | |
int | ABT_xstream_get_rank (ABT_xstream xstream, int *rank) |
Retrieve a rank of an execution stream. More... | |
int | ABT_xstream_set_main_sched (ABT_xstream xstream, ABT_sched sched) |
Set the main scheduler of an execution stream. More... | |
int | ABT_xstream_set_main_sched_basic (ABT_xstream xstream, ABT_sched_predef predef, int num_pools, ABT_pool *pools) |
Set the main scheduler of an execution stream to a predefined scheduler. More... | |
int | ABT_xstream_get_main_sched (ABT_xstream xstream, ABT_sched *sched) |
Retrieve the main scheduler of an execution stream. More... | |
int | ABT_xstream_get_main_pools (ABT_xstream xstream, int max_pools, ABT_pool *pools) |
Get pools associated with the main scheduler of an execution stream. More... | |
int | ABT_xstream_get_state (ABT_xstream xstream, ABT_xstream_state *state) |
Get a state of an execution stream. More... | |
int | ABT_xstream_equal (ABT_xstream xstream1, ABT_xstream xstream2, ABT_bool *result) |
Compare two execution stream handles for equality. More... | |
int | ABT_xstream_get_num (int *num_xstreams) |
Get the number of current existing execution streams. More... | |
int | ABT_xstream_is_primary (ABT_xstream xstream, ABT_bool *is_primary) |
Check if the target execution stream is primary. More... | |
int | ABT_xstream_run_unit (ABT_unit unit, ABT_pool pool) |
Execute a work unit. More... | |
int | ABT_xstream_check_events (ABT_sched sched) |
Process events associated with a scheduler. More... | |
int | ABT_xstream_set_cpubind (ABT_xstream xstream, int cpuid) |
Bind an execution stream to a target CPU. More... | |
int | ABT_xstream_get_cpubind (ABT_xstream xstream, int *cpuid) |
Get CPU ID of a CPU to which an execution stream is bound. More... | |
int | ABT_xstream_set_affinity (ABT_xstream xstream, int num_cpuids, int *cpuids) |
Bind an execution stream to target CPUs. More... | |
int | ABT_xstream_get_affinity (ABT_xstream xstream, int max_cpuids, int *cpuids, int *num_cpuids) |
Get CPU IDs of CPUs to which an execution stream is bound. More... | |
This group is for Execution Stream.
typedef struct ABT_xstream_opaque* ABT_xstream |
typedef enum ABT_xstream_state ABT_xstream_state |
enum ABT_xstream_state |
int ABT_xstream_cancel | ( | ABT_xstream | xstream | ) |
Send a cancellation request to an execution stream.
ABT_xstream_cancel()
sends a cancellation request to the execution stream xstream
. An execution stream that receives a cancellation request will terminate.
Requests for execution streams are updated atomically.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is the primary execution stream.xstream
is not running, the results are undefined.[in] | xstream | execution stream handle |
int ABT_xstream_check_events | ( | ABT_sched | sched | ) |
Process events associated with a scheduler.
ABT_xstream_check_events()
processes events associated with the scheduler sched
. The calling work unit must be associated with sched
.
This routine must be called by a scheduler periodically. For example, a user-defined scheduler should call this routine every N iterations of its scheduling loop.
ABT_ERR_UNINITIALIZED
if Argobots is not initialized.sched
. Argobots must be initialized. This routine may switch the context of the calling ULT.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_SCHED
is returned if sched
is ABT_SCHED_NULL
.ABT_ERR_INV_THREAD
is returned if a work unit associated with sched
is not the caller.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.sched
is accessed concurrently, the results are undefined.[in] | sched | scheduler handle |
int ABT_xstream_create | ( | ABT_sched | sched, |
ABT_xstream * | newxstream | ||
) |
Create a new execution stream.
ABT_xstream_create()
creates a new execution stream with the scheduler sched
and returns its handle through newxstream
. If sched
is ABT_SCHED_NULL
, the default scheduler with a basic FIFO queue and the default scheduler configuration is used.
ABT_sched_create()
.ABT_pool_create()
.ABT_sched_config_create()
.If sched
is not ABT_SCHED_NULL
, the user may not reuse sched
to create another execution stream. If sched
is not configured to be automatically freed, it is the user's responsibility to free sched
after newxstream
is freed.
newxstream
must be freed by ABT_xstream_free()
after its use.
[Argobots 1.x] ABT_ERR_INV_SCHED
is returned if this routine finds sched
is already used.
[Argobots 2.0] The results of this routine are undefined if sched
is already used.
sched
is not used. Note that Argobots 1.x does not perform this check atomically, so the user may not concurrently call any routines that attempt to use the same scheduler by assuming that only one of them would succeed. [Argobots 1.x] newxstream
is set to ABT_XSTREAM_NULL
if an error occurs.
[Argobots 2.0] newxstream
is not updated if an error occurs.
newxstream
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.ABT_ERR_INV_SCHED
is returned if sched
is being used.newxstream
is NULL
, the results are undefined.sched
is being used, the results are undefined.[in] | sched | scheduler handle for newxstream |
[out] | newxstream | execution stream handle |
int ABT_xstream_create_basic | ( | ABT_sched_predef | predef, |
int | num_pools, | ||
ABT_pool * | pools, | ||
ABT_sched_config | config, | ||
ABT_xstream * | newxstream | ||
) |
Create a new execution stream with a predefined scheduler.
ABT_xstream_create_basic() creates a new execution stream with the predefined scheduler predef
and returns its handle through newxstream
. The functionality provided by this routine is the same as the combination of ABT_sched_create_basic()
and ABT_xstream_create()
.
Please see ABT_sched_create_basic()
and ABT_xstream_create()
for details.
newxstream
must be freed by ABT_xstream_free()
after its use.
newxstream
is set to ABT_XSTREAM_NULL
if an error occurs.newxstream
is not updated if an error occurs. newxstream
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_ARG
is returned if num_pools
is negative.ABT_ERR_INV_ARG
is returned if predef
is not a valid predefined scheduler type.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.num_pools
is positive and pools
is NULL
, the results are undefined.newxstream
is NULL
, the results are undefined.[in] | predef | predefined scheduler |
[in] | num_pools | number of pools associated with the scheduler |
[in] | pools | pools associated with the scheduler |
[in] | config | scheduler config for scheduler creation |
[out] | newxstream | execution stream handle |
int ABT_xstream_create_with_rank | ( | ABT_sched | sched, |
int | rank, | ||
ABT_xstream * | newxstream | ||
) |
Create a new execution stream with a specific rank.
ABT_xstream_create_with_rank()
creates a new execution stream with the scheduler sched
and returns its handle through newxstream
. If sched
is ABT_SCHED_NULL
, the default scheduler with a basic FIFO queue and the default scheduler configuration is used.
ABT_sched_create()
.ABT_pool_create()
.ABT_sched_config_create()
.If sched
is not ABT_SCHED_NULL
, the user may not reuse sched
to create another execution stream. If sched
is not configured to be automatically freed, it is the user's responsibility to free sched
after newxstream
is freed.
This routine allocates the rank rank
for newxstream
. rank
must be non-negative and not used by another execution stream.
Management of ranks of execution streams is performed atomically.
newxstream
must be freed by ABT_xstream_free()
after its use.
[Argobots 1.x] ABT_ERR_INV_SCHED
is returned if this routine finds sched
is already used.
[Argobots 2.0] The results of this routine are undefined if sched
is already used.
sched
is not used. Note that Argobots 1.x does not perform this check atomically, so the user may not concurrently call any routines that attempt to use the same scheduler by assuming that only one of them would succeed. [Argobots 1.x] newxstream
is set to ABT_XSTREAM_NULL
if an error occurs.
[Argobots 2.0] newxstream
is not updated if an error occurs.
newxstream
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM_RANK
is returned if rank
is negative.ABT_ERR_INV_XSTREAM_RANK
is returned if rank
has been used by another execution stream.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.ABT_ERR_INV_SCHED
is returned if sched
is being used.newxstream
is NULL
, the results are undefined.sched
is being used, the results are undefined.[in] | sched | scheduler handle for newxstream |
[in] | rank | execution stream rank |
[out] | newxstream | execution stream handle |
int ABT_xstream_equal | ( | ABT_xstream | xstream1, |
ABT_xstream | xstream2, | ||
ABT_bool * | result | ||
) |
Compare two execution stream handles for equality.
ABT_xstream_equal()
compares two execution stream handles xstream1
and xstream2
for equality and returns the result through result
.
This function is deprecated since its behavior is the same as comparing values of xstream1
and xstream2
.
ABT_SUCCESS
is returned if this routine succeeds.result
is NULL
, the results are undefined.[in] | xstream1 | execution stream handle 1 |
[in] | xstream2 | execution stream handle 2 |
[out] | result | result (ABT_TRUE: same, ABT_FALSE: not same) |
int ABT_xstream_exit | ( | void | ) |
Terminate an execution stream that is running the calling ULT.
ABT_xstream_exit()
sends a cancellation request to the execution stream that is running the calling ULT and terminates the calling ULT. This routine does not return if it succeeds. An execution stream that receives a cancellation request will terminate.
Requests for execution streams are updated atomically.
ABT_ERR_UNINITIALIZED
if Argobots is not initialized.ABT_ERR_INV_THREAD
is returned if the caller is a tasklet.ABT_ERR_INV_THREAD
is returned if the caller is the primary ULT.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_XSTREAM
is returned if an execution stream that is running the calling ULT is the primary execution stream.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.int ABT_xstream_free | ( | ABT_xstream * | xstream | ) |
Free an execution stream.
ABT_xstream_free()
deallocates the resource used for the execution stream xstream
and sets xstream
to ABT_XSTREAM_NULL
. If xstream
is still running, this routine will be blocked on xstream
until xstream
terminates.
Management of states of execution streams is performed atomically.
xstream
by ABT_xstream_join()
and ABT_xstream_free()
.ABT_SUCCESS
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
points to ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is the primary execution stream.ABT_ERR_INV_XSTREAM
is returned if xstream
is running the calling work unit.xstream
is NULL
, the results are undefined.xstream
is blocked on by a caller of ABT_xstream_join()
or ABT_xstream_free()
, the results are undefined.xstream
is accessed after calling this routine, the results are undefined.[in,out] | xstream | execution stream handle |
int ABT_xstream_get_affinity | ( | ABT_xstream | xstream, |
int | max_cpuids, | ||
int * | cpuids, | ||
int * | num_cpuids | ||
) |
Get CPU IDs of CPUs to which an execution stream is bound.
ABT_xstream_get_affinity()
returns the CPU IDs of CPUs to which the execution stream xstream
is bound through cpuids
and num_cpuids
.
If max_cpuids
is positive, this routine writes at most max_cpuids
CPU IDs to cpuids
. If xstream
is not bound to any CPU, cpuids
is not updated.
cpuids
until a total max_cpuids
elements have been written to cpuids
. The remaining elements of cpuids
that are not written by this routine are unmodified.If num_cpuids
is not NULL
, this routine returns the number of CPUs to which xstream
is bound through num_cpuids
. If xstream
is not bound to any CPU, num_cpus
is set to zero.
ABT_ERR_FEATURE_NA
is returned if xstream
is not bound to any CPU.ABT_ERR_CPUID
is returned if xstream
is not bound to any CPU. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_ARG
is returned if max_cpuids
is negative.ABT_ERR_SYS
is returned if an error occurs in binding the execution stream.ABT_ERR_FEATURE_NA
is returned if the affinity feature is not supported.ABT_ERR_FEATURE_NA
is returned if xstream
is not bound to any CPU.ABT_ERR_CPUID
is returned if xstream
is not bound to any CPU.max_cpuids
is positive and cpuids
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[in] | max_cpuids | the number of cpuids entries |
[out] | cpuids | array of CPU IDs |
[out] | num_cpuids | the number of total CPU IDs |
int ABT_xstream_get_cpubind | ( | ABT_xstream | xstream, |
int * | cpuid | ||
) |
Get CPU ID of a CPU to which an execution stream is bound.
ABT_xstream_get_cpubind()
returns the CPU ID of a CPU to which the execution stream xstream
is bound through cpuid
. If xstream
is bound to more than one CPU, cpuid
is set to one of the CPU IDs.
ABT_ERR_FEATURE_NA
is returned if xstream
is not bound to any CPU.ABT_ERR_CPUID
is returned if xstream
is not bound to any CPU. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_SYS
is returned if an error occurs in binding the execution stream.ABT_ERR_FEATURE_NA
is returned if the affinity feature is not supported.ABT_ERR_FEATURE_NA
is returned if xstream
is not bound to any CPU.ABT_ERR_CPUID
is returned if xstream
is not bound to any CPU.cpuid
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[out] | cpuid | CPU ID |
int ABT_xstream_get_main_pools | ( | ABT_xstream | xstream, |
int | max_pools, | ||
ABT_pool * | pools | ||
) |
Get pools associated with the main scheduler of an execution stream.
ABT_xstream_get_main_pools()
sets the pools pools
to at maximum max_pools
pools associated with the main scheduler of the execution stream xstream
.
pools
until a total max_pools
elements have been written to pools
. The remaining elements of pools
that are not written by this routine are unmodified.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_ARG
is returned if max_pools
is negative.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.max_pools
is positive and pools
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[in] | max_pools | maximum number of pools |
[out] | pools | array of handles to the pools |
int ABT_xstream_get_main_sched | ( | ABT_xstream | xstream, |
ABT_sched * | sched | ||
) |
Retrieve the main scheduler of an execution stream.
ABT_xstream_get_main_sched()
returns the main scheduler of the execution stream xstream
through sched
.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.sched
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[out] | sched | scheduler handle |
int ABT_xstream_get_num | ( | int * | num_xstreams | ) |
Get the number of current existing execution streams.
ABT_xstream_get_num()
returns the number of execution streams that exist in the Argobots execution environment through num_xstreams
. This routine counts both running and terminated execution streams.
[Argobots 1.x] This routine returns ABT_ERR_UNINITIALIZED
if Argobots is not initialized.
[Argobots 2.0] The results of this routine are undefined if Argobots is not initialized.
[Argobots 1.x] num_xstreams
is set to zero if an error occurs.
[Argobots 2.0] num_xstreams
is not updated if an error occurs.
num_xstreams
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.num_xstreams
is NULL
, the results are undefined.[out] | num_xstreams | the number of execution streams |
int ABT_xstream_get_rank | ( | ABT_xstream | xstream, |
int * | rank | ||
) |
Retrieve a rank of an execution stream.
ABT_xstream_get_rank()
returns a rank of the execution stream xstream
through rank
.
Management of ranks of execution streams is performed atomically.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.rank
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[out] | rank | execution stream rank |
int ABT_xstream_get_state | ( | ABT_xstream | xstream, |
ABT_xstream_state * | state | ||
) |
Get a state of an execution stream.
ABT_xstream_get_state()
returns the state of the execution stream xstream
through state
.
Management of states of execution streams is performed atomically.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.state
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[out] | state | state of xstream |
int ABT_xstream_is_primary | ( | ABT_xstream | xstream, |
ABT_bool * | is_primary | ||
) |
Check if the target execution stream is primary.
ABT_xstream_is_primary()
checks if the execution stream xstream
is the primary execution stream and returns the result through is_primary
. If xstream
is the primary execution stream, is_primary
is set to ABT_TRUE
. Otherwise, is_primary
is set to ABT_FALSE
.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.is_primary
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[out] | is_primary | result (ABT_TRUE: primary, ABT_FALSE: not) |
int ABT_xstream_join | ( | ABT_xstream | xstream | ) |
Wait for an execution stream to terminate.
The caller of ABT_thread_join()
waits for the execution stream xstream
until xstream
terminates.
Management of states of execution streams is performed atomically.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is the primary execution stream.ABT_ERR_INV_XSTREAM
is returned if xstream
is running the calling work unit.xstream
is blocked on by a caller of ABT_xstream_join()
or ABT_xstream_free()
, the results are undefined.xstream
is accessed concurrently, the results are undefined.[in] | xstream | execution stream handle |
int ABT_xstream_revive | ( | ABT_xstream | xstream | ) |
Revive a terminated execution stream.
ABT_xstream_revive()
revives the execution stream xstream
that has been terminated by ABT_xstream_join()
. xstream
starts to run immediately.
Management of states of execution streams is performed atomically.
xstream
may not be an execution stream that has been freed by ABT_xstream_free()
. An execution stream that is blocked on by a caller of ABT_xstream_free()
may not be revived.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is not terminated.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.xstream
is blocked on by a caller of ABT_xstream_free()
, the results are undefined.xstream
is accessed concurrently, the results are undefined.[in] | xstream | execution stream handle |
Execute a work unit.
ABT_xstream_run_unit()
associates the work unit unit
with the pool pool
and runs unit
as a child ULT on the calling ULT, which becomes a parent ULT. The calling ULT will be resumed when unit
finishes or yields.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_THREAD
is returned if the caller is a tasklet.ABT_ERR_INV_UNIT
is returned if unit
is ABT_UNIT_NULL
.ABT_ERR_INV_POOL
is returned if pool
is ABT_POOL_NULL
.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.ABT_ERR_UNIT
is returned if u_create_from_thread()
fails.unit
is not ready, the results are undefined.[in] | unit | unit handle |
[in] | pool | pool handle |
int ABT_xstream_self | ( | ABT_xstream * | xstream | ) |
Get an execution stream that is running the calling work unit.
ABT_xstream_self()
returns the handle of the execution stream that is running the calling work unit through xstream
.
ABT_self_get_xstream()
in the future.[Argobots 1.x] This routine returns ABT_ERR_UNINITIALIZED
if Argobots is not initialized.
[Argobots 2.0] The results of this routine are undefined if Argobots is not initialized.
[Argobots 1.x] xstream
is set to ABT_XSTREAM_NULL
if an error occurs.
[Argobots 2.0] xstream
is not updated if an error occurs.
xstream
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.xstream
is NULL
, the results are undefined.[out] | xstream | execution stream handle |
int ABT_xstream_self_rank | ( | int * | rank | ) |
Return a rank of an execution stream associated with a caller.
ABT_xstream_self_rank()
returns the rank of the execution stream that is running the calling work unit through rank
.
ABT_self_get_xstream_rank()
in the future.ABT_ERR_UNINITIALIZED
if Argobots is not initialized.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.rank
is NULL
, the results are undefined.[out] | rank | execution stream rank |
int ABT_xstream_set_affinity | ( | ABT_xstream | xstream, |
int | num_cpuids, | ||
int * | cpuids | ||
) |
Bind an execution stream to target CPUs.
ABT_xstream_set_affinity()
updates the CPU binding of the execution stream xstream
. If num_cpuids
is positive, this routine binds xstream
to CPUs that are corresponding to cpuids
that has num_cpuids
CPU IDs. If num_cpuids
is zero, this routine resets the CPU binding of xstream
.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_ARG
is returned if num_cpuids
is negative.ABT_ERR_SYS
is returned if an error occurs in binding the execution stream.ABT_ERR_CPUID
is returned if any of cpuids
is an invalid CPU ID.ABT_ERR_FEATURE_NA
is returned if the affinity feature is not supported.num_cpuids
is positive and cpuids
is NULL
, the results are undefined.xstream
is accessed concurrently, the results are undefined.[in] | xstream | execution stream handle |
[in] | num_cpuids | the number of cpuids entries |
[in] | cpuids | array of CPU IDs |
int ABT_xstream_set_cpubind | ( | ABT_xstream | xstream, |
int | cpuid | ||
) |
Bind an execution stream to a target CPU.
ABT_xstream_set_cpubind()
binds the execution stream xstream
to a CPU that is corresponding to the CPU ID cpuid
.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_SYS
is returned if an error occurs in binding the execution stream.ABT_ERR_CPUID
is returned if cpuid
is an invalid CPU ID.ABT_ERR_FEATURE_NA
is returned if the affinity feature is not supported.xstream
is accessed concurrently, the results are undefined.[in] | xstream | execution stream handle |
[in] | cpuid | CPU ID |
int ABT_xstream_set_main_sched | ( | ABT_xstream | xstream, |
ABT_sched | sched | ||
) |
Set the main scheduler of an execution stream.
ABT_xstream_set_main_sched()
sets sched
as the main scheduler of the execution stream xstream
. The old scheduler associated with xstream
will be freed if it is configured to be automatically freed.
The caller must be a ULT.
This routine works in the following two cases:
If xstream
is terminated:
This routine updates the main scheduler of xstream
to sched
. sched
will be used when xstream
is revived.
If xstream
is running:
The caller must be running on the main scheduler of xstream
. The caller will be associated with the first pool of the scheduler. It is the user's responsibility to handle work units in pools associated with the old main scheduler.
If sched
is ABT_SCHED_NULL
, the default basic scheduler with the default scheduler configuration will be created.
ABT_sched_create()
.ABT_sched_config_create()
.[Argobots 1.0] If pools associated with the current main scheduler of xstream
are not empty, ABT_ERR_XSTREAM
is returned.
[Argobots 1.1] This routine works even if pools associated with the current main scheduler of xstream
are not empty.
[Argobots 1.0] If a pool access violation happens regarding an access type of a pool, an error is returned.
[Argobots 1.1] If a pool access violation happens regarding an access type of a pool, the results of this routine are undefined.
[Argobots 1.x] ABT_ERR_XSTREAM_STATE
is returned if the caller is not running on xstream
while xstream
is running.
[Argobots 2.0] ABT_ERR_INV_XSTREAM
is returned if the caller is not running on xstream
while xstream
is running.
[Argobots 1.x] ABT_ERR_INV_SCHED
is returned if this routine finds sched
is already used.
[Argobots 2.0] The results of this routine are undefined if sched
is already used.
sched
is not used. Note that Argobots 1.x does not perform this check atomically, so the user may not concurrently call any routines that attempt to use the same scheduler by assuming that only one of them would succeed. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_THREAD
is returned if the caller is a tasklet.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_MEM
is returned if memory allocation fails. This error is returned only when sched
is ABT_SCHED_NULL
.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs. This error is returned only when sched
is ABT_SCHED_NULL
.ABT_ERR_INV_SCHED
is returned if sched
is not ABT_SCHED_NULL
and sched
is being used.ABT_ERR_XSTREAM_STATE
is returned if xstream
is running and xstream
is running the calling work unit.ABT_ERR_INV_XSTREAM
is returned if xstream
is running and xstream
is running the calling work unit.sched
is accessed concurrently, the results are undefined.xstream
is accessed concurrently, the results are undefined.xstream
is accessed after calling this routine, the results are undefined.sched
is not ABT_SCHED_NULL
and sched
is being used, the results are undefined.[in] | xstream | execution stream handle |
[in] | sched | scheduler handle |
int ABT_xstream_set_main_sched_basic | ( | ABT_xstream | xstream, |
ABT_sched_predef | predef, | ||
int | num_pools, | ||
ABT_pool * | pools | ||
) |
Set the main scheduler of an execution stream to a predefined scheduler.
ABT_xstream_set_main_sched()
sets the predefined scheduler predefined
as the main scheduler of the execution stream xstream
. The functionality provided by this routine is the same as the combination of ABT_sched_create_basic()
and ABT_xstream_set_main_sched()
.
Please check ABT_sched_create_basic()
and ABT_xstream_set_main_sched()
for details.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_THREAD
is returned if the caller is a tasklet.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_ARG
is returned if num_pools
is negative.ABT_ERR_INV_ARG
is returned if predef
is not a valid predefined scheduler type.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.num_pools
is positive and pools
is NULL
, the results are undefined.xstream
is accessed concurrently, the results are undefined.xstream
is accessed after calling this routine, the results are undefined.[in] | xstream | execution stream handle |
[in] | predef | predefined scheduler |
[in] | num_pools | number of pools associated with the scheduler |
[in] | pools | pools associated with the scheduler |
int ABT_xstream_set_rank | ( | ABT_xstream | xstream, |
int | rank | ||
) |
Set a rank for an execution stream.
ABT_xstream_set_rank()
allocates the new rank rank
and assigns it to the execution stream xstream
. The original rank of xstream
is deallocated.
rank
must be non-negative and not used by another execution stream.
Management of ranks of execution streams is performed atomically.
The rank of the primary execution stream may not be changed.
xstream
based on rank
.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM_RANK
is returned if rank
is negative.ABT_ERR_INV_XSTREAM_RANK
is returned if rank
has been used by another execution stream.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_INV_XSTREAM
is returned if xstream
is the primary execution stream.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.[in] | xstream | execution stream handle |
[in] | rank | execution stream rank |