|
MulticoreBSP for C
Version 2.0.4
|
#include "mcbsp-internal-macros.h"#include "bsp.h"#include "mcbsp-affinity.h"#include "mcbsp-profiling.h"#include "mcbsp-resiliency.h"#include <time.h>#include <stdio.h>#include <errno.h>#include <sched.h>#include <stdlib.h>#include <unistd.h>#include <assert.h>#include <signal.h>#include <pthread.h>#include <stdbool.h>#include "mcutil.h"#include "bsp-active-hooks.h"

Go to the source code of this file.
Data Structures | |
| struct | mcbsp_superstep_stats |
| Struct used to store tracked of superstep statistics. More... | |
| 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_hp_request |
| A DRMA communication request for hpput and hpget requests. 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... | |
Macros | |
| #define | MCBSP_SUPERSTEP_STATS_NAME_MAX 255 |
Functions | |
| int | main (int argc, char **argv) |
| To support direct SPMD mode, created threads may call main(). More... | |
| void | bsp_init_internal (struct mcbsp_init_data *const initialisationData) |
| Performs a BSP intialisation using the init struct supplied. More... | |
| struct mcbsp_util_machine_info * | mcbsp_internal_getMachineInfo (void) |
| Gets the machine info currently active for this MulticoreBSP session. More... | |
| void | mcbsp_internal_check_keys_allocated (void) |
| Singleton thread-safe allocator for mcbsp_internal_init_data. More... | |
| void * | mcbsp_internal_spmd (void *p) |
| Entry-point of MulticoreBSP threads. More... | |
| void | mcbsp_internal_check_aborted (void) |
| Checks if a abort has been requested, and if so, exits the current thread. More... | |
| void | mcbsp_internal_spinlock (struct mcbsp_init_data *const init, unsigned char *const cond, const size_t bsp_id) |
| Alias for mcbsp_internal_syncWithCondition using the standard init.condition. More... | |
| void | mcbsp_internal_sync (struct mcbsp_init_data *const init, pthread_cond_t *cond) |
| Alias for mcbsp_internal_syncWithCondition using the standard init.condition. More... | |
| struct mcbsp_thread_data * | mcbsp_internal_const_prefunction (void) |
| Common part executed by all BSP primitives when in SPMD part. More... | |
| struct mcbsp_thread_data * | mcbsp_internal_prefunction (void) |
| Common part executed by all BSP primitives when in SPMD part. More... | |
| struct mcbsp_thread_data * | mcbsp_internal_allocate_thread_data (struct mcbsp_init_data *const init, const size_t s) |
| Allcates and initialises the `plain old data' parts of the mcbsp_thread_data struct, using the supplied parameters. More... | |
| struct mcbsp_thread_data * | mcbsp_internal_initialize_thread_data (struct mcbsp_thread_data *const data) |
| Finishes initialisation of a mcbsp_thread_data struct. More... | |
| void | mcbsp_internal_destroy_thread_data (struct mcbsp_thread_data *const data) |
| Deallocates a fully initialised mcbsp_thread_data struct. More... | |
| int | mcbsp_internal_call_checkpoint (void) |
| Does the checkpointing from within a critical section. More... | |
| void | mcbsp_internal_update_checkpointStats (struct mcbsp_init_data *const init) |
| On encountering a new superstep, this function takes care of bookkeeping regarding checkpointing frequencies; including checks for the existance of the failure indicating file, `/etc/bsp_failure'. More... | |
| void | mcbsp_internal_print_profile (const struct mcbsp_init_data *const init) |
| Prints any collected profiling statistics to stdout. More... | |
| void | mcbsp_internal_init_superstep_stats (struct mcbsp_superstep_stats *const stats, const size_t superstep) |
| (Re-)initialises the superstep stats structure. More... | |
| double | mcbsp_internal_time (struct mcbsp_thread_data *const data) |
| Gets the time relative to the SPMD start section. More... | |
Variables | |
| pthread_key_t | mcbsp_internal_init_data |
| Per-initialising thread initialisation data. More... | |
| pthread_key_t | mcbsp_internal_thread_data |
| Per-thread data. More... | |
| pthread_key_t | mcbsp_local_machine_info |
| Per-thread machine info. More... | |
| bool | mcbsp_internal_keys_allocated |
| Whether mcbsp_internal_init_data is initialised. More... | |
| pthread_mutex_t | mcbsp_internal_keys_mutex |
| Contorls thread-safe singleton access to mcbsp_internal_init_data. More... | |
| #define MCBSP_SUPERSTEP_STATS_NAME_MAX 255 |
| 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 | ||
| ) |
To support direct SPMD mode, created threads may call main().
| struct mcbsp_thread_data* mcbsp_internal_allocate_thread_data | ( | struct mcbsp_init_data *const | init, |
| const size_t | s | ||
| ) |
Allcates and initialises the `plain old data' parts of the mcbsp_thread_data struct, using the supplied parameters.
| init | Pointer to the initialising process' init data. |
| s | Process ID of the thread corresponding to this data. |
| int mcbsp_internal_call_checkpoint | ( | void | ) |
Does the checkpointing from within a critical section.
THIS MEANS THIS FUNCTION IS NOT THREADSAFE. Restoring from a checkpoint necessarily means the restored program exits from this function.
| void mcbsp_internal_check_aborted | ( | void | ) |
Checks if a abort has been requested, and if so, exits the current thread.
| void mcbsp_internal_check_keys_allocated | ( | void | ) |
Singleton thread-safe allocator for mcbsp_internal_init_data.
| struct mcbsp_thread_data* mcbsp_internal_const_prefunction | ( | void | ) |
Common part executed by all BSP primitives when in SPMD part.
This version assumes local thread data used by BSP remains unchanged.
| void mcbsp_internal_destroy_thread_data | ( | struct mcbsp_thread_data *const | data | ) |
Deallocates a fully initialised mcbsp_thread_data struct.
| data | The thread data to destroy. |
| struct mcbsp_util_machine_info* mcbsp_internal_getMachineInfo | ( | void | ) |
Gets the machine info currently active for this MulticoreBSP session.
| void mcbsp_internal_init_superstep_stats | ( | struct mcbsp_superstep_stats *const | stats, |
| const size_t | superstep | ||
| ) |
(Re-)initialises the superstep stats structure.
Will set the descriptor name of the current superstep to `Superstep i', with i-th the current superstep number.
| stats | The pre-allocated superstep stats structure to (re-)initialise the fields of. |
| superstep | The current superstep number. |
| struct mcbsp_thread_data* mcbsp_internal_initialize_thread_data | ( | struct mcbsp_thread_data *const | data | ) |
Finishes initialisation of a mcbsp_thread_data struct.
The plain-old-data fields of a given thread_data are copied, and the remaining data fields are properly initialised. The old thread_data struct will be freed.
| data | The initial data to copy. |
| struct mcbsp_thread_data* mcbsp_internal_prefunction | ( | void | ) |
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_print_profile | ( | const struct mcbsp_init_data *const | init | ) |
Prints any collected profiling statistics to stdout.
| init | The profiled SPMD init structure. |
| void mcbsp_internal_spinlock | ( | struct mcbsp_init_data *const | init, |
| unsigned char *const | cond, | ||
| 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. |
| cond | The array to spinlock on. |
| bsp_id | The unique ID number corresponding to the thread that calls this sync function. |
| void* mcbsp_internal_spmd | ( | void * | p | ) |
Entry-point of MulticoreBSP threads.
Initialises internals and then executes the user-defined SPMD program.
| p | The passed POSIX threads init data. |
| void mcbsp_internal_sync | ( | struct mcbsp_init_data *const | init, |
| pthread_cond_t * | cond | ||
| ) |
Alias for mcbsp_internal_syncWithCondition using the standard init.condition.
| init | Pointer to the BSP init corresponding to our current SPMD group. |
| cond | The condition to use for synchronisation. |
| double mcbsp_internal_time | ( | struct mcbsp_thread_data *const | data | ) |
Gets the time relative to the SPMD start section.
Works on Linux (via POSIX realtime extensions), Windows, and Mach (OS X).
| data | Thread-local data structure that contains the relative start time, plus any other data required for getting the current time. |
| void mcbsp_internal_update_checkpointStats | ( | struct mcbsp_init_data *const | init | ) |
On encountering a new superstep, this function takes care of bookkeeping regarding checkpointing frequencies; including checks for the existance of the failure indicating file, `/etc/bsp_failure'.
This function is NOT thread-safe and should be called by PID 0 only.
| init | The initialisation struct where to update check- point related information in. |
| pthread_key_t mcbsp_internal_init_data |
Per-initialising thread initialisation data.
Per-thread machine info.
Necessary for nested MulticoreBSP SPMD calls.
| bool mcbsp_internal_keys_allocated |
Whether mcbsp_internal_init_data is initialised.
| pthread_mutex_t mcbsp_internal_keys_mutex |
Contorls thread-safe singleton access to mcbsp_internal_init_data.
Required for safe initialisation.
| pthread_key_t mcbsp_internal_thread_data |
Per-thread data.
| pthread_key_t mcbsp_local_machine_info |
Per-thread machine info.
1.8.5