PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Team synchronization

Functions

static int pi_cl_cluster_nb_cores ()
 Return the number of cores of the cluster. More...
 
void pi_cl_team_fork (int nb_cores, void(*entry)(void *), void *arg)
 Fork the execution of the calling core. More...
 
void pi_cl_team_prepare_fork (int nb_cores)
 Prepare a team for a task. More...
 
void pi_cl_team_preset_fork (void(*entry)(void *), void *arg)
 Fork a the execution of the calling core. More...
 
void pi_cl_team_fork_task (struct pi_cl_team_task *fork_task)
 Fork the execution of the calling core using task. More...
 
PI_INLINE_CL_TEAM_0 void pi_cl_team_barrier ()
 Execute a barrier between all cores of the team. More...
 
PI_INLINE_CL_TEAM_0 void pi_cl_team_critical_enter (void)
 Enter a critical section. More...
 
PI_INLINE_CL_TEAM_0 void pi_cl_team_critical_exit (void)
 Exit a critical section. More...
 
int pi_cl_team_nb_cores ()
 Return the number of cores in the team. More...
 

Description

Once a cluster entry point has been entered by cluster controller core, all the following primitives can be used to do multi-core processing, in a fork-join manner (like OMP parallel primitive).

The execution can first be forked in order to activate more cores, and then synchronized together using barriers.

Function Documentation

static int pi_cl_cluster_nb_cores ( )
inlinestatic

This will return the number of slave cores present in the cluster, available to share/fork a task.

Returns
Number of cores.
PI_INLINE_CL_TEAM_0 void pi_cl_team_barrier ( )

This will block the execution of each calling core until all cores have reached the barrier. The set of cores participating in the barrier is the one created with the last fork. Each core of the team must execute the barrier exactly once for all cores to be able to go through the barrier.

PI_INLINE_CL_TEAM_0 void pi_cl_team_critical_enter ( void  )

This will block the execution of the calling core until it can execute the following section of code alone. This will also prevent all other cores of the team to execute the following code until pi_cl_team_critical_exit() is called.

Note
No runtime functions should be called from within the critical section, only application code is allowed.
PI_INLINE_CL_TEAM_0 void pi_cl_team_critical_exit ( void  )

This will exit the critical code and let other cores executing it.

void pi_cl_team_fork ( int  nb_cores,
void(*)(void *)  entry,
void *  arg 
)

Calling this function will create a team of workers and call the specified entry point on each core of the team to start multi-core processing. The team parameters (number of cores and stacks) are by default the ones configured when sending a task to cluster from the fabric controller. It is possible to use different parameters when doing a new fork. If this is done the new parameters will become the new default ones.

Parameters
nb_coresNumber of cores to execute the task/entry point..
entryFunction entry point to be executed by team of workers.
argArgument of the function entry point.
Note
If nb_cores is zero, fork is done reusing the cores_mask of the previous fork or the default.
If the number of cores is not provided (i.e. is zero), the number of cores of the previous fork will be reused. Doing this has less runtime overhead.
void pi_cl_team_fork_task ( struct pi_cl_team_task *  fork_task)

This function is similar to pi_cl_team_fork but takes a task as parameter, which allows setting more parameters. Calling this function will create a team of workers and call the specified entry point on each core of the team to start multi-core processing with the team parameters specified in the task.

Parameters
fork_taskTask to be forked on slave cores.
int pi_cl_team_nb_cores ( )

This will return the number of cores involved in the team created by the active fork operation.

Returns
The number of cores of the team.
void pi_cl_team_prepare_fork ( int  nb_cores)

This function is called to set up a team of workers. This function has the same behaviour as pi_cl_team_fork(), but here the fork is not done, thus a call to pi_cl_team_preset_fork() is needed in order to dispatch the task to the team of workers.

Parameters
nb_coresNumber of cores to execute the entry point
void pi_cl_team_preset_fork ( void(*)(void *)  entry,
void *  arg 
)

This function is to be called after pi_cl_team_prepare_fork(). A call to this function will fork the function entry point between a preset team of workers.

Parameters
entryFunction entry point to be executed by team of workers.
argArgument of the function entry point.
Note
Calling pi_cl_team_prepare_fork() then pi_cl_team_preset_fork() is no different than calling pi_cl_team_fork() once. But when forking multiple times with the same team of workers, calling these two functions prevent from having an overhead due to barrier setups, ie first call pi_cl_team_prepare_fork() to set the team then multiple calls to pi_cl_team_preset_fork().
Workers are exclusively slave cores.