@@ -571,6 +571,45 @@ function Ireduce{T}(object::T, op::Op, root::Integer, comm::Comm)
571571 req, isroot ? recvbuf[1 ] : nothing
572572end
573573
574+ function Allreduce {T} (sendbuf:: MPIBuffertype{T} , count:: Integer , op:: Op , comm:: Comm )
575+ recvbuf = Array (T, count)
576+ ccall (MPI_ALLREDUCE, Void,
577+ (Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
578+ sendbuf, recvbuf, & count, & mpitype (T), & op. val, & comm. val, & 0 )
579+ recvbuf
580+ end
581+
582+ function Allreduce {T} (sendbuf:: Array{T} , op:: Op , comm:: Comm )
583+ Allreduce (sendbuf, length (sendbuf), op, comm)
584+ end
585+
586+ function Allreduce {T} (object:: T , op:: Op , comm:: Comm )
587+ sendbuf = T[object]
588+ recvbuf = Allreduce (sendbuf, op, comm)
589+ recvbuf[1 ]
590+ end
591+
592+ function Iallreduce {T} (sendbuf:: MPIBuffertype{T} , count:: Integer , op:: Op , comm:: Comm )
593+ rval = Ref {Cint} ()
594+ recvbuf = Array (T, count)
595+ ccall (MPI_IALLREDUCE, Void,
596+ (Ptr{T}, Ptr{T}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint},
597+ Ptr{Cint}, Ptr{Cint}),
598+ sendbuf, recvbuf, & count, & mpitype (T), & op. val, & comm. val,
599+ rval, & 0 )
600+ Request (rval[], sendbuf), recvbuf
601+ end
602+
603+ function Iallreduce {T} (sendbuf:: Array{T} , op:: Op , comm:: Comm )
604+ Iallreduce (sendbuf, length (sendbuf), op, comm)
605+ end
606+
607+ function Iallreduce {T} (object:: T , op:: Op , comm:: Comm )
608+ sendbuf = T[object]
609+ req, recvbuf = Iallreduce (sendbuf, op, comm)
610+ req, recvbuf[1 ]
611+ end
612+
574613function Scatter {T} (sendbuf:: MPIBuffertype{T} ,
575614 count:: Integer , root:: Integer , comm:: Comm )
576615 recvbuf = Array (T, count)
0 commit comments