MulticoreBSP for C  Version 1.1
Data Structures | Functions | Variables
mcinternal.h File Reference
#include "mcbsp-internal.h"
#include "mcutil.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#include <stdbool.h>
Include dependency graph for mcinternal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mcbsp_init_data
 Initialisation struct. More...
struct  mcbsp_thread_data
 Thread-local data. More...
struct  mcbsp_get_request
 A DRMA communication request for `get'-requests. More...
struct  mcbsp_message
 A generic BSP communication message. More...
struct  mcbsp_hpsend_request
 A high-performance (non-buffering) BSMP message request. More...
struct  mcbsp_push_request
 Struct corresponding to a single push request. More...

Functions

void bsp_init_internal (struct mcbsp_init_data *const initialisationData)
 Performs a BSP intialisation using the init struct supplied.
struct mcbsp_init_databsp_begin_check ()
 Checks if everything is all right to start an SPMD program.
struct mcbsp_util_machine_infomcbsp_internal_getMachineInfo ()
 Gets the machine info currently active for this MulticoreBSP session.
void mcbsp_internal_check_keys_allocated ()
 Singleton thread-safe allocator for mcbsp_internal_init_data.
void * mcbsp_internal_spmd ()
 Entry-point of MulticoreBSP threads.
void mcbsp_internal_check_aborted ()
 Checks if a abort has been requested, and if so, exits the current thread.
void mcbsp_internal_sync (struct mcbsp_init_data *const init, const size_t bsp_id)
 Alias for mcbsp_internal_syncWithCondition using the standard init.condition.
void mcbsp_internal_syncWithCondition (struct mcbsp_init_data *const init, volatile unsigned char *const condition, const size_t bsp_id)
 Implements an actual synchronisation.
struct mcbsp_thread_datamcbsp_internal_const_prefunction ()
 Common part executed by all BSP primitives when in SPMD part.
struct mcbsp_thread_datamcbsp_internal_prefunction ()
 Common part executed by all BSP primitives when in SPMD part.
int main (int argc, char **argv)
 Default SPMD function to call.

Variables

pthread_key_t mcbsp_internal_init_data
 Per-MulticoreBSP program initialisation data.
pthread_key_t mcbsp_internal_thread_data
 Per-thread data.
bool mcbsp_internal_keys_allocated
 Whether mcbsp_internal_init_data is initialised.
pthread_mutex_t mcbsp_internal_key_mutex
 Contorls thread-safe singleton access to mcbsp_internal_init_data, as required for its initialisation.

Function Documentation

struct mcbsp_init_data* bsp_begin_check ( )
read

Checks if everything is all right to start an SPMD program.

If there is an error, execution is stopped using mcbsp_util_fatal.

Returns:
NULL if the call to bsp_begin was valid, but no further action is required; or a pointer to an initialisation struct when the SPMD program is yet to be spawned.
void bsp_init_internal ( struct mcbsp_init_data *const  initialisationData)

Performs a BSP intialisation using the init struct supplied.

The construction of this struct differs when called from C code, or when called from the C++ wrapper.

int main ( int  argc,
char **  argv 
)

Default SPMD function to call.

void mcbsp_internal_check_aborted ( )

Checks if a abort has been requested, and if so, exits the current thread.

void mcbsp_internal_check_keys_allocated ( )

Singleton thread-safe allocator for mcbsp_internal_init_data.

struct mcbsp_thread_data* mcbsp_internal_const_prefunction ( )
read

Common part executed by all BSP primitives when in SPMD part.

This version assumes local thread data used by BSP remains unchanged.

struct mcbsp_util_machine_info* mcbsp_internal_getMachineInfo ( )
read

Gets the machine info currently active for this MulticoreBSP session.

Returns:
A pointer to the current machine info struct.
struct mcbsp_thread_data* mcbsp_internal_prefunction ( )
read

Common part executed by all BSP primitives when in SPMD part.

This is the non-const version of mcbsp_internal_const_prefunction().

void* mcbsp_internal_spmd ( )

Entry-point of MulticoreBSP threads.

Initialises internals and then executes the user-defined SPMD program.

void mcbsp_internal_sync ( struct mcbsp_init_data *const  init,
const size_t  bsp_id 
)

Alias for mcbsp_internal_syncWithCondition using the standard init.condition.

Parameters:
initPointer to the BSP init corresponding to our current SPMD group.
bsp_idThe unique ID number corresponding to the thread that calls this sync function.
void mcbsp_internal_syncWithCondition ( struct mcbsp_init_data *const  init,
volatile unsigned char *const  condition,
const size_t  bsp_id 
)

Implements an actual synchronisation.

This is used within bsp_sync, but also in bsp_begin to ensure all is initialised before getting into a real communication-enabled sync (necessary to support high-performant put, get, or send operations).

Parameters:
initPointer to the BSP init corresponding to our current SPMD group.
conditionThe condition to use with this particular sync.
bsp_idThe unique ID number corresponding to the thread that calls this sync function.

Variable Documentation

pthread_key_t mcbsp_internal_init_data

Per-MulticoreBSP program initialisation data.

Per-thread machine info.

Necessary for nested MulticoreBSP SPMD calls.

pthread_mutex_t mcbsp_internal_key_mutex

Contorls thread-safe singleton access to mcbsp_internal_init_data, as required for its initialisation.

bool mcbsp_internal_keys_allocated

Whether mcbsp_internal_init_data is initialised.

pthread_key_t mcbsp_internal_thread_data

Per-thread data.