@@ -81,7 +81,7 @@ function Reduce!(sendbuf::MPIBuffertype{T}, recvbuf::MPIBuffertype{T},
81
81
count:: Integer , op:: Union{Op,MPI_Op} , root:: Integer ,
82
82
comm:: Comm ) where T
83
83
isroot = Comm_rank (comm) == root
84
- isroot && @assert length (recvbuf) >= count
84
+ isroot && typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= count
85
85
# int MPI_Reduce(const void* sendbuf, void* recvbuf, int count,
86
86
# MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
87
87
@mpichk ccall ((:MPI_Reduce , libmpi), Cint,
@@ -161,7 +161,7 @@ function Reduce_in_place!(buf::MPIBuffertype{T}, count::Integer,
161
161
op:: Union{Op,MPI_Op} , root:: Integer ,
162
162
comm:: Comm ) where T
163
163
if Comm_rank (comm) == root
164
- @assert length (buf) >= count
164
+ typeof (buf) <: AbstractArray && @assert length (buf) >= count
165
165
@mpichk ccall ((:MPI_Reduce , libmpi), Cint,
166
166
(Ptr{T}, Ptr{T}, Cint, MPI_Datatype, MPI_Op, Cint, MPI_Comm),
167
167
MPI_IN_PLACE, buf, count, mpitype (T), op, root, comm)
@@ -195,7 +195,7 @@ To handle allocation of the output buffer, see [`Allreduce`](@ref).
195
195
"""
196
196
function Allreduce! (sendbuf:: MPIBuffertypeOrConst{T} , recvbuf:: MPIBuffertype{T} ,
197
197
count:: Integer , op:: Union{Op,MPI_Op} , comm:: Comm ) where T
198
- @assert length (recvbuf) >= count
198
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= count
199
199
# int MPI_Allreduce(const void* sendbuf, void* recvbuf, int count,
200
200
# MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
201
201
@mpichk ccall ((:MPI_Allreduce , libmpi), Cint,
@@ -279,9 +279,9 @@ To handle allocation of the output buffer, see [`Scatter`](@ref).
279
279
function Scatter! (sendbuf:: MPIBuffertype{T} , recvbuf:: MPIBuffertype{T} ,
280
280
count:: Integer , root:: Integer ,
281
281
comm:: Comm ) where T
282
- @assert length (recvbuf) >= count
282
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= count
283
283
isroot = Comm_rank (comm) == root
284
- isroot && @assert length (sendbuf) >= count* Comm_size (comm)
284
+ isroot && typeof (sendbuf) <: AbstractArray && @assert length (sendbuf) >= count* Comm_size (comm)
285
285
286
286
# int MPI_Scatter(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
287
287
# void* recvbuf, int recvcount, MPI_Datatype recvtype, int root,
@@ -352,7 +352,7 @@ function Scatterv!(sendbuf::MPIBuffertype{T}, recvbuf::MPIBuffertype{T},
352
352
counts:: Vector{Cint} , root:: Integer , comm:: Comm ) where T
353
353
recvcnt = counts[Comm_rank (comm) + 1 ]
354
354
disps = accumulate (+ , counts) - counts
355
- @assert length (recvbuf) >= recvcnt
355
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= recvcnt
356
356
# int MPI_Scatterv(const void* sendbuf, const int sendcounts[],
357
357
# const int displs[], MPI_Datatype sendtype, void* recvbuf,
358
358
# int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
@@ -396,7 +396,7 @@ function Scatterv_in_place!(buf::MPIBuffertype{T}, counts::Vector{Cint},
396
396
root:: Integer , comm:: Comm ) where T
397
397
recvcnt = counts[Comm_rank (comm) + 1 ]
398
398
disps = accumulate (+ , counts) - counts
399
- @assert length (buf) >= recvcnt
399
+ typeof (buf) <: AbstractArray && @assert length (buf) >= recvcnt
400
400
401
401
if Comm_rank (comm) == root
402
402
@mpichk ccall ((:MPI_Scatterv , libmpi), Cint,
@@ -424,9 +424,9 @@ To perform the reduction in place refer to [`Gather_in_place!`](@ref).
424
424
"""
425
425
function Gather! (sendbuf:: MPIBuffertype{T} , recvbuf:: MPIBuffertype{T} ,
426
426
count:: Integer , root:: Integer , comm:: Comm ) where T
427
- @assert length (sendbuf) >= count
427
+ typeof (sendbuf) <: AbstractArray && @assert length (sendbuf) >= count
428
428
isroot = Comm_rank (comm) == root
429
- isroot && @assert length (recvbuf) >= count* Comm_size (comm)
429
+ isroot && typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= count* Comm_size (comm)
430
430
431
431
# int MPI_Gather(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
432
432
# void* recvbuf, int recvcount, MPI_Datatype recvtype, int root,
486
486
function Gather_in_place! (buf:: MPIBuffertype{T} , count:: Integer , root:: Integer ,
487
487
comm:: Comm ) where T
488
488
if Comm_rank (comm) == root
489
- @assert length (buf) >= count* Comm_size (comm)
489
+ typeof (buf) <: AbstractArray && @assert length (buf) >= count* Comm_size (comm)
490
490
@mpichk ccall ((:MPI_Gather , libmpi), Cint,
491
491
(Ptr{T}, Cint, MPI_Datatype, Ptr{T}, Cint, MPI_Datatype, Cint, MPI_Comm),
492
492
MPI_IN_PLACE, count, mpitype (T), buf, count, mpitype (T), root, comm)
@@ -511,7 +511,7 @@ contribution.
511
511
"""
512
512
function Allgather! (sendbuf:: MPIBuffertypeOrConst{T} , recvbuf:: MPIBuffertype{T} ,
513
513
count:: Integer , comm:: Comm ) where T
514
- @assert length (recvbuf) >= Comm_size (comm)* count
514
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= Comm_size (comm)* count
515
515
# int MPI_Allgather(const void* sendbuf, int sendcount,
516
516
# MPI_Datatype sendtype, void* recvbuf, int recvcount,
517
517
# MPI_Datatype recvtype, MPI_Comm comm)
@@ -573,7 +573,7 @@ function Gatherv!(sendbuf::MPIBuffertype{T}, recvbuf::MPIBuffertype{T},
573
573
isroot = Comm_rank (comm) == root
574
574
displs = accumulate (+ , counts) - counts
575
575
sendcnt = counts[Comm_rank (comm) + 1 ]
576
- isroot && @assert length (recvbuf) >= sum (counts)
576
+ isroot && typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= sum (counts)
577
577
# int MPI_Gatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
578
578
# void* recvbuf, const int recvcounts[], const int displs[],
579
579
# MPI_Datatype recvtype, int root, MPI_Comm comm)
@@ -620,7 +620,7 @@ function Gatherv_in_place!(buf::MPIBuffertype{T}, counts::Vector{Cint},
620
620
sendcnt = counts[Comm_rank (comm) + 1 ]
621
621
622
622
if isroot
623
- @assert length (buf) >= sum (counts)
623
+ typeof (buf) <: AbstractArray && @assert length (buf) >= sum (counts)
624
624
@mpichk ccall ((:MPI_Gatherv , libmpi), Cint,
625
625
(Ptr{T}, Cint, MPI_Datatype, Ptr{T}, Ptr{Cint}, Ptr{Cint}, MPI_Datatype, Cint, MPI_Comm),
626
626
MPI_IN_PLACE, sendcnt, mpitype (T), buf, counts, displs, mpitype (T), root, comm)
@@ -645,7 +645,7 @@ the interval of `recvbuf` where it would store it's own data.
645
645
"""
646
646
function Allgatherv! (sendbuf:: MPIBuffertypeOrConst{T} , recvbuf:: MPIBuffertype{T} ,
647
647
counts:: Vector{Cint} , comm:: Comm ) where T
648
- @assert length (recvbuf) >= sum (counts)
648
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) >= sum (counts)
649
649
displs = accumulate (+ , counts) - counts
650
650
sendcnt = counts[Comm_rank (comm) + 1 ]
651
651
# int MPI_Allgatherv(const void* sendbuf, int sendcount,
731
731
function Alltoallv! (sendbuf:: MPIBuffertype{T} , recvbuf:: MPIBuffertype{T} ,
732
732
scounts:: Vector{Cint} , rcounts:: Vector{Cint} ,
733
733
comm:: Comm ) where T
734
- @assert length (recvbuf) == sum (rcounts)
734
+ typeof (recvbuf) <: AbstractArray && @assert length (recvbuf) == sum (rcounts)
735
735
736
736
sdispls = accumulate (+ , scounts) - scounts
737
737
rdispls = accumulate (+ , rcounts) - rcounts
0 commit comments