Skip to content

Commit 264021f

Browse files
committed
Extend multicast for arbitrary types
1 parent b63e7aa commit 264021f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/mpi_array.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,19 @@ function multicast_impl!(
392392
@assert rcv.comm === snd.comm
393393
comm = snd.comm
394394
root = source - 1
395-
if MPI.Comm_rank(comm) == root
396-
rcv.item = snd.item
395+
if isbitstype(T)
396+
if MPI.Comm_rank(comm) == root
397+
rcv.item = snd.item
398+
end
399+
MPI.Bcast!(rcv.item_ref,root,comm)
400+
else
401+
if MPI.Comm_rank(comm) == root
402+
rcv.item_ref[] = MPI.bcast(snd.item,comm;root)
403+
else
404+
rcv.item_ref[] = MPI.bcast(nothing,comm;root)
405+
end
397406
end
398-
MPI.Bcast!(rcv.item_ref,root,comm)
407+
rcv
399408
end
400409

401410
function multicast_impl!(
@@ -408,6 +417,7 @@ function multicast_impl!(
408417
rcv.item = snd.item
409418
end
410419
MPI.Bcast!(rcv.item,root,comm)
420+
rcv
411421
end
412422

413423
function scan!(op,b::MPIArray,a::MPIArray;init,type)

0 commit comments

Comments
 (0)