|
Lightweight Parallel Foundations 1.0.1-alpha 2023-06-26T11:02:34Z
A high performance and model-compliant communication layer
|

Classes | |
| struct | lpf_bsmp_buffer |
Enumerations | |
| enum | lpf_bsmp_mode { READ , WRITE } |
Functions | |
| lpf_err_t | lpf_bsmp_create (const lpf_t ctx, const lpf_pid_t s, const lpf_pid_t p, const size_t buffer_size, const size_t tag_size, const size_t max_messages, lpf_bsmp_t *const bsmp) |
| lpf_err_t | lpf_bsmp_destroy (lpf_bsmp_t *const bsmp) |
| lpf_err_t | lpf_send (const lpf_bsmp_t bsmp, const lpf_pid_t pid, const lpf_memslot_t tag, const size_t tag_offset, const lpf_memslot_t payload, const size_t payload_offset, const size_t payload_size) |
| lpf_err_t | lpf_bsmp_sync (lpf_bsmp_t bsmp, lpf_sync_attr_t hint) |
| lpf_err_t | lpf_bsmp_syncall (lpf_bsmp_t *const bsmp, const size_t num_objects, lpf_sync_attr_t hint) |
| lpf_err_t | lpf_move (lpf_bsmp_t bsmp, void **const tag_p, void **const payload_p, size_t *const size) |
Variables | |
| typedef | lpf_bsmp_t |
| const lpf_bsmp_t | LPF_INVALID_BSMP |
| const lpf_err_t | LPF_ERR_BSMP_FULL |
| const lpf_err_t | LPF_ERR_BSMP_INVAL |
| const size_t | LPF_INVALID_SIZE |
| const lpf_memslot_t | LPF_INVALID_MEMSLOT |
| enum lpf_bsmp_mode |
A BSMP object can have one of the following modes at any single superstep.
| lpf_err_t lpf_bsmp_create | ( | const lpf_t | ctx, |
| const lpf_pid_t | s, | ||
| const lpf_pid_t | p, | ||
| const size_t | buffer_size, | ||
| const size_t | tag_size, | ||
| const size_t | max_messages, | ||
| lpf_bsmp_t *const | bsmp | ||
| ) |
Creates a new BSMP object. A successful call to this function will create a new BSMP object that is initially in WRITE mode.
| [in] | ctx | A valid LPF context. |
| [in] | s | This process ID in the context of ctx. |
| [in] | p | The total number of processes running in the context of ctx. |
| [in] | buffer_size | The maximum number of payload bytes that can be received or sent during any single superstep. |
| [in] | tag_size | The number of bytes each message contains in its tag. Contrary to the payload of a single message, the tag is always of the same size defined by this value. |
| [in] | max_messages | The maximum number of messages this BSMP object sends or receives during any single superstep. |
| [out] | bsmp | Where the resulting BSMP object should be stored. |
| lpf_err_t lpf_bsmp_destroy | ( | lpf_bsmp_t *const | bsmp | ) |
Destroys a valid BSMP object. After a successful call to this function, the given queue is set to LPF_INVALID_BSMP.
| [in,out] | bsmp | The BSMP object to destroy. |
| lpf_err_t lpf_send | ( | const lpf_bsmp_t | bsmp, |
| const lpf_pid_t | pid, | ||
| const lpf_memslot_t | tag, | ||
| const size_t | tag_offset, | ||
| const lpf_memslot_t | payload, | ||
| const size_t | payload_offset, | ||
| const size_t | payload_size | ||
| ) |
Given a local BSMP buffer, schedule a message for being sent to a remote BSMP object.
| [in] | bsmp | A valid BSMP object that is in WRITE mode. |
| [in] | pid | The destination process. |
| [in] | tag | The locally or globally registered memory slot from which to read the message tag. |
| [in] | tag_offset | The offset from the memory slot tag which indicates where the tag data resides. |
| [in] | payload | The locally or globally registered memory slot from which to read the message payload. |
| [in] | payload_offset | The offset from the memory slot payload which indicates where the payload data resides. |
| [in] | payload_size | The size (in bytes) of the payload data. |
| lpf_err_t lpf_bsmp_sync | ( | lpf_bsmp_t | bsmp, |
| lpf_sync_attr_t | hint | ||
| ) |
A wrapper around the regular lpf_sync. This wrapper additionally switches the mode of the given bsmp object; i.e., a BSMP object in read mode will be in write mode after a call to this function, and vice versa.
| [in] | bsmp | A valid BSMP object to switch the state of. |
| [in] | hint | The lpf_sync_attr_t that should be passed to the lpf_sync on the LPF context bsmp was created with. |
If bsmp was in READ mode, then after the call to this function bsmp shall be in WRITE mode. All messages that are currently in the buffer will become unavailable. If bsmp was in WRITE mode, then after the call to this function bsmp shall be in READ mode. All messages that were ready to send out will be made available at the sibling processes after a successful call to this function. Messages send to this process by sibling processes will be readable by successive calls to lpf_move after the call to this function.
| lpf_err_t lpf_bsmp_syncall | ( | lpf_bsmp_t *const | bsmp, |
| const size_t | num_objects, | ||
| lpf_sync_attr_t | hint | ||
| ) |
A wrapper around the regular lpf_sync. This wrapper additionally switches the mode of all lpf_bsmp_t objects in the given array bsmp. This function is semantically equivalent to the following implementation:
This function call is preferred since all preamble and postamble bookkeeping on bsmp objects is fused, requiring a single call to lpf_sync to be made, instead of num_objects calls to lpf_sync as in the above example.
| [in] | bsmp | Pointer to an array of num_objects lpf_bsmp_t objects. All objects must be valid. |
| [in] | num_objects | The number of lpf_bsmp_t objects in the array pointed to by num_objects. |
| [in] | hint | The hint to lpf_sync that will be passed to the internal call to lpf_sync. |
| lpf_err_t lpf_move | ( | lpf_bsmp_t | bsmp, |
| void **const | tag_p, | ||
| void **const | payload_p, | ||
| size_t *const | size | ||
| ) |
Given a local BSMP buffer, retrieve a message from the incoming queue.
| [in] | bsmp | A valid BSMP object that is in READ mode. |
| [out] | tag_p | Where to store a pointer to the message tag data. |
| [out] | payload_p | Where to store a pointer to the message payload data. |
| [out] | size | Where to store the payload size (in bytes). |
Messages that were sent to this process are received in an arbitrary order. Once a message has been retrieved using a call to this function, it is immediately removed from the queue. If the queue was empty while this function was called, the size will be set to LPF_INVALID_SIZE, while tag_p and payload_p will be set to NULL.
| typedef lpf_bsmp_t |
The BSMP object type.
|
extern |
An invalid BSMP object type.
|
extern |
A new error code that signals a full BSMP buffer error for lpf_send().
|
extern |
A new error code that signals a corrupt BSMP buffer. If this error code is returned, further use of the corresponding lpf_bsmp_t object leads to undefined behaviour. A next call to lpf_bsmp_sync() will bring back the BSMP buffer in a valid state.
|
extern |
A new size_t object that corresponds to an invalid size.
|
extern |
A new lpf_memslot_t object that corresponds to an invalid memslot.