Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecated syntax and versions #151

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace deprecated MPI.Win_allocate_shared() and MPI.Win_shared_query()
Slight change of interface, to work with Arrays rather than Ptrs.
johnomotani committed Nov 20, 2023
commit e1998871a2805f8b0230175ca675d13f600c1497
22 changes: 7 additions & 15 deletions src/communication.jl
Original file line number Diff line number Diff line change
@@ -357,9 +357,9 @@ function allocate_shared(T, dims)

if br == 0
# Allocate points on rank-0 for simplicity
n_local = n
dims_local = dims
else
n_local = 0
dims_local = Tuple(0 for _ ∈ dims)
end

@debug_shared_array_allocate begin
@@ -385,26 +385,18 @@ function allocate_shared(T, dims)
end
end

win, ptr = MPI.Win_allocate_shared(T, n_local, comm_block[])
win, array_temp = MPI.Win_allocate_shared(Array{T}, dims_local, comm_block[])

# Array is allocated contiguously, but `ptr` points to the 'locally owned' part.
# We want to use as a shared array, so want to wrap the entire shared array.
# Get start pointer of array from rank-0 process. Cannot use ptr, as this
# is null when n_local=0.
_, _, base_ptr = MPI.Win_shared_query(win, 0)
base_ptr = Ptr{T}(base_ptr)

if base_ptr == Ptr{Nothing}(0)
error("Got null pointer when trying to allocate shared array")
end
# Array is allocated contiguously, but `array_temp` contains only the 'locally owned'
# part. We want to use as a shared array, so want to wrap the entire shared array.
# Get array from rank-0 process, which 'owns' the whole array.
array = MPI.Win_shared_query(Array{T}, dims, win; rank=0)

# Don't think `win::MPI.Win` knows about the type of the pointer (its concrete type
# is something like `MPI.Win(Ptr{Nothing} @0x00000000033affd0)`), so it's fine to
# put them all in the same global_Win_store - this won't introduce type instability
push!(global_Win_store, win)

array = unsafe_wrap(Array, base_ptr, dims)

@debug_shared_array begin
# If @debug_shared_array is active, create DebugMPISharedArray instead of Array
debug_array = DebugMPISharedArray(array)