ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
Functions
Init & Finalize

This group is for initialization and finalization of the Argobots environment. More...

Functions

int ABT_init (int argc, char **argv)
 Initialize the Argobots execution environment. More...
 
int ABT_finalize (void)
 Finalize the Argobots execution environment. More...
 
int ABT_initialized (void)
 Check if the Argobots execution environment has been initialized. More...
 

Detailed Description

This group is for initialization and finalization of the Argobots environment.

Function Documentation

◆ ABT_finalize()

int ABT_finalize ( void  )

Finalize the Argobots execution environment.

If ABT_finalize() is called at the first nesting level, ABT_finalize() deallocates the resource used for the Argobots execution environment and sets the state of Argobots to uninitialized. If ABT_finalize() is not called at the first nesting level, ABT_finalize() decrements the reference counter atomically.

Initialization and finalization of Argobots are performed atomically.

Argobots can be initialized and finalized multiple times in a nested manner, but the caller of ABT_finalize() must be the same as that of ABT_init() at the same nesting level. Specifically, if ABT_finalize() is called at the first nesting level, the caller must be the primary ULT that is running on the primary execution stream.

ABT_finalize() is thread-safe, but calling ABT_finalize() concurrently is discouraged because the user cannot guarantee the calling order of ABT_finalize() although ABT_finalize() needs to be called by the same caller as that of ABT_init() at the same nesting level.

Note
The current specification does not define which routine can be safely called during the finalization phase. For example, the specification does not specify which routine can be safely used in the user-defined scheduler finalization function free() while the main scheduler of the primary execution stream is freed during ABT_finalize(). The detailed behavior of this routine will be clarified in the future.
Execution context
This routine must be called by the same caller of ABT_init() at the same nesting level. This routine may switch the context of the calling ULT.
Errors
ABT_SUCCESS is returned if this routine succeeds.
Undefined behavior
If Argobots is not initialized, the results are undefined.
If this routine is not called by the caller of ABT_init() at the same nesting level, the results are undefined.
If this routine is called at the first nesting level but is not called by the primary ULT that is running on the primary execution stream, the results are undefined.
Returns
Error code

Definition at line 141 of file global.c.

◆ ABT_init()

int ABT_init ( int  argc,
char **  argv 
)

Initialize the Argobots execution environment.

ABT_init() initializes the Argobots execution environment. If Argobots has not been initialized, the first caller of ABT_init() becomes the primary ULT that is running on the primary execution stream. If Argobots has already been initialized, ABT_init() increments a reference counter atomically. This routine returns ABT_SUCCESS even if Argobots has already been initialized.

Initialization and finalization of Argobots are performed atomically.

Argobots must be finalized by ABT_finalize() after its use. Argobots can be initialized and finalized multiple times in a nested manner, but the caller of ABT_finalize() must be the same as that of ABT_init() at the same nesting level.

ABT_init() is thread-safe, but calling ABT_init() concurrently is discouraged because the user cannot know the calling order of ABT_init(), which is needed to finalize Argobots correctly. ABT_finalize() needs to be called by the same caller as that of ABT_init() at the same nesting level.

Note
Argobots can be reinitialized after freeing Argobots. That is, ABT_init() can be called again after Argobots is finalized by ABT_finalize().

This routine does not use the arguments argc and argv.

Note
Although the arguments are argc and argv, the caller of ABT_init() does not need to be an external thread that starts a program (e.g., a POSIX thread that runs main()).
Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine may switch the context of the calling ULT.
Errors
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.
Parameters
[in]argcunused parameter
[in]argvunused parameter
Returns
Error code

Definition at line 75 of file global.c.

◆ ABT_initialized()

int ABT_initialized ( void  )

Check if the Argobots execution environment has been initialized.

ABT_initialized() returns ABT_SUCCESS if the Argobots execution environment has been initialized. Otherwise, it returns ABT_ERR_UNINITIALIZED.

Initialization and finalization of Argobots are performed atomically.

Execution context
This routine can be called in any execution context. Argobots does not need to be initialized. This routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT. This routine is signal-safe. Note that it is the user's responsibility to call this function properly by, for example, loading the Argobots library and/or resolving the symbol of this routine in a signal handler.
Errors
ABT_SUCCESS is returned if the Argobots execution environment has been initialized.
ABT_ERR_UNINITIALIZED is returned if the Argobots execution environment has not been initialized.
Returns
Error code

Definition at line 173 of file global.c.