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

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
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 class | create_type { allocate = 1 , create = 2 , dynamic_create = 3 }
| The create type for the window object.
enum class | lock_type { shared = 1 , exclusive = 2 }
| The lock type for passive target synchronization of the windows.

## Public Member Functions
| window ()
| The default constructor.
| window (const window &other)=delete
window & | operator= (const window &other)=delete
| window (window &&other)
| The move constructor.
window & | operator= (window &&other)
| The move assignment operator.
| 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.
MPI_Win | get_window () const
| Get the underlying window object of MPI_Win type.
void | fence (int assert=0) const
| The active target synchronization using MPI_Win_fence for the window object.
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.
void | unlock (int rank) const
| Close the epoch using MPI_Win_unlock for the window object.
void | lock_all (int assert=0) const
| Create the epoch on all ranks using MPI_Win_lock_all for the window object.
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.
void | flush_local (int rank) const
| Flush the existing RDMA operations on the calling rank from the target rank for the window object.
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.
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.
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.
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.
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.
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.
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.
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.
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).

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

Referenced by operator=(), and window().

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

  other | the window object to be moved.

References window().

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

  exec | The executor, on which the base pointer is located.
  base | the base pointer for the window object.
  num_elems | the num_elems of type ValueType the window points to.
  comm | the communicator whose ranks will have windows created.
  disp_unit | the displacement from base for the window object.
  input_info | the MPI_Info object used to set certain properties.
  c_type | the 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to put
  target_rank | the rank to put the data to
  target_disp | the displacement at the target window
  target_count | the request handle for the send call
  operation | the reduce operation. See @MPI_Op

References 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

  assert | the 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  target_rank | the rank to get the data from
  target_disp | the displacement at the target window
  operation | the reduce operation. See @MPI_Op

References 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

  rank | the 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

  rank | the 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to get
  target_rank | the rank to get the data from
  target_disp | the displacement at the target window
  target_count | the request handle for the send call

References 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

  exec | The executor, on which the message buffers are located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to get
  result_buffer | the buffer to receive the target data
  result_count | the number of elements to get
  target_rank | the rank to get the data from
  target_disp | the displacement at the target window
  target_count | the request handle for the send call
  operation | the reduce operation. See @MPI_Op

References get_window().

## ◆ get_window()

template<typename ValueType>

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

Get the underlying window object of MPI_Win type.

Returns
  the underlying window object.

Referenced by accumulate(), fetch_and_op(), get(), get_accumulate(), put(), r_accumulate(), r_get(), r_get_accumulate(), and r_put().

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

  rank | the target rank.
  lock_t | the type of the lock: shared or exclusive
  assert | the 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

  assert | the 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

  other | the window object to be moved.

References window().

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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to put
  target_rank | the rank to put the data to
  target_disp | the displacement at the target window
  target_count | the request handle for the send call

References 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to put
  target_rank | the rank to put the data to
  target_disp | the displacement at the target window
  target_count | the request handle for the send call
  operation | the reduce operation. See @MPI_Op

Returns
  the request handle for the send call

References gko::experimental::mpi::request::get(), and 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to get
  target_rank | the rank to get the data from
  target_disp | the displacement at the target window
  target_count | the request handle for the send call

Returns
  the request handle for the send call

References gko::experimental::mpi::request::get(), and 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

  exec | The executor, on which the message buffers are located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to get
  result_buffer | the buffer to receive the target data
  result_count | the number of elements to get
  target_rank | the rank to get the data from
  target_disp | the displacement at the target window
  target_count | the request handle for the send call
  operation | the reduce operation. See @MPI_Op

Returns
  the request handle for the send call

References gko::experimental::mpi::request::get(), and 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

  exec | The executor, on which the message buffer is located.
  origin_buffer | the buffer to send
  origin_count | the number of elements to put
  target_rank | the rank to put the data to
  target_disp | the displacement at the target window
  target_count | the request handle for the send call

Returns
  the request handle for the send call

References gko::experimental::mpi::request::get(), and 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

  rank | the target rank.

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

- ginkgo/core/base/mpi.hpp