MulticoreBSP for C
Version 2.0.4
|
Abstract class which a user can extend to write BSP programs. More...
#include <bsp.hpp>
Public Member Functions | |
void | begin (const bsp_pid_t P=bsp_nprocs()) |
Initialises and starts the current BSP program. More... | |
virtual | ~BSP_program () |
Abstract classes should have virtual destructors. More... | |
void | begin (const bsp_pid_t P=bsp_nprocs()) |
virtual | ~BSP_program () |
Protected Member Functions | |
BSP_program () | |
Base constructor is only accessible by self, derived instances, and friends. More... | |
virtual void | spmd ()=0 |
The parallel SPMD code to be implemented by user. More... | |
virtual BSP_program * | newInstance ()=0 |
Creates a new instance of the implementing class, which will be used by new threads spawned by bsp_begin(). More... | |
virtual void | destroyInstance (BSP_program *const instance) |
Code that destroys instances creatured using the newInstance() function. More... | |
BSP_program () | |
virtual void | spmd ()=0 |
virtual BSP_program * | newInstance ()=0 |
virtual void | destroyInstance (BSP_program *const instance) |
Friends | |
void | mcbsp_cpp_callback () |
This function enables C++ wrapping of MulticoreBSP for C. More... | |
Abstract class which a user can extend to write BSP programs.
Class-based BSP programming implies that each SPMD thread executes the same BSP_program::spmd() program on different class instances; thus class-local variables are automatically also thread-local. This is somewhat more elegant than declaring everything locally, within functions, as is necessary in C.
Furthermore, the functions bsp_init(), bsp_begin(), and bsp_end() are implied and no longer need to be called explicitly; users instead call BSP_program::begin().
BSP algorithms using this C++ wrapper extend the BSP_program class, and provide implementations for the parallel part of the program in BSP_program::spmd(). The user furthermore supplies the C++ wrapper a means of constructing new instances of their BSP program by implementing BSP_program::newInstance(). This lets the wrapper provide a separate instance to each thread executing the parallel program.
|
inlineprotected |
Base constructor is only accessible by self, derived instances, and friends.
|
virtual |
Abstract classes should have virtual destructors.
|
inlineprotected |
|
virtual |
void mcbsp::BSP_program::begin | ( | const bsp_pid_t | P = bsp_nprocs() | ) |
|
protectedvirtual |
|
protectedpure virtual |
|
protectedpure virtual |
|
friend |
This function enables C++ wrapping of MulticoreBSP for C.
It is defined as a friend function of BSP_program, and used as the SPMD entry-point of the plain-C bsp_init() function, which requires a globally-defined function.
This function is only of interest to the C++ wrapper, and is therefore not exposed to the public (i.e., it is not included in the public bsp.hpp file).