HClib  0.3
Documentation for Habanero-C Library API
 All Data Structures Functions Typedefs Enumerations Groups
Data Structures | Macros | Typedefs | Functions
Finish/Async/Forasync

Core API, Finish/Async/Forasync for structured parallelism. More...

Data Structures

struct  loop_domain_t
 Describe loop domain when spawning a forasync. More...
 

Macros

#define NO_PROP   0
 No properties defined.
 
#define NO_ARG   NULL
 No arguments provided.
 
#define NO_DATUM   NULL
 To satisfy a DDF with a 'NULL' value.
 
#define NO_DDF   NULL
 No DDF argument provided.
 
#define NO_PHASER   NULL
 No phaser argument provided.
 
#define PHASER_TRANSMIT_ALL   ((int) 0x1)
 To indicate an async must register with all phasers.
 
#define NO_ACCUM   NULL
 No accumulator argument provided.
 
#define FORASYNC_MODE_RECURSIVE   1
 Forasync mode to recursively chunk the iteration space.
 
#define FORASYNC_MODE_FLAT   0
 Forasync mode to perform static chunking of the iteration space.
 

Typedefs

typedef void(* asyncFct_t )(void *arg)
 Function prototype executable by an async. More...
 
typedef int forasync_mode_t
 forasync mode to control chunking strategy.
 
typedef void(* forasync1D_Fct_t )(void *arg, int index)
 Function prototype for a 1-dimension forasync. More...
 
typedef void(* forasync2D_Fct_t )(void *arg, int index_outer, int index_inner)
 Function prototype for a 2-dimensions forasync. More...
 
typedef void(* forasync3D_Fct_t )(void *arg, int index_outer, int index_mid, int index_inner)
 Function prototype for a 3-dimensions forasync. More...
 

Functions

void hclib_init (int *argc, char **argv)
 Initialize the HClib runtime. Implicitly defines a global finish scope.
 
void hclib_finalize ()
 Finalize execution of the HClib runtime. Ends the global finish scope and waits for all asyncs to terminate.
 
void async (asyncFct_t fct_ptr, void *arg, struct ddf_st **ddf_list, struct _phased_t *phased_clause, int property)
 Spawn a new task asynchronously. More...
 
void forasync (void *forasync_fct, void *argv, struct ddf_st **ddf_list, struct _phased_t *phased_clause, struct _accumed_t *accumed, int dim, loop_domain_t *domain, forasync_mode_t mode)
 Parallel for loop 'forasync' (up to 3 dimensions). More...
 
void start_finish ()
 starts a new finish scope
 
void end_finish ()
 ends the current finish scope
 

Detailed Description

Core API, Finish/Async/Forasync for structured parallelism.

Typedef Documentation

typedef void(* asyncFct_t)(void *arg)

Function prototype executable by an async.

Parameters
[in]argArguments to the function

Definition at line 93 of file hclib.h.

typedef void(* forasync1D_Fct_t)(void *arg, int index)

Function prototype for a 1-dimension forasync.

Parameters
[in]argArgument to the loop iteration
[in]indexCurrent iteration index

Definition at line 127 of file hclib.h.

typedef void(* forasync2D_Fct_t)(void *arg, int index_outer, int index_inner)

Function prototype for a 2-dimensions forasync.

Parameters
[in]argArgument to the loop iteration
[in]index_outerCurrent outer iteration index
[in]index_innerCurrent inner iteration index

Definition at line 135 of file hclib.h.

typedef void(* forasync3D_Fct_t)(void *arg, int index_outer, int index_mid, int index_inner)

Function prototype for a 3-dimensions forasync.

Parameters
[in]argArgument to the loop iteration
[in]index_outerCurrent outer iteration index
[in]index_midCurrent intermediate iteration index
[in]index_innerCurrent inner iteration index

Definition at line 144 of file hclib.h.

Function Documentation

void async ( asyncFct_t  fct_ptr,
void *  arg,
struct ddf_st **  ddf_list,
struct _phased_t *  phased_clause,
int  property 
)

Spawn a new task asynchronously.

Parameters
[in]fct_ptrThe function to execute
[in]argArgument to the async
[in]ddf_listThe list of DDFs the async depends on
[in]phased_clausePhased clause to specify which phasers the async registers on
[in]propertyFlag to pass information to the runtime

Definition at line 136 of file hclib.c.

Referenced by end_finish().

void forasync ( void *  forasync_fct,
void *  argv,
struct ddf_st **  ddf_list,
struct _phased_t *  phased_clause,
struct _accumed_t *  accumed,
int  dim,
loop_domain_t domain,
forasync_mode_t  mode 
)

Parallel for loop 'forasync' (up to 3 dimensions).

Execute iterations of a loop in parallel. The loop domain allows to specify bounds as well as tiling information. Tiling of size one, is equivalent to spawning each individual iteration as an async.

Parameters
[in]forasync_fctThe function pointer to execute.
[in]argvArgument to the function
[in]ddf_listDDFs dependences
[in]phased_clausePhasers registration
[in]accumedAccumulators registration
[in]dimDimension of the loop
[in]domainLoop domains to iterate over (array of size 'dim').
[in]modeForasync mode to control chunking strategy (flat chunking or recursive).

Definition at line 390 of file forasync.c.