MPISharedBuffer
MPISharedBuffer
Section titled “MPISharedBuffer”#include <sbio/storage/mpi_shared.hh>struct MPISharedBufferDefined in src/lib/sbio/storage/mpi_shared.hh:102
A buffer implementation backed by an MPI Shared Window.
This is used for roles like IndexRole that data processing ranks need to access concurrently.
The expectation is that the allocation of the memory for backing the Window be done by some controlling execution policy. This buffer then serves as a light view over it. It furthermore WILL be responsible for eventually cleaning up the memory; however, this is only done if there are no remaining references to the Window. It wraps the MPI_Win in an RC which manages the reference counting and performs destruction when the count reaches zero.
As there is the possibility for multiple StreamBrokers/other objects to run concurrently within a single rank, each of which using their own shared buffer, the MPISharedBuffer is tagged. The tag can be used for point-to-point communciation. Additionally, a sequence identifier is used to track the number of updates on this particular buffer. This helps prevent desynchronization by avoiding collectives called with the buffer from ranks moving at different rates.
List of all members
Section titled “List of all members”| Name | Kind | Owner |
|---|---|---|
MPISharedBuffer |
function |
Declared here |
MPISharedBuffer |
function |
Declared here |
operator= |
function |
Declared here |
MPISharedBuffer |
function |
Declared here |
operator= |
function |
Declared here |
ptr |
function |
Declared here |
size |
function |
Declared here |
window |
function |
Declared here |
set_memory |
function |
Declared here |
allocate |
function |
Declared here |
tag |
function |
Declared here |
set_tag |
function |
Declared here |
seq |
function |
Declared here |
set_seq |
function |
Declared here |
fetch_next_seq |
function |
Declared here |
is_dirty |
function |
Declared here |
set_dirty |
function |
Declared here |
memory_space |
function |
Declared here |
m_ptr |
variable |
Declared here |
m_size |
variable |
Declared here |
m_window |
variable |
Declared here |
m_tag |
variable |
Declared here |
m_seq |
variable |
Declared here |
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
MPISharedBuffer |
Defaulted constructor. | |
MPISharedBuffer inline |
||
MPISharedBuffer & |
operator= inline |
A shallow copy constructor. |
MPISharedBuffer inline noexcept |
A shallow move constructor. | |
MPISharedBuffer & |
operator= inline noexcept |
A shallow move assignment. |
void * |
ptr const inline |
|
std::size_t |
size const inline |
|
const MPI_Win & |
window const inline |
|
void |
set_memory inline |
|
void |
allocate inline |
Alternative interface for allocating an MPI_Win. |
int |
tag const inline |
|
void |
set_tag inline |
|
int |
seq const inline |
|
void |
set_seq inline |
|
int |
fetch_next_seq inline |
|
bool |
is_dirty const inline |
|
void |
set_dirty inline |
MPISharedBuffer
Section titled “MPISharedBuffer”MPISharedBuffer() = defaultDefined in src/lib/sbio/storage/mpi_shared.hh:106
Defaulted constructor.
MPISharedBuffer
Section titled “MPISharedBuffer”inline
inline MPISharedBuffer(const MPISharedBuffer & other)Defined in src/lib/sbio/storage/mpi_shared.hh:108
operator=
Section titled “operator=”inline
inline MPISharedBuffer & operator=(const MPISharedBuffer & other)Defined in src/lib/sbio/storage/mpi_shared.hh:121
A shallow copy constructor.
If the Window is non-null at the time of move, then increment the reference count. The other MPISharedBuffer is NULL’d.
MPISharedBuffer
Section titled “MPISharedBuffer”inline noexcept
inline MPISharedBuffer(MPISharedBuffer && other) noexceptDefined in src/lib/sbio/storage/mpi_shared.hh:138
A shallow move constructor.
If the Window is non-null at the time of move, the reference count is not incremented as the other’s is moved and NULL’d.
operator=
Section titled “operator=”inline noexcept
inline MPISharedBuffer & operator=(MPISharedBuffer && other) noexceptDefined in src/lib/sbio/storage/mpi_shared.hh:155
A shallow move assignment.
If the Window is non-null at the time of move, the reference count is not incremented as the other’s is moved and NULL’d.
const inline
inline void * ptr() constDefined in src/lib/sbio/storage/mpi_shared.hh:170
const inline
inline std::size_t size() constDefined in src/lib/sbio/storage/mpi_shared.hh:173
window
Section titled “window”const inline
inline const MPI_Win & window() constDefined in src/lib/sbio/storage/mpi_shared.hh:174
set_memory
Section titled “set_memory”inline
inline void set_memory(void * ptr, std::size_t size)Defined in src/lib/sbio/storage/mpi_shared.hh:176
allocate
Section titled “allocate”inline
inline void allocate(MPI_Comm comm, std::size_t size)Defined in src/lib/sbio/storage/mpi_shared.hh:190
Alternative interface for allocating an MPI_Win.
This alternative API, additional to the standard buffer concept, encapsulates creation of a fully managed RC<MPI_Win, MPIWinAllocator, MPIWinDeleter>.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
comm |
MPI_Comm |
The communicator for creation of the shared MPI_Win. |
size |
std::size_t |
The size of the shared buffer. |
const inline
inline int tag() constDefined in src/lib/sbio/storage/mpi_shared.hh:203
set_tag
Section titled “set_tag”inline
inline void set_tag(int tag)Defined in src/lib/sbio/storage/mpi_shared.hh:204
const inline
inline int seq() constDefined in src/lib/sbio/storage/mpi_shared.hh:206
set_seq
Section titled “set_seq”inline
inline void set_seq(int seq)Defined in src/lib/sbio/storage/mpi_shared.hh:207
fetch_next_seq
Section titled “fetch_next_seq”inline
inline int fetch_next_seq()Defined in src/lib/sbio/storage/mpi_shared.hh:208
is_dirty
Section titled “is_dirty”const inline
inline bool is_dirty() constDefined in src/lib/sbio/storage/mpi_shared.hh:210
set_dirty
Section titled “set_dirty”inline
inline void set_dirty(bool)Defined in src/lib/sbio/storage/mpi_shared.hh:211
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
constexpr MemorySpace |
memory_space static inline constexpr |
memory_space
Section titled “memory_space”static inline constexpr
constexpr static inline constexpr MemorySpace memory_space()Defined in src/lib/sbio/storage/mpi_shared.hh:104
Private Attributes
Section titled “Private Attributes”| Return | Name | Description |
|---|---|---|
void * |
m_ptr |
Pointer to the shared memory buffer. |
std::size_t |
m_size |
Total size of the buffer/Window. |
RC< MPI_Win, MPIWinAllocator, MPIWinDeleter > |
m_window |
Window over the shared memory buffer. |
int |
m_tag |
Tag to allow point-to-point communication. |
int |
m_seq |
A sequence number to track sync points. |
void * m_ptr { nullptr }Defined in src/lib/sbio/storage/mpi_shared.hh:214
Pointer to the shared memory buffer.
m_size
Section titled “m_size”std::size_t m_size { 0 }Defined in src/lib/sbio/storage/mpi_shared.hh:215
Total size of the buffer/Window.
m_window
Section titled “m_window”RC< MPI_Win, MPIWinAllocator, MPIWinDeleter > m_windowDefined in src/lib/sbio/storage/mpi_shared.hh:216
Window over the shared memory buffer.
int m_tag { -1 }Defined in src/lib/sbio/storage/mpi_shared.hh:217
Tag to allow point-to-point communication.
int m_seq { 0 }Defined in src/lib/sbio/storage/mpi_shared.hh:218
A sequence number to track sync points.