Ginkgo  Generated from pipelines/1554403166 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::experimental::mpi::window< ValueType > Class Template Reference

This class wraps the MPI_Window class with RAII functionality. More...

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

Public Types

enum  create_type { allocate = 1, create = 2, dynamic_create = 3 }
 The create type for the window object.
 
enum  lock_type { shared = 1, exclusive = 2 }
 The lock type for passive target synchronization of the windows.
 

Public Member Functions

 window ()
 The default constructor. More...
 
 window (const window &other)=delete
 
windowoperator= (const window &other)=delete
 
 window (window &&other)
 The move constructor. More...
 
windowoperator= (window &&other)
 The move assignment operator. More...
 
 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)
 Create a window object with a given data pointer and type. More...
 
MPI_Win get_window () const
 Get the underlying window object of MPI_Win type. More...
 
void fence (int assert=0) const
 The active target synchronization using MPI_Win_fence for the window object. More...
 
void lock (int rank, lock_type lock_t=lock_type::shared, int assert=0) const
 Create an epoch using MPI_Win_lock for the window object. More...
 
void unlock (int rank) const
 Close the epoch using MPI_Win_unlock for the window object. More...
 
void lock_all (int assert=0) const
 Create the epoch on all ranks using MPI_Win_lock_all for the window object. More...
 
void unlock_all () const
 Close the epoch on all ranks using MPI_Win_unlock_all for the window object.
 
void flush (int rank) const
 Flush the existing RDMA operations on the target rank for the calling process for the window object. More...
 
void flush_local (int rank) const
 Flush the existing RDMA operations on the calling rank from the target rank for the window object. More...
 
void flush_all () const
 Flush all the existing RDMA operations for the calling process for the window object.
 
void flush_all_local () const
 Flush all the local existing RDMA operations on the calling rank for the window object.
 
void sync () const
 Synchronize the public and private buffers for the window object.
 
 ~window ()
 The deleter which calls MPI_Win_free when the window leaves its scope.
 
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
 Put data into the target window. More...
 
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
 Put data into the target window. More...
 
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
 Accumulate data into the target window. More...
 
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
 (Non-blocking) Accumulate data into the target window. More...
 
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
 Get data from the target window. More...
 
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
 Get data (with handle) from the target window. More...
 
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
 Get Accumulate data from the target window. More...
 
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
 (Non-blocking) Get Accumulate data (with handle) from the target window. More...
 
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
 Fetch and operate on data from the target window (An optimized version of Get_accumulate). More...
 

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.

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

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

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

◆ 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().

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

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