Itoyori  v0.0.1
rma.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ityr/common/util.hpp"
9 
10 namespace ityr::common::rma {
11 
14 
15 template <typename T>
16 inline std::unique_ptr<win> create_win(T* baseptr, std::size_t count) {
17  if constexpr (std::is_void_v<T>) {
18  return std::make_unique<win>(instance::get().create_win(baseptr, count));
19  } else {
20  return std::make_unique<win>(instance::get().create_win(baseptr, sizeof(T) * count));
21  }
22 }
23 
24 template <typename T>
25 inline void get_nb(const win& origin_win,
26  T* origin_addr,
27  std::size_t count,
28  const win& target_win,
29  int target_rank,
30  std::size_t target_disp) {
31  static_assert(!std::is_void_v<T>);
33  instance::get().get_nb(origin_win, reinterpret_cast<std::byte*>(origin_addr), sizeof(T) * count,
34  target_win, target_rank, target_disp);
35 }
36 
37 // Needed only for evaluation of get/put APIs (nocache), where `origin_win` is not provided
38 template <typename T>
39 inline void get_nb(T* origin_addr,
40  std::size_t count,
41  const win& target_win,
42  int target_rank,
43  std::size_t target_disp) {
44  static_assert(!std::is_void_v<T>);
46  instance::get().get_nb(reinterpret_cast<std::byte*>(origin_addr), sizeof(T) * count,
47  target_win, target_rank, target_disp);
48 }
49 
50 template <typename T>
51 inline void put_nb(const win& origin_win,
52  const T* origin_addr,
53  std::size_t count,
54  const win& target_win,
55  int target_rank,
56  std::size_t target_disp) {
57  static_assert(!std::is_void_v<T>);
59  instance::get().put_nb(origin_win, reinterpret_cast<const std::byte*>(origin_addr), sizeof(T) * count,
60  target_win, target_rank, target_disp);
61 }
62 
63 // Needed only for evaluation of get/put APIs (nocache), where `origin_win` is not provided
64 template <typename T>
65 inline void put_nb(const T* origin_addr,
66  std::size_t count,
67  const win& target_win,
68  int target_rank,
69  std::size_t target_disp) {
70  static_assert(!std::is_void_v<T>);
72  instance::get().put_nb(reinterpret_cast<const std::byte*>(origin_addr), sizeof(T) * count,
73  target_win, target_rank, target_disp);
74 }
75 
76 inline void flush(const win& target_win) {
78  instance::get().flush(target_win);
79 }
80 
81 }
Definition: util.hpp:176
static auto & get()
Definition: util.hpp:180
Definition: mpi.hpp:8
void get_nb(const win &origin_win, T *origin_addr, std::size_t count, const win &target_win, int target_rank, std::size_t target_disp)
Definition: rma.hpp:25
void flush(const win &target_win)
Definition: rma.hpp:76
std::unique_ptr< win > create_win(T *baseptr, std::size_t count)
Definition: rma.hpp:16
ITYR_RMA_IMPL::win win
Definition: rma.hpp:13
void put_nb(const win &origin_win, const T *origin_addr, std::size_t count, const win &target_win, int target_rank, std::size_t target_disp)
Definition: rma.hpp:51
#define ITYR_PROFILER_RECORD(event,...)
Definition: profiler.hpp:319
Definition: prof_events.hpp:84
Definition: prof_events.hpp:74
Definition: prof_events.hpp:79