|
TRIQS/mpi 1.3.0
C++ interface to MPI
|
#include <mpi/window.hpp>
A C++ wrapper around MPI_Win representing a shared memory window.
This class provides an interface for creating and managing an MPI shared memory window.
| BaseType | The type of elements stored in the shared memory window. |
Definition at line 366 of file window.hpp.
Public Member Functions | |
| shared_window ()=default | |
| Construct a shared memory window with MPI_WIN_NULL. | |
| shared_window (shared_communicator const &c, MPI_Aint sz, MPI_Info info=MPI_INFO_NULL) | |
| Construct a shared memory window by dynamically allocating memory. | |
| BaseType * | base (int rank=MPI_PROC_NULL) const |
| Get a pointer to the beginning of the shared memory region of a specific rank. | |
| int | disp_unit (int rank=MPI_PROC_NULL) const |
| Get the displacement unit of the shared memory region of a specific rank. | |
| shared_communicator | get_communicator () const |
| Get the mpi::shared_communicator associated with the window. | |
| std::tuple< MPI_Aint, int, void * > | query (int rank=MPI_PROC_NULL) const |
| Query attributes of a shared memory window. | |
| MPI_Aint | size (int rank=MPI_PROC_NULL) const |
| Get the size of the shared memory region of a specific rank. | |
| Public Member Functions inherited from mpi::window< BaseType > | |
| window ()=default | |
| Construct a window with MPI_WIN_NULL. | |
| window (communicator const &c, BaseType *base_ptr, MPI_Aint sz, MPI_Info info=MPI_INFO_NULL) | |
| Construct an MPI window over an existing local memory buffer. | |
| window (communicator const &c, MPI_Aint sz, MPI_Info info=MPI_INFO_NULL) | |
| Construct an MPI window with dynamically allocated memory. | |
| window (window &&other) noexcept | |
| Move constructor takes ownership of the moved-from MPI window and leaves it with MPI_WIN_NULL. | |
| window (window const &)=delete | |
| Deleted copy constructor. | |
| virtual | ~window () |
| Destructor calls free() to release the window. | |
| BaseType * | base () const |
| Get a pointer to the beginning of the window memory. | |
| void | complete () const |
| Completes an RMA access epoch by calling MPI_Win_complete (see also start()). | |
| int | disp_unit () const |
| Get the displacement unit in bytes. | |
| void | fence (int assert=0) const |
| Synchronize all RMA operations within an access epoch by calling MPI_Win_fence. | |
| void | flush (int rank=-1) const |
| Ensure completion of all outstanding RMA operations. | |
| void | free () noexcept |
| Release allocated resources owned by the window. | |
| template<typename TargetType = BaseType, typename OriginType> requires (has_mpi_type<OriginType> && has_mpi_type<TargetType>) | |
| void | get (OriginType *origin_addr, int origin_count, int target_rank, MPI_Aint target_disp=0, int target_count=-1) const |
| Read data from a remote memory window. | |
| communicator | get_communicator () const |
| Get the mpi::communicator associated with the window. | |
| void | lock (int rank=-1, int lock_type=MPI_LOCK_SHARED, int assert=0) const |
| Start an RMA access epoch. | |
| operator MPI_Win () const | |
| Convert the window to the wrapped MPI_Win object. | |
| operator MPI_Win * () | |
| Convert a pointer to the window to a pointer to the wrapped MPI_Win object. | |
| window & | operator= (window &&rhs) noexcept |
| Move assignment operator takes ownership of the moved-from MPI window and leaves it with MPI_WIN_NULL. | |
| window & | operator= (window const &)=delete |
| Deleted copy assignment operator. | |
| void | post (group const &grp, int assert=0) const |
| Start an RMA exposure epoch by calling MPI_Win_post (see also wait()). | |
| template<typename TargetType = BaseType, typename OriginType> requires (has_mpi_type<OriginType> && has_mpi_type<TargetType>) | |
| void | put (OriginType *origin_addr, int origin_count, int target_rank, MPI_Aint target_disp=0, int target_count=-1) const |
| Write data to a remote memory window. | |
| MPI_Aint | size () const |
| Get the size of the window in number of elements. | |
| void | start (group const &grp, int assert=0) const |
| Start an RMA access epoch by calling MPI_Win_start (see also complete()). | |
| void | sync () const |
| Synchronize the public and private copies of the window. | |
| void | unlock (int rank=-1) const |
| Complete an RMA access epoch started by lock(). | |
| void | wait () const |
| Completes an RMA exposure epoch by calling MPI_Win_wait (see also post()). | |
Additional Inherited Members | |
| Public Types inherited from mpi::window< BaseType > | |
| using | base_type = BaseType |
| Type of the base pointer. | |
|
inlineexplicit |
Construct a shared memory window by dynamically allocating memory.
This constructor allocates a shared memory window within the given communicator by calling MPI_Win_allocate_shared. The allocated memory is automatically freed when the window is destroyed.
| c | mpi::shared_communicator object. |
| sz | Number of elements to allocate for the calling process. |
| info | Additional MPI information. |
Definition at line 381 of file window.hpp.
|
inlinenodiscard |
Get a pointer to the beginning of the shared memory region of a specific rank.
| rank | Rank within the shared communicator. |
Definition at line 423 of file window.hpp.
|
inlinenodiscard |
Get the displacement unit of the shared memory region of a specific rank.
| rank | Rank within the shared communicator. |
Definition at line 439 of file window.hpp.
|
inlinenodiscard |
Query attributes of a shared memory window.
Retrieves the byte-size, displacement unit, and a pointer to the beginning of the shared memory region for a specific rank.
When MPI_PROC_NULL is passed for the rank, MPI returns information about the memory segment with the lowest rank that has a non-zero size.
| rank | Rank within the shared communicator. |
Definition at line 405 of file window.hpp.
|
inlinenodiscard |
Get the size of the shared memory region of a specific rank.
| rank | Rank within the shared communicator. |
Definition at line 431 of file window.hpp.