Dynamic Load Balance 3.6.1+32-59d1
Macros | Functions
dlb.h File Reference
#include "dlb_types.h"
#include "dlb_errors.h"
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for dlb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DLB_VERSION   0x30601
 

Functions

int DLB_Init (int ncpus, const_dlb_cpu_set_t mask, const char *dlb_args)
 Initialize DLB library and all its internal data structures. Must be called once and only once by each process in the DLB system. More...
 
int DLB_Finalize (void)
 Finalize DLB library and clean up all its data structures. Must be called by each process before exiting the system. More...
 
int DLB_PreInit (const_dlb_cpu_set_t mask, char ***next_environ)
 Pre-Initialize process. More...
 
int DLB_Enable (void)
 Enable DLB and all its features in case it was previously disabled, otherwise it has no effect. More...
 
int DLB_Disable (void)
 Disable DLB actions for the calling process. More...
 
int DLB_SetMaxParallelism (int max)
 Set the maximum number of resources to be used by the calling process. More...
 
int DLB_UnsetMaxParallelism (void)
 Unset the maximum number of resources to be used by the calling process. More...
 
int DLB_CallbackSet (dlb_callbacks_t which, dlb_callback_t callback, void *arg)
 Setter for DLB callbacks. More...
 
int DLB_CallbackGet (dlb_callbacks_t which, dlb_callback_t *callback, void **arg)
 Getter for DLB callbacks. More...
 
int DLB_Lend (void)
 Lend all the current CPUs. More...
 
int DLB_LendCpu (int cpuid)
 Lend a specific CPU. More...
 
int DLB_LendCpus (int ncpus)
 Lend a specific amount of CPUs, only useful for systems that do not work with cpu masks. More...
 
int DLB_LendCpuMask (const_dlb_cpu_set_t mask)
 Lend a set of CPUs. More...
 
int DLB_Reclaim (void)
 Reclaim all the CPUs that are owned by the process. More...
 
int DLB_ReclaimCpu (int cpuid)
 Reclaim a specific CPU that are owned by the process. More...
 
int DLB_ReclaimCpus (int ncpus)
 Reclaim a specific amount of CPUs that are owned by the process. More...
 
int DLB_ReclaimCpuMask (const_dlb_cpu_set_t mask)
 Reclaim a set of CPUs. More...
 
int DLB_AcquireCpu (int cpuid)
 Acquire a specific CPU. More...
 
int DLB_AcquireCpus (int ncpus)
 Acquire a specific amount of CPUs. More...
 
int DLB_AcquireCpuMask (const_dlb_cpu_set_t mask)
 Acquire a set of CPUs. More...
 
int DLB_AcquireCpusInMask (int ncpus, const_dlb_cpu_set_t mask)
 Acquire some CPUs from a subset of CPUs. More...
 
int DLB_Borrow (void)
 Borrow all the possible CPUs registered on DLB. More...
 
int DLB_BorrowCpu (int cpuid)
 Borrow a specific CPU. More...
 
int DLB_BorrowCpus (int ncpus)
 Borrow a specific amount of CPUs. More...
 
int DLB_BorrowCpuMask (const_dlb_cpu_set_t mask)
 Borrow a set of CPUs. More...
 
int DLB_BorrowCpusInMask (int ncpus, const_dlb_cpu_set_t mask)
 Borrow some CPUs from a subset of CPUs. More...
 
int DLB_Return (void)
 Return claimed CPUs of other processes. More...
 
int DLB_ReturnCpu (int cpuid)
 Return the specific CPU if it has been reclaimed. More...
 
int DLB_ReturnCpuMask (const_dlb_cpu_set_t mask)
 Return a set of CPUs if some of them have been reclaimed. More...
 
int DLB_PollDROM (int *ncpus, dlb_cpu_set_t mask)
 Poll DROM module to check if the process needs to adapt to a new mask or number of CPUs. More...
 
int DLB_PollDROM_Update (void)
 Poll DROM module to check if the process needs to adapt to a new mask and update it if necessary using the registered callbacks. More...
 
int DLB_CheckCpuAvailability (int cpuid)
 Check whether the specified CPU is being used by another process. More...
 
int DLB_Barrier (void)
 Perform a DLB Barrier among processes in the node. More...
 
int DLB_BarrierAttach (void)
 Attach process to the DLB Barrier team. More...
 
int DLB_BarrierDetach (void)
 Detach process from the DLB Barrier team. More...
 
dlb_barrier_tDLB_BarrierNamedRegister (const char *barrier_name, dlb_barrier_flags_t flags)
 Register, or obtain, a named barrier. More...
 
dlb_barrier_tDLB_BarrierNamedGet (const char *barrier_name, dlb_barrier_flags_t flags)
 Register, or obtain, a named barrier. More...
 
int DLB_BarrierNamed (dlb_barrier_t *barrier)
 Perform a DLB Barrier using the named barrier among processes in the node. More...
 
int DLB_BarrierNamedAttach (dlb_barrier_t *barrier)
 Attach process to the named barrier team. More...
 
int DLB_BarrierNamedDetach (dlb_barrier_t *barrier)
 Detach process from the named barrier team. More...
 
int DLB_SetVariable (const char *variable, const char *value)
 Change the value of a DLB internal variable. More...
 
int DLB_GetVariable (const char *variable, char *value)
 Query the value of a DLB internal variable. More...
 
int DLB_PrintVariables (int print_extended)
 Print DLB internal variables. More...
 
int DLB_PrintShmem (int num_columns, dlb_printshmem_flags_t print_flags)
 Print the data stored in the shmem. More...
 
const char * DLB_Strerror (int errnum)
 Obtain a pointer to a string that describes the error code passed by argument. More...
 
int DLB_SetObserverRole (bool thread_is_observer)
 Modify the current thread DLB role to either observer or particpant. More...
 
int DLB_GetVersion (int *major, int *minor, int *patch)
 Return the DLB version. More...
 
int DLB_GetGPUAffinity (char *buffer, size_t buffer_size, bool full_uuid)
 
int DLB_AutoSizerStart (void) __attribute__((deprecated))
 
int DLB_AutoSizerEnd (void) __attribute__((deprecated))
 

Macro Definition Documentation

◆ DLB_VERSION

#define DLB_VERSION   0x30601

Function Documentation

◆ DLB_Init()

int DLB_Init ( int  ncpus,
const_dlb_cpu_set_t  mask,
const char *  dlb_args 
)

Initialize DLB library and all its internal data structures. Must be called once and only once by each process in the DLB system.

Parameters
[in]ncpusoptional, initial number of CPUs, or 0
[in]maskoptional, initial CPU mask to register, or NULL
[in]dlb_argsoptional parameter to overwrite DLB_ARGS options, or NULL
Returns
DLB_SUCCESS on success
DLB_ERR_INIT if DLB is already initialized
DLB_ERR_PERM if DLB cannot register the mask passed by argument
DLB_ERR_NOMEM if DLB cannot allocate more processes
DLB_ERR_NOCOMP if initialization options are incompatible

Parameters ncpus and mask are used to register CPUs owned by the calling process into the system. Both are optional but, if provided, mask takes precedence. Parameter dlb_args can be used in conjunction with DLB_ARGS; the latter takes precedence in case of conflicting options.

◆ DLB_Finalize()

int DLB_Finalize ( void  )

Finalize DLB library and clean up all its data structures. Must be called by each process before exiting the system.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if DLB is not initialized

◆ DLB_PreInit()

int DLB_PreInit ( const_dlb_cpu_set_t  mask,
char ***  next_environ 
)

Pre-Initialize process.

Parameters
[in]maskinitial CPU mask to register
[in,out]next_environenvironment to modify if the process is going to fork-exec
Returns
DLB_SUCCESS on success
DLB_ERR_PERM if DLB cannot register the mask passed by argument
DLB_ERR_NOMEM if DLB cannot allocate more processes

◆ DLB_Enable()

int DLB_Enable ( void  )

Enable DLB and all its features in case it was previously disabled, otherwise it has no effect.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if DLB is already enabled
DLB_ERR_NOINIT if DLB is not initialized

It can be used in conjunction with DLB_Disable() to delimit sections of the code where DLB calls will not have effect.

◆ DLB_Disable()

int DLB_Disable ( void  )

Disable DLB actions for the calling process.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if DLB is already disabled
DLB_ERR_NOINIT if DLB is not initialized

This call resets the original resources for the process and returns any external CPU it may be using at that time. While DLB is disabled there will not be any resource sharing for this process.

◆ DLB_SetMaxParallelism()

int DLB_SetMaxParallelism ( int  max)

Set the maximum number of resources to be used by the calling process.

Parameters
[in]maxmax number of CPUs
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled

Used to delimit sections of the code that the developer knows that only a maximum number of CPUs can benefit the execution. If a process reaches its maximum number of resources used at any time, subsequent calls to borrow CPUs will be ignored until some of them are returned. If the maximum number of CPUs exceeds the current number of assigned CPUs at the time of this function call, DLB will readjust as needed.

◆ DLB_UnsetMaxParallelism()

int DLB_UnsetMaxParallelism ( void  )

Unset the maximum number of resources to be used by the calling process.

Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled

Unset the maximum number of CPUs previously assigned to this process. Subsequent calls to borrow will not be delimited by this parameter.

◆ DLB_CallbackSet()

int DLB_CallbackSet ( dlb_callbacks_t  which,
dlb_callback_t  callback,
void *  arg 
)

Setter for DLB callbacks.

Parameters
[in]whichcallback type
[in]callbackfunction pointer to register
[in]argopaque argument to pass in each callback invocation
Returns
DLB_SUCCESS on success
DLB_ERR_NOCBK if the callback type does not exist

Register a new callback for the callback type which. The callback type comes predefined by the enum values of dlb_callbacks_t. It is highly recommended to register at least callbacks for dlb_callback_enable_cpu and dlb_callback_disable_cpu.

◆ DLB_CallbackGet()

int DLB_CallbackGet ( dlb_callbacks_t  which,
dlb_callback_t callback,
void **  arg 
)

Getter for DLB callbacks.

Parameters
[in]whichcallback type
[out]callbackregistered callback function for the specified callback type
[out]argopaque argument to pass in each callback invocation
Returns
DLB_SUCCESS on success
DLB_ERR_NOCBK if the callback type does not exist

Obtain the previously registered callback and arg for the specified which callback type.

◆ DLB_Lend()

int DLB_Lend ( void  )

Lend all the current CPUs.

Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Lend CPUs of the process to the system. A lent CPU may be assigned to other process that requests more resources. After lending a CPU, it can be reclaimed if it was originally owned by the process.

◆ DLB_LendCpu()

int DLB_LendCpu ( int  cpuid)

Lend a specific CPU.

Parameters
[in]cpuidCPU id to lend
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Lend CPUs of the process to the system. A lent CPU may be assigned to other process that requests more resources. After lending a CPU, it can be reclaimed if it was originally owned by the process.

◆ DLB_LendCpus()

int DLB_LendCpus ( int  ncpus)

Lend a specific amount of CPUs, only useful for systems that do not work with cpu masks.

Parameters
[in]ncpusnumber of CPUs to lend
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Lend CPUs of the process to the system. A lent CPU may be assigned to other process that requests more resources. After lending a CPU, it can be reclaimed if it was originally owned by the process.

◆ DLB_LendCpuMask()

int DLB_LendCpuMask ( const_dlb_cpu_set_t  mask)

Lend a set of CPUs.

Parameters
[in]maskCPU mask to lend
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Lend CPUs of the process to the system. A lent CPU may be assigned to other process that requests more resources. After lending a CPU, it can be reclaimed if it was originally owned by the process.

◆ DLB_Reclaim()

int DLB_Reclaim ( void  )

Reclaim all the CPUs that are owned by the process.

Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if there is no CPUs to reclaim
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Reclaim CPUs that were previously lent. The CPUs must originally belong to the calling process.

◆ DLB_ReclaimCpu()

int DLB_ReclaimCpu ( int  cpuid)

Reclaim a specific CPU that are owned by the process.

Parameters
[in]cpuidCPU id to reclaim
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if there is no CPUs to reclaim
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be reclaimed

Reclaim CPUs that were previously lent. The CPUs must originally belong to the calling process.

◆ DLB_ReclaimCpus()

int DLB_ReclaimCpus ( int  ncpus)

Reclaim a specific amount of CPUs that are owned by the process.

Parameters
[in]ncpusNumber of CPUs to reclaim
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if there is no CPUs to reclaim
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Reclaim CPUs that were previously lent. The CPUs must originally belong to the calling process.

◆ DLB_ReclaimCpuMask()

int DLB_ReclaimCpuMask ( const_dlb_cpu_set_t  mask)

Reclaim a set of CPUs.

Parameters
[in]maskCPU mask to reclaim
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if there is no CPUs to reclaim
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be reclaimed

Reclaim CPUs that were previously lent. The CPUs must originally belong to the calling process.

◆ DLB_AcquireCpu()

int DLB_AcquireCpu ( int  cpuid)

Acquire a specific CPU.

Parameters
[in]cpuidCPU to acquire
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if the CPU is already acquired
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be acquired
DLB_ERR_REQST if there are too many requests for this resource

Acquire CPUs from the system. If the CPU belongs to the process, the call is equivalent to a reclaim action. Otherwise, the process attempts to acquire a CPU. In asynchronous mode, it may enqueue a request for the CPU.

◆ DLB_AcquireCpus()

int DLB_AcquireCpus ( int  ncpus)

Acquire a specific amount of CPUs.

Parameters
[in]ncpusNumber of CPUs to acquire
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if cannot acquire any CPU
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_REQST if there are too many requests for this resource

Acquire CPUs from the system. If the CPU belongs to the process, the call is equivalent to a reclaim action. Otherwise, the process attempts to acquire a CPU. In asynchronous mode, it may enqueue a request for the CPU.

This function allows these two special values for ncpus in asynchronous mode:

  • DLB_MAX_CPUS: add a request for the maximum amount of resources.
  • DLB_DELETE_REQUESTS: delete previous requests

◆ DLB_AcquireCpuMask()

int DLB_AcquireCpuMask ( const_dlb_cpu_set_t  mask)

Acquire a set of CPUs.

Parameters
[in]maskCPU set to acquire
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if cannot acquire any CPU
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be acquired
DLB_ERR_REQST if there are too many requests for these resources

Acquire CPUs from the system. If the CPU belongs to the process, the call is equivalent to a reclaim action. Otherwise, the process attempts to acquire a CPU. In asynchronous mode, it may enqueue a request for the CPU.

◆ DLB_AcquireCpusInMask()

int DLB_AcquireCpusInMask ( int  ncpus,
const_dlb_cpu_set_t  mask 
)

Acquire some CPUs from a subset of CPUs.

Parameters
[in]ncpusNumber of CPUs to acquire
[in]maskCPU set to acquire from
Returns
DLB_SUCCESS on success
DLB_NOTED if the petition cannot be immediately fulfilled
DLB_NOUPDT if cannot acquire any CPU
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be acquired
DLB_ERR_REQST if there are too many requests for these resources

Acquire CPUs from the system. If the CPU belongs to the process, the call is equivalent to a reclaim action. Otherwise, the process attempts to acquire a CPU. In asynchronous mode, it may enqueue a request for the CPU.

◆ DLB_Borrow()

int DLB_Borrow ( void  )

Borrow all the possible CPUs registered on DLB.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if cannot borrow any resources
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Borrow CPUs from the system only if they are idle. No other action is done if the CPU is not available.

◆ DLB_BorrowCpu()

int DLB_BorrowCpu ( int  cpuid)

Borrow a specific CPU.

Parameters
[in]cpuidcpu CPU to borrow
Returns
DLB_SUCCESS on success
DLB_NOUPDT if CPU cannot borrowed
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Borrow CPUs from the system only if they are idle. No other action is done if the CPU is not available.

◆ DLB_BorrowCpus()

int DLB_BorrowCpus ( int  ncpus)

Borrow a specific amount of CPUs.

Parameters
[in]ncpusNumber of CPUs to borrow
Returns
DLB_SUCCESS on success
DLB_NOUPDT if cannot borrow any resources
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Borrow CPUs from the system only if they are idle. No other action is done if the CPU is not available.

◆ DLB_BorrowCpuMask()

int DLB_BorrowCpuMask ( const_dlb_cpu_set_t  mask)

Borrow a set of CPUs.

Parameters
[in]maskCPU set to borrow
Returns
DLB_SUCCESS on success
DLB_NOUPDT if cannot borrow any resources
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Borrow CPUs from the system only if they are idle. No other action is done if the CPU is not available.

◆ DLB_BorrowCpusInMask()

int DLB_BorrowCpusInMask ( int  ncpus,
const_dlb_cpu_set_t  mask 
)

Borrow some CPUs from a subset of CPUs.

Parameters
[in]ncpusNumber of CPUs to borrow
[in]maskCPU set to borrow from
Returns
DLB_SUCCESS on success
DLB_NOUPDT if cannot borrow any resources
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled

Borrow CPUs from the system only if they are idle. No other action is done if the CPU is not available.

◆ DLB_Return()

int DLB_Return ( void  )

Return claimed CPUs of other processes.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if no need to return
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be returned
DLB_ERR_NOCOMP if the mode asynchronous is enabled

In polling mode (the default), this routine checks whether the CPUs assigned to the calling process needs to be returned. On success, a disable callback is triggered.

In asynchronous mode, this routine has no effect.

◆ DLB_ReturnCpu()

int DLB_ReturnCpu ( int  cpuid)

Return the specific CPU if it has been reclaimed.

Parameters
[in]cpuidCPU to return
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be returned

In polling mode (the default), this routine checks whether the CPUs assigned to the calling process needs to be returned. On success, a disable callback is triggered.

In asynchronous mode, this routine has no effect.

◆ DLB_ReturnCpuMask()

int DLB_ReturnCpuMask ( const_dlb_cpu_set_t  mask)

Return a set of CPUs if some of them have been reclaimed.

Parameters
[in]maskCPU set to return
Returns
DLB_SUCCESS on success
DLB_ERR_NOINIT if DLB is not initialized
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_DISBLD if DLB is disabled
DLB_ERR_PERM if the resources cannot be returned

In polling mode (the default), this routine checks whether the CPUs assigned to the calling process needs to be returned. On success, a disable callback is triggered.

In asynchronous mode, this routine has no effect.

◆ DLB_PollDROM()

int DLB_PollDROM ( int *  ncpus,
dlb_cpu_set_t  mask 
)

Poll DROM module to check if the process needs to adapt to a new mask or number of CPUs.

Parameters
[out]ncpusoptional, variable to receive the new number of CPUs
[out]maskoptional, variable to receive the new mask
Returns
DLB_SUCCESS on success
DLB_NOUPDT if no update id needed
DLB_ERR_NOCOMP if DROM is not enabled (option –drom)

If DROM is enabled and the interaction mode is not asynchronous, this function can be called to poll the status of the CPU ownership.

◆ DLB_PollDROM_Update()

int DLB_PollDROM_Update ( void  )

Poll DROM module to check if the process needs to adapt to a new mask and update it if necessary using the registered callbacks.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if no update id needed
DLB_ERR_NOCOMP if DROM is not enabled (option –drom)

Same as DLB_PollDROM(), but calling the registered callbacks to update the ownership info instead of returning the data by argument.

◆ DLB_CheckCpuAvailability()

int DLB_CheckCpuAvailability ( int  cpuid)

Check whether the specified CPU is being used by another process.

Parameters
[in]cpuidCPU to be checked
Returns
DLB_SUCCESS if the CPU is available
DLB_NOTED if the CPU is owned but still guested by other process
DLB_NOUPDT if the CPU is owned but still not reclaimed
DLB_ERR_NOLEWI if –lewi is not enabled
DLB_ERR_PERM if the CPU cannot be acquired or has been disabled
DLB_ERR_DISBLD if DLB is disabled

◆ DLB_Barrier()

int DLB_Barrier ( void  )

Perform a DLB Barrier among processes in the node.

Returns
DLB_SUCCESS on success
DLB_NOUPDT if the process has detached from the default barrier
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)

This function performs a shared-memory-based barrier among all DLB processes in the node, unless thay have previously detached. The number of participants in the barrier is adaptive, which may produce undesired results if there is no synchronization between the attach/detach process and the barrier itself.

◆ DLB_BarrierAttach()

int DLB_BarrierAttach ( void  )

Attach process to the DLB Barrier team.

Returns
a positive integer with the updated number of participants
DLB_ERR_PERM if process was already attached, or if all processes detached
DLB_ERR_NOMEM if the process cannot attach to more barriers
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)
DLB_ERR_NOSHMEM if cannot find shared memory

If the process had previusly called DLB_BarrierDetach, this function allows a process to become part again of the DLB Barrier team. Otherwise, it has no effect.

◆ DLB_BarrierDetach()

int DLB_BarrierDetach ( void  )

Detach process from the DLB Barrier team.

Returns
a non-negative integer with the updated number of participants
DLB_ERR_PERM if process was already detached
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)
DLB_ERR_NOSHMEM if cannot find shared memory

Remove process from the DLB Barrier team. Subsequent calls to DLB_Barrier from this process will have no effect. Other processes in the team will not synchronize with this process on their respective calls to DLB_Barrier.

◆ DLB_BarrierNamedRegister()

dlb_barrier_t * DLB_BarrierNamedRegister ( const char *  barrier_name,
dlb_barrier_flags_t  flags 
)

Register, or obtain, a named barrier.

Parameters
[in]barrier_namethe name for the new barrier, or barrier to obtain
[in]flagsbarrier flags, see below
Returns
barrier associated to that name, or NULL on error

This function registers a new barrier or obtains the pointer to an already created barrier with the same name. The returned pointer is an opaque handle to use in other named barrier functions. This functions allows the following flags: DLB_BARRIER_LEWI_ON: the barrier may be used to perform LeWI operations DLB_BARRIER_LEWI_OFF: the barrier will not be used to perform LeWI operations DLB_BARRIER_LEWI_RUNTIME: whether this barrier will be used for LewI operations will be decided at run time

Names with commas (,) are supported, but will not work properly when using the –lewi-barrier-select option to select LeWI barriers at run time.

Note: DLB_BarrierNamedRegister and DLB_BarrierNamedGet are equivalent.

◆ DLB_BarrierNamedGet()

dlb_barrier_t * DLB_BarrierNamedGet ( const char *  barrier_name,
dlb_barrier_flags_t  flags 
)

Register, or obtain, a named barrier.

Parameters
[in]barrier_namethe name for the new barrier, or barrier to obtain
[in]flagsbarrier flags, see below
Returns
barrier associated to that name, or NULL on error

This function registers a new barrier or obtains the pointer to an already created barrier with the same name. The returned pointer is an opaque handle to use in other named barrier functions. This functions allows the following flags: DLB_BARRIER_LEWI_ON: the barrier may be used to perform LeWI operations DLB_BARRIER_LEWI_OFF: the barrier will not be used to perform LeWI operations DLB_BARRIER_LEWI_RUNTIME: whether this barrier will be used for LewI operations will be decided at run time

Names with commas (,) are supported, but will not work properly when using the –lewi-barrier-select option to select LeWI barriers at run time.

Note: DLB_BarrierNamedRegister and DLB_BarrierNamedGet are equivalent.

◆ DLB_BarrierNamed()

int DLB_BarrierNamed ( dlb_barrier_t barrier)

Perform a DLB Barrier using the named barrier among processes in the node.

Parameters
[in]barriernamed barrier
Returns
DLB_SUCCESS on success
DLB_NOUPDT if the process has detached from the barrier
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)

This function is equivalent to DLB_Barrier, but providing a named barrier

◆ DLB_BarrierNamedAttach()

int DLB_BarrierNamedAttach ( dlb_barrier_t barrier)

Attach process to the named barrier team.

Parameters
[in]barriernamed barrier to attach to
Returns
a positive integer with the updated number of participants
DLB_NOUPDT if process was already attached
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)
DLB_ERR_NOSHMEM if cannot find shared memory

This function is equivalent to DLB_BarrierAttach, but providing a named barrier

◆ DLB_BarrierNamedDetach()

int DLB_BarrierNamedDetach ( dlb_barrier_t barrier)

Detach process from the named barrier team.

Parameters
[in]barriernamed barrier to detach from
Returns
a non-negative integer with the updated number of participants
DLB_NOUPDT if process was already detached
DLB_ERR_NOCOMP if DLB Barrier is not enabled (option –barrier)
DLB_ERR_NOSHMEM if cannot find shared memory
DLB_ERR_PERM if all processes have detached from the barrier

This function is equivalent to DLB_BarrierDetach, but providing a named barrier

◆ DLB_SetVariable()

int DLB_SetVariable ( const char *  variable,
const char *  value 
)

Change the value of a DLB internal variable.

Parameters
[in]variableInternal variable to set
[in]valueNew value
Returns
DLB_SUCCESS on success
DLB_ERR_PERM if the variable is readonly
DLB_ERR_NOENT if the variable does not exist

Set a DLB internal variable. These variables are the same ones specified in DLB_ARGS, although not all of them can be modified at runtime. If the variable is readonly the setter function will return an error.

◆ DLB_GetVariable()

int DLB_GetVariable ( const char *  variable,
char *  value 
)

Query the value of a DLB internal variable.

Parameters
[in]variableInternal variable to set
[out]valueCurrent DLB variable value
Returns
DLB_SUCCESS on success
DLB_ERR_NOENT if the variable does not exist

Get a DLB internal variable. See DLB_SetVariable().

◆ DLB_PrintVariables()

int DLB_PrintVariables ( int  print_extended)

Print DLB internal variables.

Parameters
[in]print_extendedIf different to 0, print all options, including experimental, and its description
Returns
DLB_SUCCESS on success

◆ DLB_PrintShmem()

int DLB_PrintShmem ( int  num_columns,
dlb_printshmem_flags_t  print_flags 
)

Print the data stored in the shmem.

Parameters
[in]num_columnsNumber of columns to use when printing
[in]print_flagsPrint options
Returns
DLB_SUCCESS on success

◆ DLB_Strerror()

const char * DLB_Strerror ( int  errnum)

Obtain a pointer to a string that describes the error code passed by argument.

Parameters
[in]errnumerror code to consult
Returns
pointer to string with the error description

◆ DLB_SetObserverRole()

int DLB_SetObserverRole ( bool  thread_is_observer)

Modify the current thread DLB role to either observer or particpant.

Parameters
[in]thread_is_observertrue to set current thread to 'observer', false to 'participant'
Returns
DLB_SUCCESS on success

By default, all threads are DLB participants, meaning that they invoke LeWI when needed or measure performance metrics when TALP is enabled. A thread that sets its role to 'observer' will still be able to invoke MPI calls or TALP functions, including managing monitoring regions, but it will not trigger LeWI nor any TALP measuring metrics.

◆ DLB_GetVersion()

int DLB_GetVersion ( int *  major,
int *  minor,
int *  patch 
)

Return the DLB version.

Parameters
[out]majormajor version number
[out]minorminor version number
[out]patchpatch version number
Returns
DLB_SUCCESS on success

◆ DLB_GetGPUAffinity()

int DLB_GetGPUAffinity ( char *  buffer,
size_t  buffer_size,
bool  full_uuid 
)

◆ DLB_AutoSizerStart()

int DLB_AutoSizerStart ( void  )

◆ DLB_AutoSizerEnd()

int DLB_AutoSizerEnd ( void  )