From 4cc4619434bbbaa1f8d9e38f9ff2b0aebc1c3b5b Mon Sep 17 00:00:00 2001 From: Francesc Verdugo Date: Wed, 10 Jan 2024 17:24:28 +0100 Subject: [PATCH] Rename emit -> mutlicast --- docs/src/reference/primitives.md | 6 ++-- src/PartitionedArrays.jl | 6 ++-- src/debug_array.jl | 8 ++--- src/mpi_array.jl | 10 +++--- src/p_range.jl | 2 +- src/primitives.jl | 40 +++++++++++------------ test/mpi_array/drivers/exception_tests.jl | 2 +- test/primitives_tests.jl | 4 +-- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/src/reference/primitives.md b/docs/src/reference/primitives.md index aadee8f7..761f2ad6 100644 --- a/docs/src/reference/primitives.md +++ b/docs/src/reference/primitives.md @@ -19,9 +19,9 @@ allocate_scatter ## Emit ```@docs -emit -emit! -allocate_emit +multicast +multicast! +allocate_multicast ``` ## Scan diff --git a/src/PartitionedArrays.jl b/src/PartitionedArrays.jl index 6375aa81..29e5386f 100644 --- a/src/PartitionedArrays.jl +++ b/src/PartitionedArrays.jl @@ -34,9 +34,9 @@ export allocate_gather export scatter export scatter! export allocate_scatter -export emit -export emit! -export allocate_emit +export multicast +export multicast! +export allocate_multicast export scan export scan! export reduction diff --git a/src/debug_array.jl b/src/debug_array.jl index c3b12015..4e399033 100644 --- a/src/debug_array.jl +++ b/src/debug_array.jl @@ -142,16 +142,16 @@ function scatter_impl!( scatter_impl!(rcv.items,snd.items,source,T) end -function emit_impl!( +function multicast_impl!( rcv::DebugArray,snd::DebugArray, source,::Type{T}) where T - emit_impl!(rcv.items,snd.items,source,T) + multicast_impl!(rcv.items,snd.items,source,T) end -function emit_impl!( +function multicast_impl!( rcv::DebugArray,snd::DebugArray, source,::Type{T}) where T<:AbstractVector - emit_impl!(rcv.items,snd.items,source,T) + multicast_impl!(rcv.items,snd.items,source,T) end Base.reduce(op,a::DebugArray;kwargs...) = reduce(op,a.items;kwargs...) diff --git a/src/mpi_array.jl b/src/mpi_array.jl index 05d0b7b9..a2ad6e99 100644 --- a/src/mpi_array.jl +++ b/src/mpi_array.jl @@ -365,7 +365,7 @@ function scatter_impl!( rcv end -function emit_impl!( +function multicast_impl!( rcv::MPIArray,snd::MPIArray, source,::Type{T}) where T @assert rcv.comm === snd.comm @@ -377,7 +377,7 @@ function emit_impl!( MPI.Bcast!(rcv.item_ref,root,comm) end -function emit_impl!( +function multicast_impl!( rcv::MPIArray,snd::MPIArray, source,::Type{T}) where T<:AbstractVector @assert rcv.comm === snd.comm @@ -585,7 +585,7 @@ function find_rcv_ids_ibarrier(snd_ids::MPIArray{<:AbstractVector{T}}) where T end rcv_ids=T[] done=false - barrier_emitted=false + barrier_multicastted=false all_sends_done=false barrier_req=nothing status = Ref(MPI.STATUS_ZERO) @@ -602,13 +602,13 @@ function find_rcv_ids_ibarrier(snd_ids::MPIArray{<:AbstractVector{T}}) where T @boundscheck @assert tag_rcv == tag "Inconsistent tag in ExchangeGraph_impl()!" end - if (barrier_emitted) + if (barrier_multicastted) done=MPI.Test(barrier_req) else all_sends_done = MPI.Testall(requests) if (all_sends_done) barrier_req=MPI.Ibarrier(comm) - barrier_emitted=true + barrier_multicastted=true end end end diff --git a/src/p_range.jl b/src/p_range.jl index ce87fc32..a335a597 100644 --- a/src/p_range.jl +++ b/src/p_range.jl @@ -742,7 +742,7 @@ The argument `global_to_color` is the usual output of such tools. """ function partition_from_color(ranks,global_to_color;multicast=false,source=MAIN) if multicast == true - global_to_owner = getany(emit(global_to_color;source)) + global_to_owner = getany(multicast(global_to_color;source)) else global_to_owner = global_to_color end diff --git a/src/primitives.jl b/src/primitives.jl index 60ff7dc9..ade8f349 100644 --- a/src/primitives.jl +++ b/src/primitives.jl @@ -339,7 +339,7 @@ function scatter_impl!(rcv,snd,source,::Type{T}) where T end """ - emit(snd;source=MAIN) + multicast(snd;source=MAIN) Copy `snd[source]` into a new array of the same size and type as `snd`. @@ -355,7 +355,7 @@ julia> a = [0,0,2,0] 2 0 -julia> emit(a,source=3) +julia> multicast(a,source=3) 4-element Vector{Int64}: 2 2 @@ -363,37 +363,37 @@ julia> emit(a,source=3) 2 ``` """ -function emit(snd;source=MAIN) +function multicast(snd;source=MAIN) T = eltype(snd) - emit_impl(snd,source,T) + multicast_impl(snd,source,T) end -function emit_impl(snd,source,::Type{T}) where T +function multicast_impl(snd,source,::Type{T}) where T @assert source !== :all "All to all not implemented" - rcv = allocate_emit(snd;source) - emit!(rcv,snd;source) + rcv = allocate_multicast(snd;source) + multicast!(rcv,snd;source) rcv end """ - allocate_emit(snd;source=1) + allocate_multicast(snd;source=1) -Allocate an array to be used in the first argument of [`emit!`](@ref). +Allocate an array to be used in the first argument of [`multicast!`](@ref). """ -function allocate_emit(snd;source=1) +function allocate_multicast(snd;source=1) T = eltype(snd) - allocate_emit_impl(snd,source,T) + allocate_multicast_impl(snd,source,T) end -function allocate_emit_impl(snd,source,::Type{T}) where T +function allocate_multicast_impl(snd,source,::Type{T}) where T @assert source !== :all "Scatter all not implemented" similar(snd) end -function allocate_emit_impl(snd,source,::Type{T}) where T<:AbstractVector +function allocate_multicast_impl(snd,source,::Type{T}) where T<:AbstractVector @assert source !== :all "Scatter all not implemented" n = map(length,snd) - n_all = emit(n;source) + n_all = multicast(n;source) S = eltype(T) map(n_all) do n Vector{S}(undef,n) @@ -401,18 +401,18 @@ function allocate_emit_impl(snd,source,::Type{T}) where T<:AbstractVector end """ - emit!(rcv,snd;source=1) + multicast!(rcv,snd;source=1) -In-place version of [`emit`](@ref). The destination array `rcv` -can be generated with the helper function [`allocate_emit`](@ref). +In-place version of [`multicast`](@ref). The destination array `rcv` +can be generated with the helper function [`allocate_multicast`](@ref). It returns `rcv`. """ -function emit!(rcv,snd;source=1) +function multicast!(rcv,snd;source=1) T = eltype(snd) - emit_impl!(rcv,snd,source,T) + multicast_impl!(rcv,snd,source,T) end -function emit_impl!(rcv,snd,source,::Type{T}) where T +function multicast_impl!(rcv,snd,source,::Type{T}) where T @assert source !== :all "Emit all not implemented" for i in eachindex(rcv) rcv[i] = snd[source] diff --git a/test/mpi_array/drivers/exception_tests.jl b/test/mpi_array/drivers/exception_tests.jl index 107e17ac..453839ff 100644 --- a/test/mpi_array/drivers/exception_tests.jl +++ b/test/mpi_array/drivers/exception_tests.jl @@ -10,7 +10,7 @@ function exception_tests(distribute) 0 end end - p = emit(p_main) + p = multicast(p_main) map(parts,p) do part,part_fail @assert part_fail != part end diff --git a/test/primitives_tests.jl b/test/primitives_tests.jl index 41aa02f3..db8da705 100644 --- a/test/primitives_tests.jl +++ b/test/primitives_tests.jl @@ -61,12 +61,12 @@ function primitives_tests(distribute) @test rcv == [[1],[1,2],[1,2,3],[1,2,3,4]] end - rcv = emit(rank,source=2) + rcv = multicast(rank,source=2) map(rcv) do rcv @test rcv == 2 end - rcv = emit(snd,source=2) + rcv = multicast(snd,source=2) map(rcv) do rcv @test rcv == [1,2] end