wiki:library_barrier

Version 1 (modified by alain, 10 years ago) (diff)

--

The barrier.c and barrier.h files define a synchronisation service between several tasks sharing the same address space in a parallel multi-tasks application.

There is actually two types of barriers:

  1. The "giet_barrier_t" is a simple sense-reversing barrier. It can be safely used several times (in a loop for example),

but it does not scale, and should not be used when the number of expected tasks is larger than few tens. The available functions are:

  • barrier_init( giet_barrier_t * barrier, unsigned int ntasks )‘‘‘
  • barrier_wait( giet_barrier_t * barrier )
  1. The giet_sbt_barrier_t" can be used in multi-clusters architectures, and is implemented as a physically distributed Sliced-Binary-Tree (SBT).

To use this distributed barrier, some placement constraints must be respected:

  • The number of tasks must be a power of 2.
  • There is one task per processor in a given cluster.
  • The involved clusters form a mesh[X][Y] where (X = Y) or (x = 2*Y)
  • The lower left involved cluster is cluster(0,0)

Neither the barrier_init(), nor the barrier_wait() function require a syscall. For both types of barriers, the barrier initialisation should be done by one single task.