12 template <TargetComm Target>
14 if (
win_m != MPI_WIN_NULL) {
20 template <TargetComm Target>
21 template <std::contiguous_iterator Iter>
24 "No active target communication window");
32 int dispUnit =
sizeof(
typename Iter::value_type);
33 MPI_Aint size = (MPI_Aint)
count_m * dispUnit;
34 MPI_Win_create(&(*
first), size, dispUnit, MPI_INFO_NULL, comm, &
win_m);
39 template <TargetComm Target>
40 template <std::contiguous_iterator Iter>
48 MPI_Win_create_dynamic(MPI_INFO_NULL, comm, &
win_m);
53 MPI_Aint size = (MPI_Aint)
count_m *
sizeof(
typename Iter::value_type);
59 template <TargetComm Target>
60 template <std::contiguous_iterator Iter>
70 template <TargetComm Target>
73 "No active target communication window");
74 MPI_Win_fence(asrt,
win_m);
77 template <TargetComm Target>
78 template <std::contiguous_iterator Iter>
82 auto count = std::distance(
first, last);
86 if (request ==
nullptr) {
87 MPI_Put(&(*
first), count, datatype, dest, (MPI_Aint)pos, count, datatype,
90 MPI_Rput(&(*
first), count, datatype, dest, (MPI_Aint)pos, count, datatype,
95 template <TargetComm Target>
99 if (request ==
nullptr) {
100 MPI_Put(value, 1, datatype, dest, (MPI_Aint)pos, 1, datatype,
win_m);
102 MPI_Rput(value, 1, datatype, dest, (MPI_Aint)pos, 1, datatype,
win_m, *request);
106 template <TargetComm Target>
107 template <std::contiguous_iterator Iter>
111 auto count = std::distance(
first, last);
113 throw IpplException(
"Window::put",
"Count exceeds RMA window size.");
115 if (request ==
nullptr) {
116 MPI_Get(&(*
first), count, datatype, source, (MPI_Aint)pos, count, datatype,
119 MPI_Rget(&(*
first), count, datatype, source, (MPI_Aint)pos, count, datatype,
124 template <TargetComm Target>
125 template <
typename T>
128 if (request ==
nullptr) {
129 MPI_Get(value, 1, datatype, source, (MPI_Aint)pos, 1, datatype,
win_m);
131 MPI_Rget(value, 1, datatype, source, (MPI_Aint)pos, 1, datatype,
win_m,
139 template <TargetComm Target>
142 "No passive target communication window");
143 MPI_Win_flush(rank,
win_m);
146 template <TargetComm Target>
149 "No passive target communication window");
150 MPI_Win_flush_all(
win_m);
153 template <TargetComm Target>
156 "No passive target communication window");
157 MPI_Win_lock(locktype, rank, asrt,
win_m);
160 template <TargetComm Target>
163 "No passive target communication window");
164 MPI_Win_lock_all(asrt,
win_m);
167 template <TargetComm Target>
170 "No passive target communication window");
171 MPI_Win_unlock(rank,
win_m);
174 template <TargetComm Target>
177 "No passive target communication window");
178 MPI_Win_unlock_all(
win_m);
constexpr KOKKOS_INLINE_FUNCTION auto first()
MPI_Datatype get_mpi_datatype(const T &)
void get(Iter first, Iter last, int source, unsigned int pos, Request *request=nullptr)
bool create(const Communicator &comm, Iter first, Iter last)
bool attach(const Communicator &comm, Iter first, Iter last)
void lock(int locktype, int rank, int asrt=0)
void put(Iter first, Iter last, int dest, unsigned int pos, Request *request=nullptr)