SimGrid 3.7.1
Scalable simulation of distributed systems
Typedefs | Enumerations | Functions
XBT_parmap

Parallel map. More...

Typedefs

typedef struct s_xbt_parmapxbt_parmap_t
 Parallel map data type (opaque type)

Enumerations

enum  e_xbt_parmap_mode_t { XBT_PARMAP_POSIX, XBT_PARMAP_FUTEX, XBT_PARMAP_BUSY_WAIT, XBT_PARMAP_DEFAULT }
 Synchronization mode of the worker threads of a parmap. More...

Functions

xbt_parmap_t xbt_parmap_new (unsigned int num_workers, e_xbt_parmap_mode_t mode)
 Creates a parallel map object.
void xbt_parmap_destroy (xbt_parmap_t parmap)
 Destroys a parmap.
void xbt_parmap_apply (xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data)
 Applies a list of tasks in parallel.
void * xbt_parmap_next (xbt_parmap_t parmap)
 Returns a next task to process.

Detailed Description

Parallel map.

A function is applied to all elements of a dynar in parallel with n worker threads. The worker threads are persistent until the destruction of the parmap.

If there are more than n elements in the dynar, the worker threads are allowed to fetch themselves remaining work with xbt_parmap_next() and execute it.


Enumeration Type Documentation

Synchronization mode of the worker threads of a parmap.

Enumerator:
XBT_PARMAP_POSIX 

use POSIX synchronization primitives

XBT_PARMAP_FUTEX 

use Linux futex system call

XBT_PARMAP_BUSY_WAIT 

busy waits (no system calls, maximum CPU usage)

XBT_PARMAP_DEFAULT 

futex if available, posix otherwise


Function Documentation

xbt_parmap_t xbt_parmap_new ( unsigned int  num_workers,
e_xbt_parmap_mode_t  mode 
)

Creates a parallel map object.

Parameters:
num_workersnumber of worker threads to create
modehow to synchronize the worker threads
Returns:
the parmap created
void xbt_parmap_destroy ( xbt_parmap_t  parmap)

Destroys a parmap.

Parameters:
parmapthe parmap to destroy
void xbt_parmap_apply ( xbt_parmap_t  parmap,
void_f_pvoid_t  fun,
xbt_dynar_t  data 
)

Applies a list of tasks in parallel.

Parameters:
parmapa parallel map object
funthe function to call in parallel
dataeach element of this dynar will be passed as an argument to fun
void* xbt_parmap_next ( xbt_parmap_t  parmap)

Returns a next task to process.

Worker threads call this function to get more work.

Returns:
the next task to process, or NULL if there is no more work


Back to the main Simgrid Documentation page The version of SimGrid documented here is v3.7.1.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated by doxygen