Skip to content

Commit

Permalink
Merge pull request #151 from mabarnes/update-checkout-action
Browse files Browse the repository at this point in the history
Update deprecated syntax and versions
  • Loading branch information
johnomotani authored Nov 21, 2023
2 parents 9fef965 + af20942 commit 190d5d5
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/debug_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
timeout-minutes: 240

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: mpi4py/setup-mpi@v1
with:
mpi: 'openmpi'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: '1.8'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Delete preview and history + push changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 35

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/longtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 90

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/parallel_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 120

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: mpi4py/setup-mpi@v1
with:
mpi: 'openmpi'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 50

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand Down
22 changes: 7 additions & 15 deletions src/communication.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/velocity_grid_transforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function vzvrvzeta_to_vpavperp_species!(f_out,f_in,vz,vr,vzeta,vpa,vperp,gyropha
@boundscheck vpa.n == size(f_out, 1) || throw(BoundsError(f_out))
@boundscheck vperp.n == size(f_out, 2) || throw(BoundsError(f_out))

pdf_interp = LinearInterpolation((vz.grid,vr.grid,vzeta.grid),f_in,extrapolation_bc = 0.0)
pdf_interp = linear_interpolation((vz.grid,vr.grid,vzeta.grid),f_in,extrapolation_bc = 0.0)
# pdf_interp( vz_val, vr_val, vzeta_val) is interpolated value of f_in
# extrapolation_bc = 0.0 makes pdf_interp = 0.0 for |vx| > vx.L/2 (x = z,r,zeta)

Expand Down Expand Up @@ -92,7 +92,7 @@ function vpavperp_to_vzvrvzeta_species!(f_out,f_in,vz,vr,vzeta,vpa,vperp,geometr
@boundscheck vpa.n == size(f_in, 1) || throw(BoundsError(f_in))
@boundscheck vperp.n == size(f_in, 2) || throw(BoundsError(f_in))

pdf_interp = LinearInterpolation((vpa.grid,vperp.grid),f_in,extrapolation_bc = 0.0)
pdf_interp = linear_interpolation((vpa.grid,vperp.grid),f_in,extrapolation_bc = 0.0)
# pdf_interp( vz_val, vr_val, vzeta_val) is interpolated value of f_in
# extrapolation_bc = 0.0 makes pdf_interp = 0.0 for |vpa| > vpa.L/2 and vperp > vperp.L

Expand Down

0 comments on commit 190d5d5

Please sign in to comment.