@@ -143,42 +143,40 @@ function Win_unlock(rank::Integer, win::Win)
143
143
@mpichk ccall ((:MPI_Win_unlock , libmpi), Cint, (Cint, MPI_Win), rank, win)
144
144
end
145
145
146
- function Get (origin_buffer, count:: Integer , target_rank:: Integer , target_disp:: Integer , win:: Win )
147
- T = eltype (origin_buffer)
146
+
147
+ # TODO : add some sort of "remote buffer": a way to specify different datatypes/counts
148
+
149
+ function Get (origin_buf:: Buffer , target_rank:: Integer , target_disp:: Integer , win:: Win )
148
150
# int MPI_Get(void *origin_addr, int origin_count,
149
151
# MPI_Datatype origin_datatype, int target_rank,
150
152
# MPI_Aint target_disp, int target_count,
151
153
# MPI_Datatype target_datatype, MPI_Win win)
152
154
@mpichk ccall ((:MPI_Get , libmpi), Cint,
153
155
(MPIPtr, Cint, MPI_Datatype, Cint, Cptrdiff_t, Cint, MPI_Datatype, MPI_Win),
154
- origin_buffer, count, Datatype (T), target_rank, Cptrdiff_t (target_disp), count, Datatype (T), win)
155
- end
156
- function Get (origin_buffer:: AbstractArray{T} , target_rank:: Integer , win:: Win ) where T
157
- count = length (origin_buffer)
158
- Get (origin_buffer, count, target_rank, 0 , win)
159
- end
160
- function Get (origin_value:: Ref{T} , target_rank:: Integer , win:: Win ) where T
161
- Get (origin_value, 1 , target_rank, 0 , win)
156
+ origin_buf. data, origin_buf. count, origin_buf. datatype,
157
+ target_rank, Cptrdiff_t (target_disp), origin_buf. count, origin_buf. datatype, win)
162
158
end
159
+ Get (origin:: Union{AbstractArray,Ref} , target_rank:: Integer , target_disp:: Integer , win:: Win ) =
160
+ Get (Buffer (origin), target_rank, target_disp, win)
161
+ Get (origin, target_rank:: Integer , win:: Win ) =
162
+ Get (origin, target_rank, 0 , win)
163
163
164
- function Put (origin_buffer, count :: Integer , target_rank:: Integer , target_disp:: Integer , win:: Win )
164
+ function Put (origin_buf :: Buffer , target_rank:: Integer , target_disp:: Integer , win:: Win )
165
165
# int MPI_Put(const void *origin_addr, int origin_count,
166
166
# MPI_Datatype origin_datatype, int target_rank,
167
167
# MPI_Aint target_disp, int target_count,
168
168
# MPI_Datatype target_datatype, MPI_Win win)
169
- T = eltype (origin_buffer)
170
169
@mpichk ccall ((:MPI_Put , libmpi), Cint,
171
170
(MPIPtr, Cint, MPI_Datatype, Cint, Cptrdiff_t, Cint, MPI_Datatype, MPI_Win),
172
- origin_buffer, count, Datatype (T), target_rank, Cptrdiff_t (target_disp), count, Datatype (T), win)
173
- end
174
- function Put (origin_buffer:: AbstractArray{T} , target_rank:: Integer , win:: Win ) where T
175
- count = length (origin_buffer)
176
- Put (origin_buffer, count, target_rank, 0 , win)
177
- end
178
- function Put (origin_value:: Ref{T} , target_rank:: Integer , win:: Win ) where T
179
- Put (origin_value, 1 , target_rank, 0 , win)
171
+ origin_buf. data, origin_buf. count, origin_buf. datatype,
172
+ target_rank, Cptrdiff_t (target_disp), origin_buf. count, origin_buf. datatype, win)
180
173
end
174
+ Put (origin:: Union{AbstractArray,Ref} , target_rank:: Integer , target_disp:: Integer , win:: Win ) =
175
+ Put (Buffer (origin), target_rank, target_disp, win)
176
+ Put (origin, target_rank:: Integer , win:: Win ) =
177
+ Put (origin, target_rank, 0 , win)
181
178
179
+ # TODO : come up with a nicer interface
182
180
function Fetch_and_op (sourceval, returnval, target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win )
183
181
# int MPI_Fetch_and_op(const void *origin_addr, void *result_addr,
184
182
# MPI_Datatype datatype, int target_rank, MPI_Aint target_disp,
@@ -190,26 +188,32 @@ function Fetch_and_op(sourceval, returnval, target_rank::Integer, target_disp::I
190
188
sourceval, returnval, Datatype (T), target_rank, target_disp, op, win)
191
189
end
192
190
193
- function Accumulate (origin_buffer, count :: Integer , target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win )
191
+ function Accumulate (origin_buf :: Buffer , target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win )
194
192
# int MPI_Accumulate(const void *origin_addr, int origin_count,
195
193
# MPI_Datatype origin_datatype, int target_rank,
196
194
# MPI_Aint target_disp, int target_count,
197
195
# MPI_Datatype target_datatype, MPI_Op op, MPI_Win win)
198
- T = eltype (origin_buffer)
199
196
@mpichk ccall ((:MPI_Accumulate , libmpi), Cint,
200
197
(MPIPtr, Cint, MPI_Datatype, Cint, Cptrdiff_t, Cint, MPI_Datatype, MPI_Op, MPI_Win),
201
- origin_buffer, count, Datatype (T), target_rank, Cptrdiff_t (target_disp), count, Datatype (T), op, win)
198
+ origin_buf. data, origin_buf. count, origin_buf. datatype,
199
+ target_rank, Cptrdiff_t (target_disp), origin_buf. count, origin_buf. datatype, op, win)
202
200
end
201
+ Accumulate (origin, target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win ) =
202
+ Accumulate (Buffer (origin), target_rank, target_disp, op, win)
203
203
204
- function Get_accumulate (origin_buffer, result_buffer, count :: Integer , target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win )
204
+ function Get_accumulate (origin_buf :: Buffer , result_buf :: Buffer , target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win )
205
205
# int MPI_Get_accumulate(const void *origin_addr, int origin_count,
206
206
# MPI_Datatype origin_datatype, void *result_addr,
207
207
# int result_count, MPI_Datatype result_datatype,
208
208
# int target_rank, MPI_Aint target_disp, int target_count,
209
209
# MPI_Datatype target_datatype, MPI_Op op, MPI_Win win)
210
- @assert eltype (origin_buffer) == eltype (result_buffer)
211
- T = eltype (origin_buffer)
212
210
@mpichk ccall ((:MPI_Get_accumulate , libmpi), Cint,
213
- (MPIPtr, Cint, MPI_Datatype, MPIPtr, Cint, MPI_Datatype, Cint, Cptrdiff_t, Cint, MPI_Datatype, MPI_Op, MPI_Win),
214
- origin_buffer, count, Datatype (T), result_buffer, count, Datatype (T), target_rank, Cptrdiff_t (target_disp), count, Datatype (T), op, win)
215
- end
211
+ (MPIPtr, Cint, MPI_Datatype,
212
+ MPIPtr, Cint, MPI_Datatype,
213
+ Cint, Cptrdiff_t, Cint, MPI_Datatype, MPI_Op, MPI_Win),
214
+ origin_buf. data, origin_buf. count, origin_buf. datatype,
215
+ result_buf. data, result_buf. count, result_buf. datatype,
216
+ target_rank, Cptrdiff_t (target_disp), origin_buf. count, origin_buf. datatype, op, win)
217
+ end
218
+ Get_accumulate (origin, result, target_rank:: Integer , target_disp:: Integer , op:: Op , win:: Win ) =
219
+ Get_accumulate (Buffer (origin), Buffer (result), target_rank, target_disp, op, win)
0 commit comments