SimGrid  3.13
Versatile Simulation of Distributed Systems
parmap.cpp File Reference
#include <atomic>
#include "src/internal_config.h"
#include <sys/syscall.h>
#include "xbt/parmap.h"
#include "xbt/log.h"
#include "xbt/function_types.h"
#include "xbt/dynar.h"
#include "xbt/xbt_os_thread.h"
#include "xbt/sysdep.h"
#include "src/simix/smx_private.h"
#include "src/simix/smx_private.hpp"

Classes

struct  s_xbt_parmap
 Parallel map structure. More...
 
struct  s_xbt_parmap_thread_data
 Thread data transmission structure. More...
 

Typedefs

typedef struct s_xbt_parmap s_xbt_parmap_t
 Parallel map structure. More...
 
typedef struct s_xbt_parmap_thread_data s_xbt_parmap_thread_data_t
 Thread data transmission structure. More...
 
typedef s_xbt_parmap_thread_data_txbt_parmap_thread_data_t
 

Enumerations

enum  e_xbt_parmap_flag_t { XBT_PARMAP_WORK, XBT_PARMAP_DESTROY }
 

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (xbt_parmap, xbt,"parmap: parallel map")
 
static void xbt_parmap_set_mode (xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 Sets the synchronization mode of a parmap. More...
 
static voidxbt_parmap_worker_main (void *arg)
 Main function of a worker thread. More...
 
static void xbt_parmap_work (xbt_parmap_t parmap)
 
static void xbt_parmap_posix_master_wait (xbt_parmap_t parmap)
 Starts the parmap: waits for all workers to be ready and returns. More...
 
static void xbt_parmap_posix_worker_signal (xbt_parmap_t parmap)
 Ends the parmap: wakes the controller thread when all workers terminate. More...
 
static void xbt_parmap_posix_master_signal (xbt_parmap_t parmap)
 Wakes all workers and waits for them to finish the tasks. More...
 
static void xbt_parmap_posix_worker_wait (xbt_parmap_t parmap, unsigned round)
 Waits for some work to process. More...
 
static void xbt_parmap_busy_master_wait (xbt_parmap_t parmap)
 Starts the parmap: waits for all workers to be ready and returns. More...
 
static void xbt_parmap_busy_worker_signal (xbt_parmap_t parmap)
 Ends the parmap: wakes the controller thread when all workers terminate. More...
 
static void xbt_parmap_busy_master_signal (xbt_parmap_t parmap)
 Wakes all workers and waits for them to finish the tasks. More...
 
static void xbt_parmap_busy_worker_wait (xbt_parmap_t parmap, unsigned round)
 Waits for some work to process. More...
 
xbt_parmap_t xbt_parmap_new (unsigned int num_workers, e_xbt_parmap_mode_t mode)
 Creates a parallel map object. More...
 
void xbt_parmap_destroy (xbt_parmap_t parmap)
 Destroys a parmap. More...
 
void xbt_parmap_apply (xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data)
 Applies a list of tasks in parallel. More...
 
voidxbt_parmap_next (xbt_parmap_t parmap)
 Returns a next task to process. More...
 

Typedef Documentation

typedef struct s_xbt_parmap s_xbt_parmap_t

Parallel map structure.

Thread data transmission structure.

Enumeration Type Documentation

Enumerator
XBT_PARMAP_WORK 
XBT_PARMAP_DESTROY 

Function Documentation

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( xbt_parmap  ,
xbt  ,
"parmap: parallel map"   
)
static void xbt_parmap_set_mode ( xbt_parmap_t  parmap,
e_xbt_parmap_mode_t  mode 
)
static

Sets the synchronization mode of a parmap.

Parameters
parmapa parallel map object
modethe synchronization mode
static void * xbt_parmap_worker_main ( void arg)
static

Main function of a worker thread.

Parameters
argthe parmap
static void xbt_parmap_work ( xbt_parmap_t  parmap)
static
static void xbt_parmap_posix_master_wait ( xbt_parmap_t  parmap)
static

Starts the parmap: waits for all workers to be ready and returns.

This function is called by the controller thread.

Parameters
parmapa parmap
static void xbt_parmap_posix_worker_signal ( xbt_parmap_t  parmap)
static

Ends the parmap: wakes the controller thread when all workers terminate.

This function is called by all worker threads when they end (not including the controller).

Parameters
parmapa parmap
static void xbt_parmap_posix_master_signal ( xbt_parmap_t  parmap)
static

Wakes all workers and waits for them to finish the tasks.

This function is called by the controller thread.

Parameters
parmapa parmap
static void xbt_parmap_posix_worker_wait ( xbt_parmap_t  parmap,
unsigned  round 
)
static

Waits for some work to process.

This function is called by each worker thread (not including the controller) when it has no more work to do.

Parameters
parmapa parmap
roundthe expected round number
static void xbt_parmap_busy_master_wait ( xbt_parmap_t  parmap)
static

Starts the parmap: waits for all workers to be ready and returns.

This function is called by the controller thread.

Parameters
parmapa parmap
static void xbt_parmap_busy_worker_signal ( xbt_parmap_t  parmap)
static

Ends the parmap: wakes the controller thread when all workers terminate.

This function is called by all worker threads when they end.

Parameters
parmapa parmap
static void xbt_parmap_busy_master_signal ( xbt_parmap_t  parmap)
static

Wakes all workers and waits for them to finish the tasks.

This function is called by the controller thread.

Parameters
parmapa parmap
static void xbt_parmap_busy_worker_wait ( xbt_parmap_t  parmap,
unsigned  round 
)
static

Waits for some work to process.

This function is called by each worker thread (not including the controller) when it has no more work to do.

Parameters
parmapa parmap
roundthe expected round number