Skip to content

MPISharedBuffer

#include <sbio/storage/mpi_shared.hh>
struct MPISharedBuffer

Defined 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.

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
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() = default

Defined in src/lib/sbio/storage/mpi_shared.hh:106

Defaulted constructor.


inline

inline MPISharedBuffer(const MPISharedBuffer & other)

Defined in src/lib/sbio/storage/mpi_shared.hh:108


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.


inline noexcept

inline MPISharedBuffer(MPISharedBuffer && other) noexcept

Defined 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.


inline noexcept

inline MPISharedBuffer & operator=(MPISharedBuffer && other) noexcept

Defined 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() const

Defined in src/lib/sbio/storage/mpi_shared.hh:170


const inline

inline std::size_t size() const

Defined in src/lib/sbio/storage/mpi_shared.hh:173


const inline

inline const MPI_Win & window() const

Defined in src/lib/sbio/storage/mpi_shared.hh:174


inline

inline void set_memory(void * ptr, std::size_t size)

Defined in src/lib/sbio/storage/mpi_shared.hh:176


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>.

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() const

Defined in src/lib/sbio/storage/mpi_shared.hh:203


inline

inline void set_tag(int tag)

Defined in src/lib/sbio/storage/mpi_shared.hh:204


const inline

inline int seq() const

Defined in src/lib/sbio/storage/mpi_shared.hh:206


inline

inline void set_seq(int seq)

Defined in src/lib/sbio/storage/mpi_shared.hh:207


inline

inline int fetch_next_seq()

Defined in src/lib/sbio/storage/mpi_shared.hh:208


const inline

inline bool is_dirty() const

Defined in src/lib/sbio/storage/mpi_shared.hh:210


inline

inline void set_dirty(bool)

Defined in src/lib/sbio/storage/mpi_shared.hh:211

Return Name Description
constexpr MemorySpace memory_space static inline constexpr

static inline constexpr

constexpr static inline constexpr MemorySpace memory_space()

Defined in src/lib/sbio/storage/mpi_shared.hh:104

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.


std::size_t m_size { 0 }

Defined in src/lib/sbio/storage/mpi_shared.hh:215

Total size of the buffer/Window.


RC< MPI_Win, MPIWinAllocator, MPIWinDeleter > m_window

Defined 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.