-
Notifications
You must be signed in to change notification settings - Fork 2
CI on ALPS #242
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
Open
luraess
wants to merge
34
commits into
main
Choose a base branch
from
lr/alps-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+212
−16
Open
CI on ALPS #242
Changes from 10 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3f5099a
Add CI rules for ALPS
luraess 383f33b
Update
luraess e873240
Fixup
luraess 632f44f
Fixup
luraess 4fe15a4
Add more testing
luraess 124e4de
Trigger buildkite on 1.12
luraess fd8226c
Fixup
luraess a96a984
Add missing deps
luraess da33c65
Fixup ref test
luraess a541bee
Fixup
luraess 1d7b5bc
Fixup IGG call
luraess f75b0ba
More fixes
luraess 001315d
Fixup
luraess 6651039
fix init particles call
albert-de-montserrat 6a89663
Fixup
luraess 7374f02
allow scalar indexing
albert-de-montserrat a6a8db0
Allow scalar
luraess 8b38f67
try baremetal runner
luraess 77c2265
Merge branch 'lr/alps-ci' of github.com:JuliaGeodynamics/JustPIC.jl i…
luraess afa9e82
Fixup
luraess 819f058
Fixup
luraess 6a920c0
Fixup
luraess 2eda7ff
update 2D MPI advection
albert-de-montserrat b356294
New try
luraess f62e319
Merge branch 'lr/alps-ci' of github.com:JuliaGeodynamics/JustPIC.jl i…
luraess 1500f05
Up
luraess 6016e34
Cleanup
luraess 504f439
Cleanup
luraess 39db6f2
Cleanup
luraess 9698797
Format
luraess f6d1da6
AMDGPU fix trial
luraess 0e296c2
Fixup project
luraess bca90e6
Fixup format
luraess ca1fb3f
Add badge
luraess File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
include: | ||
- remote: 'https://gitlab.com/cscs-ci/recipes/-/raw/master/templates/v2/.ci-ext.yml' | ||
|
||
unit_test: | ||
extends: .uenv-runner-daint-gh200 | ||
image: julia/25.5:v1 | ||
script: | ||
- julia -e 'println("Instantiating project"); | ||
using Pkg; | ||
Pkg.develop(; path=pwd())' | ||
- julia -e 'println("Running tests"); | ||
using Pkg; | ||
Pkg.test("JustPIC"; test_args=["--backend=CUDA"])' | ||
variables: | ||
WITH_UENV_VIEW: 'juliaup' | ||
SLURM_JOB_NUM_NODES: 1 | ||
SLURM_NTASKS_PER_NODE: 1 | ||
SLURM_GPUS_PER_TASK: 1 | ||
SLURM_TIMELIMIT: "00:30:00" | ||
|
||
ref_test: | ||
extends: .uenv-runner-daint-gh200 | ||
image: julia/25.5:v1 | ||
script: | ||
- julia --project -e 'using Pkg; Pkg.instantiate()' | ||
- julia --project -e 'using Pkg; Pkg.add("CUDA")' | ||
- julia --project scripts/single_particle_advection_MPI_ci.jl | ||
variables: | ||
WITH_UENV_VIEW: 'juliaup' | ||
SLURM_JOB_NUM_NODES: 2 | ||
SLURM_NTASKS_PER_NODE: 4 | ||
SLURM_GPUS_PER_TASK: 1 | ||
SLURM_TIMELIMIT: "00:30:00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
using CUDA | ||
using JustPIC, JustPIC._2D | ||
|
||
using ImplicitGlobalGrid | ||
import MPI | ||
|
||
# Threads is the default backend, | ||
# to run on a CUDA GPU load CUDA.jl (i.e. "using CUDA"), | ||
# and to run on an AMD GPU load AMDGPU.jl (i.e. "using AMDGPU") | ||
const backend = CUDABackend # Options: CPUBackend, CUDABackend, AMDGPUBackend | ||
|
||
using ParallelStencil | ||
@init_parallel_stencil(CUDA, Float64, 2) | ||
|
||
# using GLMakie | ||
|
||
@inline init_particle_fields_cellarrays(particles, ::Val{N}) where {N} = ntuple(_ -> @fill(0.0, size(particles.coords[1])..., celldims = (cellsize(particles.index))), Val(N)) | ||
|
||
function expand_range(x::AbstractRange) | ||
dx = x[2] - x[1] | ||
n = length(x) | ||
x1, x2 = extrema(x) | ||
xI = x1 - dx | ||
xF = x2 + dx | ||
return LinRange(xI, xF, n + 2) | ||
end | ||
|
||
function expand_range(x::AbstractArray, dx) | ||
x1, x2 = extrema(x) | ||
xI = x1 - dx | ||
xF = x2 + dx | ||
return x = TA(vcat(xI, x, xF)) | ||
end | ||
|
||
# Analytical flow solution | ||
vx_stream(x, y) = 250 * sin(π * x) * cos(π * y) | ||
vy_stream(x, y) = -250 * cos(π * x) * sin(π * y) | ||
g(x) = Point2f( | ||
vx_stream(x[1], x[2]), | ||
vy_stream(x[1], x[2]) | ||
) | ||
|
||
function main() | ||
# Initialize particles ------------------------------- | ||
nxcell, max_xcell, min_xcell = 24, 24, 18 | ||
n = 32 | ||
nx = ny = n - 1 | ||
me, dims, = init_global_grid( | ||
n - 1, n - 1, 0; | ||
init_MPI = JustPIC.MPI.Initialized() ? false : true, | ||
overlapx = 2, overlapy = 2 | ||
) | ||
Lx = Ly = 1.0 | ||
dxi = dx, dy = Lx / (nx_g() - 1), Ly / (ny_g() - 1) | ||
# nodal vertices | ||
xvi = xv, yv = let | ||
dummy = zeros(n, n) | ||
xv = TA([x_g(i, dx, dummy) for i in axes(dummy, 1)]) | ||
|
||
yv = TA([y_g(i, dx, dummy) for i in axes(dummy, 2)]) | ||
xv, yv | ||
end | ||
# nodal centers | ||
xci = xc, yc = let | ||
dummy = zeros(nx, ny) | ||
xc = @zeros(nx) | ||
xc .= TA([x_g(i, dx, dummy) for i in axes(dummy, 1)]) | ||
yc = TA([y_g(i, dx, dummy) for i in axes(dummy, 2)]) | ||
xc, yc | ||
end | ||
|
||
# staggered grid for the velocity components | ||
grid_vx = xv, expand_range(yc, dy) | ||
grid_vy = expand_range(xc, dx), yv | ||
|
||
particles = init_particle( | ||
backend, nxcell, max_xcell, min_xcell, xv, yv, dxi..., nx, ny, me | ||
) | ||
|
||
# allocate particle field | ||
particle_args = () | ||
|
||
# Cell fields ------------------------------- | ||
Vx = TA([vx_stream(x, y) for x in grid_vx[1], y in grid_vx[2]]) | ||
Vy = TA([vy_stream(x, y) for x in grid_vy[1], y in grid_vy[2]]) | ||
V = Vx, Vy | ||
|
||
# time step | ||
dt = min(dx / maximum(abs.(Vx)), dy / maximum(abs.(Vy))) | ||
|
||
nx_v = (size(particles.coords[1].data, 2)) * dims[1] | ||
ny_v = (size(particles.coords[1].data, 3) - 2) * dims[2] | ||
px_v = fill(NaN, nx_v, ny_v) | ||
py_v = fill(NaN, nx_v, ny_v) | ||
index_v = fill(false, nx_v, ny_v) | ||
px_nohalo = fill(NaN, size(particles.coords[1].data, 2), size(particles.coords[1].data, 3) - 2) | ||
py_nohalo = fill(NaN, size(particles.coords[1].data, 2), size(particles.coords[1].data, 3) - 2) | ||
index_nohalo = fill(false, size(particles.coords[1].data, 2), size(particles.coords[1].data, 3) - 2) | ||
|
||
p = [(NaN, NaN)] | ||
|
||
# Advection test | ||
niter = 150 | ||
for iter in 1:niter | ||
|
||
# advect particles | ||
advection!(particles, RungeKutta2(2 / 3), V, (grid_vx, grid_vy), dt) | ||
# update halos | ||
update_cell_halo!(particles.coords..., particle_args...) | ||
update_cell_halo!(particles.index) | ||
|
||
# shuffle particles | ||
move_particles!(particles, xvi, particle_args) | ||
|
||
# gather particle data - for plotting only | ||
@views px_nohalo .= particles.coords[1].data[1, :, 2:(end - 1)] | ||
@views py_nohalo .= particles.coords[2].data[1, :, 2:(end - 1)] | ||
@views index_nohalo .= particles.index.data[1, :, 2:(end - 1)] | ||
gather!(px_nohalo, px_v) | ||
gather!(py_nohalo, py_v) | ||
gather!(index_nohalo, index_v) | ||
|
||
if me == 0 | ||
p_i = (px_v[index_v][1], py_v[index_v][1]) | ||
push!(p, p_i) | ||
end | ||
|
||
# if me == 0 && iter % 10 == 0 | ||
# w = 0.504 | ||
# offset = 0.5 - (w - 0.5) | ||
# f, ax, = lines( | ||
# [0, w, w, 0, 0], | ||
# [0, 0, w, w, 0], | ||
# linewidth = 3 | ||
# ) | ||
# lines!( | ||
# ax, | ||
# [0, w, w, 0, 0] .+ offset, | ||
# [0, 0, w, w, 0], | ||
# linewidth = 3 | ||
# ) | ||
# lines!( | ||
# ax, | ||
# [0, w, w, 0, 0] .+ offset, | ||
# [0, 0, w, w, 0] .+ offset, | ||
# linewidth = 3 | ||
# ) | ||
# lines!( | ||
# ax, | ||
# [0, w, w, 0, 0], | ||
# [0, 0, w, w, 0] .+ offset, | ||
# linewidth = 3 | ||
# ) | ||
# streamplot!(ax, g, LinRange(0, 1, 100), LinRange(0, 1, 100)) | ||
# lines!(ax, p, color = :red) | ||
# scatter!(ax, p[end], color = :black) | ||
# save("figs/trajectory_MPI_$iter.png", f) | ||
# end | ||
end | ||
|
||
return finalize_global_grid() | ||
end | ||
|
||
main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldnt it make more sense to have 'pre' here for the pre-releases?