1
+ import Base: eltype
1
2
2
3
# definition of the `Status` struct.
3
4
# TODO : this bakes in a lot of assumptions about ordering and padding
94
95
Complete a blocking send of `count` elements of type `datatype` from `buf` to MPI
95
96
rank `dest` of communicator `comm` using the message tag `tag`
96
97
"""
97
- function Send (buf:: MPIBuffertype{T} , count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
98
- dest:: Integer , tag:: Integer , comm:: Comm ) where T
98
+ function Send (buf, count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
99
+ dest:: Integer , tag:: Integer , comm:: Comm )
99
100
# int MPI_Send(const void* buf, int count, MPI_Datatype datatype, int dest,
100
101
# int tag, MPI_Comm comm)
101
102
@mpichk ccall ((:MPI_Send , libmpi), Cint,
102
- (Ptr{T} , Cint, MPI_Datatype, Cint, Cint, MPI_Comm),
103
+ (MPIPtr , Cint, MPI_Datatype, Cint, Cint, MPI_Comm),
103
104
buf, count, datatype, dest, tag, comm)
104
105
end
105
106
@@ -110,18 +111,18 @@ end
110
111
Complete a blocking send of `count` elements of `buf` to MPI rank `dest`
111
112
of communicator `comm` using with the message tag `tag`
112
113
"""
113
- function Send (buf:: MPIBuffertype{T} , count:: Integer , dest:: Integer ,
114
- tag:: Integer , comm:: Comm ) where T
115
- Send (buf, count, mpitype (T ), dest, tag, comm)
114
+ function Send (buf, count:: Integer , dest:: Integer ,
115
+ tag:: Integer , comm:: Comm )
116
+ Send (buf, count, mpitype (eltype (buf) ), dest, tag, comm)
116
117
end
117
118
118
119
"""
119
- Send(buf::Array {T}, dest::Integer, tag::Integer, comm::Comm) where T
120
+ Send(buf::AbstractArray {T}, dest::Integer, tag::Integer, comm::Comm) where T
120
121
121
122
Complete a blocking send of `buf` to MPI rank `dest` of communicator `comm`
122
123
using with the message tag `tag`
123
124
"""
124
- function Send (buf:: Array {T} , dest:: Integer , tag:: Integer , comm:: Comm ) where T
125
+ function Send (buf:: AbstractArray {T} , dest:: Integer , tag:: Integer , comm:: Comm ) where T
125
126
Send (buf, length (buf), dest, tag, comm)
126
127
end
127
128
@@ -167,13 +168,13 @@ MPI rank `dest` of communicator `comm` using with the message tag `tag`
167
168
168
169
Returns the commication `Request` for the nonblocking send.
169
170
"""
170
- function Isend (buf:: MPIBuffertype{T} , count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
171
- dest:: Integer , tag:: Integer , comm:: Comm ) where T
171
+ function Isend (buf, count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
172
+ dest:: Integer , tag:: Integer , comm:: Comm )
172
173
req = Request ()
173
174
# int MPI_Isend(const void* buf, int count, MPI_Datatype datatype, int dest,
174
175
# int tag, MPI_Comm comm, MPI_Request *request)
175
176
@mpichk ccall ((:MPI_Isend , libmpi), Cint,
176
- (Ptr{T} , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{MPI_Request}),
177
+ (MPIPtr , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{MPI_Request}),
177
178
buf, count, datatype, dest, tag, comm, req)
178
179
req. buffer = buf
179
180
return req
@@ -188,9 +189,9 @@ of communicator `comm` using with the message tag `tag`
188
189
189
190
Returns the commication `Request` for the nonblocking send.
190
191
"""
191
- function Isend (buf:: MPIBuffertype{T} , count:: Integer ,
192
- dest:: Integer , tag:: Integer , comm:: Comm ) where T
193
- Isend (buf, count, mpitype (T ), dest, tag, comm)
192
+ function Isend (buf, count:: Integer ,
193
+ dest:: Integer , tag:: Integer , comm:: Comm )
194
+ Isend (buf, count, mpitype (eltype (buf) ), dest, tag, comm)
194
195
end
195
196
196
197
"""
@@ -201,8 +202,8 @@ using with the message tag `tag`
201
202
202
203
Returns the commication `Request` for the nonblocking send.
203
204
"""
204
- function Isend (buf:: Array {T} , dest:: Integer , tag:: Integer , comm:: Comm ) where T
205
- Isend (buf, length (buf), dest, tag, comm)
205
+ function Isend (buf:: AbstractArray {T} , dest:: Integer , tag:: Integer , comm:: Comm ) where T
206
+ Isend (buf, length (buf), mpitype (T), dest, tag, comm)
206
207
end
207
208
208
209
"""
@@ -216,7 +217,7 @@ Returns the commication `Request` for the nonblocking send.
216
217
function Isend (buf:: SubArray{T} , dest:: Integer , tag:: Integer ,
217
218
comm:: Comm ) where T
218
219
@assert Base. iscontiguous (buf)
219
- Isend (buf, length (buf), dest, tag, comm)
220
+ Isend (buf, length (buf), mpitype (T), dest, tag, comm)
220
221
end
221
222
222
223
"""
@@ -254,13 +255,13 @@ from MPI rank `src` of communicator `comm` using with the message tag `tag`
254
255
255
256
Returns the `Status` of the receive
256
257
"""
257
- function Recv! (buf:: MPIBuffertype{T} , count:: Integer , datatype:: Union{Datatype,MPI_Datatype} , src:: Integer ,
258
- tag:: Integer , comm:: Comm ) where T
258
+ function Recv! (buf, count:: Integer , datatype:: Union{Datatype,MPI_Datatype} , src:: Integer ,
259
+ tag:: Integer , comm:: Comm )
259
260
stat_ref = Ref {Status} ()
260
261
# int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source,
261
262
# int tag, MPI_Comm comm, MPI_Status *status)
262
263
@mpichk ccall ((:MPI_Recv , libmpi), Cint,
263
- (Ptr{T} , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{Status}),
264
+ (MPIPtr , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{Status}),
264
265
buf, count, datatype, src, tag, comm, stat_ref)
265
266
return stat_ref[]
266
267
end
@@ -274,9 +275,9 @@ Completes a blocking receive of up to `count` elements into `buf` from MPI rank
274
275
275
276
Returns the `Status` of the receive
276
277
"""
277
- function Recv! (buf:: MPIBuffertype{T} , count:: Integer , src:: Integer ,
278
- tag:: Integer , comm:: Comm ) where T
279
- Recv! (buf, count, mpitype (T ), src, tag, comm)
278
+ function Recv! (buf, count:: Integer , src:: Integer ,
279
+ tag:: Integer , comm:: Comm )
280
+ Recv! (buf, count, mpitype (eltype (buf) ), src, tag, comm)
280
281
end
281
282
282
283
@@ -288,7 +289,7 @@ Completes a blocking receive into `buf` from MPI rank `src` of communicator
288
289
289
290
Returns the `Status` of the receive
290
291
"""
291
- function Recv! (buf:: Array {T} , src:: Integer , tag:: Integer , comm:: Comm ) where T
292
+ function Recv! (buf:: AbstractArray {T} , src:: Integer , tag:: Integer , comm:: Comm ) where T
292
293
Recv! (buf, length (buf), src, tag, comm)
293
294
end
294
295
@@ -329,13 +330,13 @@ from MPI rank `src` of communicator `comm` using with the message tag `tag`
329
330
330
331
Returns the communication `Request` for the nonblocking receive.
331
332
"""
332
- function Irecv! (buf:: MPIBuffertype{T} , count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
333
+ function Irecv! (buf, count:: Integer , datatype:: Union{Datatype, MPI_Datatype} ,
333
334
src:: Integer , tag:: Integer , comm:: Comm ) where T
334
335
req = Request ()
335
336
# int MPI_Irecv(void* buf, int count, MPI_Datatype datatype, int source,
336
337
# int tag, MPI_Comm comm, MPI_Request *request)
337
338
@mpichk ccall ((:MPI_Irecv , libmpi), Cint,
338
- (Ptr{T} , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{MPI_Request}),
339
+ (MPIPtr , Cint, MPI_Datatype, Cint, Cint, MPI_Comm, Ptr{MPI_Request}),
339
340
buf, count, datatype, src, tag, comm, req)
340
341
req. buffer = buf
341
342
return req
@@ -350,9 +351,9 @@ from MPI rank `src` of communicator `comm` using with the message tag `tag`
350
351
351
352
Returns the communication `Request` for the nonblocking receive.
352
353
"""
353
- function Irecv! (buf:: MPIBuffertype{T} , count:: Integer ,
354
- src:: Integer , tag:: Integer , comm:: Comm ) where T
355
- Irecv! (buf, count, mpitype (T ), src, tag, comm)
354
+ function Irecv! (buf, count:: Integer ,
355
+ src:: Integer , tag:: Integer , comm:: Comm )
356
+ Irecv! (buf, count, mpitype (eltype (buf) ), src, tag, comm)
356
357
end
357
358
358
359
"""
@@ -363,9 +364,9 @@ Starts a nonblocking receive into `buf` from MPI rank `src` of communicator
363
364
364
365
Returns the communication `Request` for the nonblocking receive.
365
366
"""
366
- function Irecv! (buf:: Array {T} , src:: Integer , tag:: Integer ,
367
+ function Irecv! (buf:: AbstractArray {T} , src:: Integer , tag:: Integer ,
367
368
comm:: Comm ) where T
368
- Irecv! (buf, length (buf), src, tag, comm)
369
+ Irecv! (buf, length (buf), mpitype (T), src, tag, comm)
369
370
end
370
371
371
372
"""
@@ -380,7 +381,7 @@ Returns the communication `Request` for the nonblocking receive.
380
381
function Irecv! (buf:: SubArray{T} , src:: Integer , tag:: Integer ,
381
382
comm:: Comm ) where T
382
383
@assert Base. iscontiguous (buf)
383
- Irecv! (buf, length (buf), src, tag, comm)
384
+ Irecv! (buf, length (buf), mpitype (T), src, tag, comm)
384
385
end
385
386
386
387
function irecv (src:: Integer , tag:: Integer , comm:: Comm )
0 commit comments