MulticoreBSP for C
Version 1.1
|
#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>
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_data * | bsp_begin_check () |
Checks if everything is all right to start an SPMD program. | |
struct mcbsp_util_machine_info * | mcbsp_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_data * | mcbsp_internal_const_prefunction () |
Common part executed by all BSP primitives when in SPMD part. | |
struct mcbsp_thread_data * | mcbsp_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. |
|
read |
Checks if everything is all right to start an SPMD program.
If there is an error, execution is stopped using mcbsp_util_fatal.
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.
|
read |
Common part executed by all BSP primitives when in SPMD part.
This version assumes local thread data used by BSP remains unchanged.
|
read |
Gets the machine info currently active for this MulticoreBSP session.
|
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.
init | Pointer to the BSP init corresponding to our current SPMD group. |
bsp_id | The 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).
init | Pointer to the BSP init corresponding to our current SPMD group. |
condition | The condition to use with this particular sync. |
bsp_id | The unique ID number corresponding to the thread that calls this sync function. |
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.