44 #include <mach/mach.h>
45 #include <mach/clock.h>
46 #include <mach/mach_error.h>
47 #include <mach/thread_policy.h>
54 #ifdef MCBSP_WITH_DMTCP
72 #define MCBSP_SUPERSTEP_STATS_NAME_MAX 255
76 extern int main(
int argc,
char **argv );
452 mach_timespec_t
start;
464 LARGE_INTEGER frequency;
size_t metabytes_received
Stores how many bytes of bytes_received were spent on meta-data, instead of actual payloads...
Definition: mcbsp.h:166
struct mcbsp_util_stack bsmp
The BSMP incoming message queue.
Definition: mcbsp.h:412
bool safe_cp
Whether hardware failures were detected, or were detected to be imminent.
Definition: mcbsp.h:339
size_t move
Stores the recorded number of calls to bsp_move.
Definition: mcbsp.h:109
size_t hpput
Stores the recorded number of calls to bsp_hpput.
Definition: mcbsp.h:94
void * destination
Destination.
Definition: mcbsp.h:519
size_t direct_get
Stores the recorded number of calls to bsp_direct_get.
Definition: mcbsp.h:106
void * source
Source.
Definition: mcbsp.h:481
size_t length
Length.
Definition: mcbsp.h:522
struct mcbsp_init_data * init
Initialisation data.
Definition: mcbsp.h:372
void * bsp_program
In case of a call from the C++ wrapper, pointer to the user-defined BSP_program.
Definition: mcbsp.h:286
unsigned char * sl_condition
Condition used for critical sections.
Definition: mcbsp.h:260
struct mcbsp_thread_data * mcbsp_internal_initialize_thread_data(struct mcbsp_thread_data *const data)
Finishes initialisation of a mcbsp_thread_data struct.
pthread_cond_t end_condition
Condition used for critical sections.
Definition: mcbsp.h:321
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.
struct timespec start
Stores the start-time of this thread.
Definition: mcbsp.h:470
struct mcbsp_util_stack localsToRemove
Keeps track which globals will be removed before the next superstep arrives.
Definition: mcbsp.h:427
Struct used to store tracked of superstep statistics.
Definition: mcbsp.h:79
A map from pointers to unsigned long ints.
Definition: mcutil.h:178
size_t bytes_received
Stores the number of bytes received during communication.
Definition: mcbsp.h:154
size_t bsp_id
Thread-local BSP id.
Definition: mcbsp.h:351
void(* spmd)(void)
User-definied SPMD entry-point.
Definition: mcbsp.h:280
Structure representing the machine hardware information.
Definition: mcutil.h:69
void mcbsp_internal_print_profile(const struct mcbsp_init_data *const init)
Prints any collected profiling statistics to stdout.
size_t P
Number of processors involved in this run.
Definition: mcbsp.h:201
const void * payload
Payload source.
Definition: mcbsp.h:540
Self-growing stack.
Definition: mcutil.h:206
struct mcbsp_util_address_map local2global
Local address to global variable map.
Definition: mcbsp.h:395
size_t length
Length.
Definition: mcbsp.h:487
size_t current_superstep
Current superstep of the SPMD program.
Definition: mcbsp.h:246
volatile bool abort
Whether the BSP program should be aborted.
Definition: mcbsp.h:327
double mcbsp_internal_time(struct mcbsp_thread_data *const data)
Gets the time relative to the SPMD start section.
struct mcbsp_util_stack hpdrma_queue
The communication queue for hpget and hpput requests.
Definition: mcbsp.h:409
A DRMA communication request for hpput and hpget requests.
Definition: mcbsp.h:513
unsigned char * sl_end_condition
Condition used for critical section.
Definition: mcbsp.h:274
pthread_mutex_t mutex
Mutex used for critical sections (such as synchronisation).
Definition: mcbsp.h:295
int mcbsp_internal_call_checkpoint(void)
Does the checkpointing from within a critical section.
struct mcbsp_superstep_stats superstep_stats
Stores statistics on the current superstep.
Definition: mcbsp.h:442
bool source_is_remote
Whether source is the remote PID.
Definition: mcbsp.h:530
double computation
Stores the time taken in the computation phase.
Definition: mcbsp.h:172
double buffering
Stores the time taken in buffering during computation phases.
Definition: mcbsp.h:169
size_t metabytes_sent
Stores how many bytes of bytes_sent were spent on meta-data, instead of actual payloads.
Definition: mcbsp.h:160
pthread_key_t mcbsp_internal_init_data
Per-initialising thread initialisation data.
Definition: mcbsp.h:574
void mcbsp_internal_sync(struct mcbsp_init_data *const init, pthread_cond_t *cond)
Alias for mcbsp_internal_syncWithCondition using the standard init.condition.
A generic BSP communication message.
Definition: mcbsp.h:499
size_t skipped_checkpoints
Current number of skipped checkpoints.
Definition: mcbsp.h:243
struct mcbsp_util_stack localsToPush
The push request queue.
Definition: mcbsp.h:430
struct mcbsp_util_stack * request_queues
The communication queues used for bsp_get requests.
Definition: mcbsp.h:378
struct mcbsp_thread_data ** threadData
Pointers to all thread-local data, as needed for communication.
Definition: mcbsp.h:252
#define MCBSP_SUPERSTEP_STATS_NAME_MAX
Definition: mcbsp.h:72
size_t bytes_buffered
Stores the number of bytes locally buffered.
Definition: mcbsp.h:137
void * destination
Destination.
Definition: mcbsp.h:484
char name[MCBSP_SUPERSTEP_STATS_NAME_MAX]
Stores a descriptive name for the superstep this is storing statistics of.
Definition: mcbsp.h:85
pthread_mutex_t mcbsp_internal_keys_mutex
Contorls thread-safe singleton access to mcbsp_internal_init_data.
void bsp_init_internal(struct mcbsp_init_data *const initialisationData)
Performs a BSP intialisation using the init struct supplied.
void * address
The local address to push.
Definition: mcbsp.h:554
bool no_cp
Whether checkpointing has been explicitly disallowed.
Definition: mcbsp.h:333
size_t hpmove
Stores the recorded number of calls to bsp_hpmove.
Definition: mcbsp.h:112
size_t send
Stores the recorded number of calls to bsp_send.
Definition: mcbsp.h:100
double superstep_start_time
The value of bsp_time at the start of the current computation phase.
Definition: mcbsp.h:369
struct mcbsp_util_stack profile
Where to store any profiling statistics.
Definition: mcbsp.h:415
size_t direct_get_bytes
Stores the number of bytes transferred using bsp_direct_get.
Definition: mcbsp.h:142
void mcbsp_internal_update_checkpointStats(struct mcbsp_init_data *const init)
On encountering a new superstep, this function takes care of bookkeeping regarding checkpointing freq...
size_t hpget
Stores the recorded number of calls to bsp_hpget.
Definition: mcbsp.h:97
pthread_cond_t condition
Condition used for critical sections.
Definition: mcbsp.h:305
const void * tag
Tag source.
Definition: mcbsp.h:543
size_t hpsend
Stores the recorded number of calls to bsp_hpsend.
Definition: mcbsp.h:103
size_t payload_size
Payload length.
Definition: mcbsp.h:546
Thread-local data.
Definition: mcbsp.h:348
size_t tagSize
Currently active tag size.
Definition: mcbsp.h:216
struct mcbsp_util_machine_partition machine_partition
Stores the machine part allocated to this thread.
Definition: mcbsp.h:439
int argc
Passed argc from bsp_init.
Definition: mcbsp.h:324
struct mcbsp_util_stack globalsToPush
Caches the mapSearch results for use with bsp_push_reg requests.
Definition: mcbsp.h:436
size_t sync_exit_counter
Barrier counter for this BSP program.
Definition: mcbsp.h:213
struct mcbsp_util_machine_info * mcbsp_internal_getMachineInfo(void)
Gets the machine info currently active for this MulticoreBSP session.
Struct corresponding to a single push request.
Definition: mcbsp.h:551
A table of local address locations per SPMD variable.
Definition: mcutil.h:241
size_t size
The memory range to register.
Definition: mcbsp.h:557
void mcbsp_internal_init_superstep_stats(struct mcbsp_superstep_stats *const stats, const size_t superstep)
(Re-)initialises the superstep stats structure.
size_t top_pid
ID of the top-level run, if available.
Definition: mcbsp.h:227
double communication
Stores the time taken in the communication phase.
Definition: mcbsp.h:175
struct mcbsp_thread_data * prev_data
Stores any previous thread-local data.
Definition: mcbsp.h:277
struct mcbsp_thread_data * mcbsp_internal_prefunction(void)
Common part executed by all BSP primitives when in SPMD part.
pthread_cond_t mid_condition
Condition used for critical sections.
Definition: mcbsp.h:315
struct mcbsp_util_stack * hpsend_queues
The communication queues used for bsp_hpsend requests.
Definition: mcbsp.h:392
pthread_key_t mcbsp_internal_thread_data
Per-thread data.
pthread_t * threads
Threads corresponding to this BSP program.
Definition: mcbsp.h:249
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.
bool ended
Whether the BSP program has ended.
Definition: mcbsp.h:330
void * destination
Destination.
Definition: mcbsp.h:502
struct mcbsp_util_address_table global2local
Address table used for inter-thread communication.
Definition: mcbsp.h:292
size_t safe_cp_f
Currently active safe checkpointing frequency.
Definition: mcbsp.h:233
void mcbsp_internal_check_aborted(void)
Checks if a abort has been requested, and if so, exits the current thread.
struct mcbsp_util_stack removedGlobals
Keeps track of which global variables are removed (as per bsp_pop_reg).
Definition: mcbsp.h:421
int main(int argc, char **argv)
To support direct SPMD mode, created threads may call main().
size_t localC
Counts the maximum number of registered variables at any one time.
Definition: mcbsp.h:363
size_t cp_f
Currently active checkpointing frequency.
Definition: mcbsp.h:230
pthread_key_t mcbsp_local_machine_info
Per-thread machine info.
size_t newTagSize
Stores the tag size to become active after the next synchronisation.
Definition: mcbsp.h:357
void * mcbsp_internal_spmd(void *p)
Entry-point of MulticoreBSP threads.
Structure representing a part of the current machine.
Definition: mcutil.h:53
struct mcbsp_thread_data * mcbsp_internal_const_prefunction(void)
Common part executed by all BSP primitives when in SPMD part.
size_t sync_entry_counter
Barrier counter for this BSP execution.
Definition: mcbsp.h:207
struct mcbsp_util_stack * queues
The communication queues used for all DRMA and BSMP communication.
Definition: mcbsp.h:384
void mcbsp_internal_destroy_thread_data(struct mcbsp_thread_data *const data)
Deallocates a fully initialised mcbsp_thread_data struct.
A high-performance (non-buffering) BSMP message request.
Definition: mcbsp.h:537
char ** argv
Passed argv from bsp_init.
Definition: mcbsp.h:289
size_t put
Stores the recorded number of calls to bsp_put.
Definition: mcbsp.h:88
const void * source
Source.
Definition: mcbsp.h:516
void MCBSP_FUNCTION_PREFIX() init(void(*spmd)(void), int argc, char **argv)
void mcbsp_internal_check_keys_allocated(void)
Singleton thread-safe allocator for mcbsp_internal_init_data.
bool mcbsp_internal_keys_allocated
Whether mcbsp_internal_init_data is initialised.
unsigned char * sl_mid_condition
Condition used for critical sections.
Definition: mcbsp.h:268
size_t non_communicating
Stores the recorded number of calls to non-communication primitives, namely -bsp_pid -bsp_nprocs -bsp...
Definition: mcbsp.h:132
Initialisation struct.
Definition: mcbsp.h:198
size_t bytes_sent
Stores the number of bytes sent out during communication.
Definition: mcbsp.h:148
A DRMA communication request for `get'-requests.
Definition: mcbsp.h:478
size_t length
Length.
Definition: mcbsp.h:505
size_t bookkeeping
Stores the recorded number of calls to inter-process bookkeeping primitives, namely -bsp_push_reg -bs...
Definition: mcbsp.h:121