window< ValueType > Class Template Reference

window&lt; ValueType &gt; Class Template Reference#

Reference API: gko::experimental::mpi::window< ValueType > Class Template Reference
Reference API
gko::experimental::mpi::window< ValueType > Class Template Reference

#include <ginkgo/core/base/mpi.hpp>

Public Types

enum class  create_type { allocate = 1 , create = 2 , dynamic_create = 3 }
 
enum class  lock_type { shared = 1 , exclusive = 2 }
 

Public Member Functions

 window ()
 
 window (const window &other)=delete
 
windowoperator= (const window &other)=delete
 
 window (window &&other)
 
windowoperator= (window &&other)
 
 window (std::shared_ptr< const Executor > exec, ValueType *base, int num_elems, const communicator &comm, const int disp_unit=sizeof(ValueType), MPI_Info input_info=MPI_INFO_NULL, create_type c_type=create_type::create)
 
MPI_Win get_window () const
 
void fence (int assert=0) const
 
void lock (int rank, lock_type lock_t=lock_type::shared, int assert=0) const
 
void unlock (int rank) const
 
void lock_all (int assert=0) const
 
void unlock_all () const
 
void flush (int rank) const
 
void flush_local (int rank) const
 
void flush_all () const
 
void flush_all_local () const
 
void sync () const
 
 ~window ()
 
template<typename PutType >
void put (std::shared_ptr< const Executor > exec, const PutType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count) const
 
template<typename PutType >
request r_put (std::shared_ptr< const Executor > exec, const PutType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count) const
 
template<typename PutType >
void accumulate (std::shared_ptr< const Executor > exec, const PutType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count, MPI_Op operation) const
 
template<typename PutType >
request r_accumulate (std::shared_ptr< const Executor > exec, const PutType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count, MPI_Op operation) const
 
template<typename GetType >
void get (std::shared_ptr< const Executor > exec, GetType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count) const
 
template<typename GetType >
request r_get (std::shared_ptr< const Executor > exec, GetType *origin_buffer, const int origin_count, const int target_rank, const unsigned int target_disp, const int target_count) const
 
template<typename GetType >
void get_accumulate (std::shared_ptr< const Executor > exec, GetType *origin_buffer, const int origin_count, GetType *result_buffer, const int result_count, const int target_rank, const unsigned int target_disp, const int target_count, MPI_Op operation) const
 
template<typename GetType >
request r_get_accumulate (std::shared_ptr< const Executor > exec, GetType *origin_buffer, const int origin_count, GetType *result_buffer, const int result_count, const int target_rank, const unsigned int target_disp, const int target_count, MPI_Op operation) const
 
template<typename GetType >
void fetch_and_op (std::shared_ptr< const Executor > exec, GetType *origin_buffer, GetType *result_buffer, const int target_rank, const unsigned int target_disp, MPI_Op operation) const
 

Detailed Description

template<typename ValueType>
class gko::experimental::mpi::window< ValueType >

This class wraps the MPI_Window class with RAII functionality. Different create and lock type methods are setup with enums.

MPI_Window is primarily used for one sided communication and this class provides functionalities to fence, lock, unlock and flush the communication buffers.

Member Enumeration Documentation

◆ create_type

template<typename ValueType >
enum class gko::experimental::mpi::window::create_type
strong

The create type for the window object.

◆ lock_type

template<typename ValueType >
enum class gko::experimental::mpi::window::lock_type
strong

The lock type for passive target synchronization of the windows.

Constructor & Destructor Documentation

◆ window() [1/3]

template<typename ValueType >
gko::experimental::mpi::window< ValueType >::window ( )
inline

The default constructor. It creates a null window of MPI_WIN_NULL type.

◆ window() [2/3]

template<typename ValueType >
gko::experimental::mpi::window< ValueType >::window ( window< ValueType > &&  other)
inline

The move constructor. Move the other object and replace it with MPI_WIN_NULL

Parameters
otherthe window object to be moved.

◆ window() [3/3]

template<typename ValueType >
gko::experimental::mpi::window< ValueType >::window ( std::shared_ptr< const Executor exec,
ValueType *  base,
int  num_elems,
const communicator comm,
const int  disp_unit = sizeof(ValueType),
MPI_Info  input_info = MPI_INFO_NULL,
create_type  c_type = create_type::create 
)
inline

Create a window object with a given data pointer and type. A collective operation.

Parameters
execThe executor, on which the base pointer is located.
basethe base pointer for the window object.
num_elemsthe num_elems of type ValueType the window points to.
commthe communicator whose ranks will have windows created.
disp_unitthe displacement from base for the window object.
input_infothe MPI_Info object used to set certain properties.
c_typethe type of creation method to use to create the window.

References gko::experimental::mpi::communicator::get().

◆ ~window()

template<typename ValueType >
gko::experimental::mpi::window< ValueType >::~window ( )
inline

The deleter which calls MPI_Win_free when the window leaves its scope.

Member Function Documentation

◆ accumulate()

template<typename ValueType >
template<typename PutType >
void gko::experimental::mpi::window< ValueType >::accumulate ( std::shared_ptr< const Executor exec,
const PutType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count,
MPI_Op  operation 
) const
inline

Accumulate data into the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to put
target_rankthe rank to put the data to
target_dispthe displacement at the target window
target_countthe request handle for the send call
operationthe reduce operation. See @MPI_Op

References gko::experimental::mpi::window< ValueType >::get_window().

◆ fence()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::fence ( int  assert = 0) const
inline

The active target synchronization using MPI_Win_fence for the window object. This is called on all associated ranks.

Parameters
assertthe optimization level. 0 is always valid.

◆ fetch_and_op()

template<typename ValueType >
template<typename GetType >
void gko::experimental::mpi::window< ValueType >::fetch_and_op ( std::shared_ptr< const Executor exec,
GetType *  origin_buffer,
GetType *  result_buffer,
const int  target_rank,
const unsigned int  target_disp,
MPI_Op  operation 
) const
inline

Fetch and operate on data from the target window (An optimized version of Get_accumulate).

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
target_rankthe rank to get the data from
target_dispthe displacement at the target window
operationthe reduce operation. See @MPI_Op

References gko::experimental::mpi::window< ValueType >::get_window().

◆ flush()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::flush ( int  rank) const
inline

Flush the existing RDMA operations on the target rank for the calling process for the window object.

Parameters
rankthe target rank.

◆ flush_all()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::flush_all ( ) const
inline

Flush all the existing RDMA operations for the calling process for the window object.

◆ flush_all_local()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::flush_all_local ( ) const
inline

Flush all the local existing RDMA operations on the calling rank for the window object.

◆ flush_local()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::flush_local ( int  rank) const
inline

Flush the existing RDMA operations on the calling rank from the target rank for the window object.

Parameters
rankthe target rank.

◆ get()

template<typename ValueType >
template<typename GetType >
void gko::experimental::mpi::window< ValueType >::get ( std::shared_ptr< const Executor exec,
GetType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count 
) const
inline

Get data from the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to get
target_rankthe rank to get the data from
target_dispthe displacement at the target window
target_countthe request handle for the send call

References gko::experimental::mpi::window< ValueType >::get_window().

◆ get_accumulate()

template<typename ValueType >
template<typename GetType >
void gko::experimental::mpi::window< ValueType >::get_accumulate ( std::shared_ptr< const Executor exec,
GetType *  origin_buffer,
const int  origin_count,
GetType *  result_buffer,
const int  result_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count,
MPI_Op  operation 
) const
inline

Get Accumulate data from the target window.

Parameters
execThe executor, on which the message buffers are located.
origin_bufferthe buffer to send
origin_countthe number of elements to get
result_bufferthe buffer to receive the target data
result_countthe number of elements to get
target_rankthe rank to get the data from
target_dispthe displacement at the target window
target_countthe request handle for the send call
operationthe reduce operation. See @MPI_Op

References gko::experimental::mpi::window< ValueType >::get_window().

◆ get_window()

◆ lock()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::lock ( int  rank,
lock_type  lock_t = lock_type::shared,
int  assert = 0 
) const
inline

Create an epoch using MPI_Win_lock for the window object.

Parameters
rankthe target rank.
lock_tthe type of the lock: shared or exclusive
assertthe optimization level. 0 is always valid.

◆ lock_all()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::lock_all ( int  assert = 0) const
inline

Create the epoch on all ranks using MPI_Win_lock_all for the window object.

Parameters
assertthe optimization level. 0 is always valid.

◆ operator=()

template<typename ValueType >
window & gko::experimental::mpi::window< ValueType >::operator= ( window< ValueType > &&  other)
inline

The move assignment operator. Move the other object and replace it with MPI_WIN_NULL

Parameters
otherthe window object to be moved.

◆ put()

template<typename ValueType >
template<typename PutType >
void gko::experimental::mpi::window< ValueType >::put ( std::shared_ptr< const Executor exec,
const PutType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count 
) const
inline

Put data into the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to put
target_rankthe rank to put the data to
target_dispthe displacement at the target window
target_countthe request handle for the send call

References gko::experimental::mpi::window< ValueType >::get_window().

◆ r_accumulate()

template<typename ValueType >
template<typename PutType >
request gko::experimental::mpi::window< ValueType >::r_accumulate ( std::shared_ptr< const Executor exec,
const PutType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count,
MPI_Op  operation 
) const
inline

(Non-blocking) Accumulate data into the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to put
target_rankthe rank to put the data to
target_dispthe displacement at the target window
target_countthe request handle for the send call
operationthe reduce operation. See @MPI_Op
Returns
the request handle for the send call

References gko::experimental::mpi::request::get(), and gko::experimental::mpi::window< ValueType >::get_window().

◆ r_get()

template<typename ValueType >
template<typename GetType >
request gko::experimental::mpi::window< ValueType >::r_get ( std::shared_ptr< const Executor exec,
GetType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count 
) const
inline

Get data (with handle) from the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to get
target_rankthe rank to get the data from
target_dispthe displacement at the target window
target_countthe request handle for the send call
Returns
the request handle for the send call

References gko::experimental::mpi::request::get(), and gko::experimental::mpi::window< ValueType >::get_window().

◆ r_get_accumulate()

template<typename ValueType >
template<typename GetType >
request gko::experimental::mpi::window< ValueType >::r_get_accumulate ( std::shared_ptr< const Executor exec,
GetType *  origin_buffer,
const int  origin_count,
GetType *  result_buffer,
const int  result_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count,
MPI_Op  operation 
) const
inline

(Non-blocking) Get Accumulate data (with handle) from the target window.

Parameters
execThe executor, on which the message buffers are located.
origin_bufferthe buffer to send
origin_countthe number of elements to get
result_bufferthe buffer to receive the target data
result_countthe number of elements to get
target_rankthe rank to get the data from
target_dispthe displacement at the target window
target_countthe request handle for the send call
operationthe reduce operation. See @MPI_Op
Returns
the request handle for the send call

References gko::experimental::mpi::request::get(), and gko::experimental::mpi::window< ValueType >::get_window().

◆ r_put()

template<typename ValueType >
template<typename PutType >
request gko::experimental::mpi::window< ValueType >::r_put ( std::shared_ptr< const Executor exec,
const PutType *  origin_buffer,
const int  origin_count,
const int  target_rank,
const unsigned int  target_disp,
const int  target_count 
) const
inline

Put data into the target window.

Parameters
execThe executor, on which the message buffer is located.
origin_bufferthe buffer to send
origin_countthe number of elements to put
target_rankthe rank to put the data to
target_dispthe displacement at the target window
target_countthe request handle for the send call
Returns
the request handle for the send call

References gko::experimental::mpi::request::get(), and gko::experimental::mpi::window< ValueType >::get_window().

◆ sync()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::sync ( ) const
inline

Synchronize the public and private buffers for the window object

◆ unlock()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::unlock ( int  rank) const
inline

Close the epoch using MPI_Win_unlock for the window object.

Parameters
rankthe target rank.

◆ unlock_all()

template<typename ValueType >
void gko::experimental::mpi::window< ValueType >::unlock_all ( ) const
inline

Close the epoch on all ranks using MPI_Win_unlock_all for the window object.


The documentation for this class was generated from the following file: