Skip to content

Commit 93a1a7e

Browse files
authored
Add HPSF GitLab CI (#4788)
The CI test at gitlab.spack.io will be run nightly and it can be triggered by PR comment `/run-hpsf-gitlab-ci` from @asalmgren, @atmyers, @ax3l, and @WeiqunZhang, if the setup works. Disabled the NeighborParticle test in 1D for now, because it fails the GPU tests (due a bug?).
1 parent 551925d commit 93a1a7e

File tree

3 files changed

+187
-0
lines changed

3 files changed

+187
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: HPSF GitLab CI
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
env:
8+
GITLAB_PROJECT_PATH: "amrex/amrex"
9+
GITLAB_PROJECT_ID: "70"
10+
11+
jobs:
12+
run-hpsf-gitlab-ci:
13+
if: |
14+
github.event.issue.pull_request &&
15+
contains(fromJson('["atmyers","asalmgren","ax3l","WeiqunZhang"]'), github.actor) &&
16+
contains(github.event.comment.body, '/run-hpsf-gitlab-ci')
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Determine PR merge ref
21+
id: setref
22+
shell: bash
23+
run: |
24+
PR_NUMBER=${{ github.event.issue.number }}
25+
MERGE_REF="refs/pull/$PR_NUMBER/merge"
26+
echo "merge_ref=$MERGE_REF" >> $GITHUB_OUTPUT
27+
echo "Using merge ref: $MERGE_REF"
28+
29+
- name: Trigger GitLab pipeline
30+
id: trigger
31+
shell: bash
32+
run: |
33+
MERGE_REF="${{ steps.setref.outputs.merge_ref }}"
34+
echo "Triggering GitLab pipeline for ref: $MERGE_REF"
35+
36+
RESPONSE=$(curl -s -X POST \
37+
-F token=${{ secrets.HPSF_GITLAB_TRIGGER_TOKEN }} \
38+
-F ref=development \
39+
-F "variables[GITHUB_PR_NUMBER]=${{ github.event.issue.number }}" \
40+
-F "variables[GITHUB_MERGE_REF]=refs/pull/${{ github.event.issue.number }}/merge" \
41+
-F "variables[GITHUB_TRIGGER_ACTOR]=${{ github.actor }}" \
42+
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/trigger/pipeline")
43+
44+
echo "GitLab response: $RESPONSE"
45+
46+
PIPELINE_ID=$(echo "$RESPONSE" | jq -r '.id')
47+
48+
if [ "$PIPELINE_ID" == "null" ] || [ -z "$PIPELINE_ID" ]; then
49+
echo "Failed to trigger GitLab pipeline."
50+
exit 1
51+
fi
52+
53+
echo "Pipeline URL: https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
54+
echo "pipeline_id=$PIPELINE_ID" >> $GITHUB_OUTPUT
55+
56+
- name: Wait for GitLab pipeline to finish
57+
id: wait
58+
shell: bash
59+
run: |
60+
PIPELINE_ID=${{ steps.trigger.outputs.pipeline_id }}
61+
62+
echo "Waiting on GitLab pipeline $PIPELINE_ID..."
63+
64+
STATUS="running"
65+
while [[ "$STATUS" == "running" || "$STATUS" == "pending" ]]; do
66+
sleep 300
67+
STATUS=$(curl -s \
68+
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/$PIPELINE_ID" \
69+
| jq -r '.status')
70+
echo "Status: $STATUS"
71+
done
72+
73+
echo "final_status=$STATUS" >> $GITHUB_OUTPUT
74+
75+
- name: Post result back to GitHub PR
76+
shell: bash
77+
run: |
78+
STATUS=${{ steps.wait.outputs.final_status }}
79+
PIPELINE_ID=${{ steps.trigger.outputs.pipeline_id }}
80+
PIPELINE_URL="https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
81+
COMMENT="GitLab CI finished with status: **$STATUS**. See details at ${PIPELINE_URL}."
82+
83+
gh api \
84+
repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
85+
-f body="$COMMENT" || echo "Failed to post comment to GitHub"
86+
env:
87+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitlab/hpsf-gitlab-ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
.dependency-n-fetch-pr:
2+
stage: test
3+
before_script:
4+
- apt-get update && apt-get install -y git cmake python3 libopenmpi-dev openmpi-bin
5+
- |
6+
if [ -n "$GITHUB_PR_NUMBER" ]; then
7+
echo "GITHUB_PR_NUMBER=$GITHUB_PR_NUMBER"
8+
echo "GITHUB_MERGE_REF=$GITHUB_MERGE_REF"
9+
echo "GITHUB_TRIGGER_ACTOR=$GITHUB_TRIGGER_ACTOR"
10+
git remote add github https://github.com/amrex-codes/amrex.git
11+
git fetch --depth=1 github "${GITHUB_MERGE_REF}"
12+
git checkout FETCH_HEAD -b pr-${GITHUB_PR_NUMBER}
13+
fi
14+
15+
Nvidia-H100-single-precision:
16+
extends: .dependency-n-fetch-pr
17+
tags: [nvidia-h100]
18+
image: nvcr.io/nvidia/cuda:12.8.0-devel-ubuntu24.04
19+
script:
20+
- |
21+
cmake -S . -B build \
22+
-DCMAKE_VERBOSE_MAKEFILE=ON \
23+
-DAMReX_PRECISION=SINGLE \
24+
-DAMReX_PARTICLES_PRECISION=SINGLE \
25+
-DAMReX_SPACEDIM="1;2;3" \
26+
-DAMReX_FFT=ON \
27+
-DAMReX_EB=ON \
28+
-DAMReX_ENABLE_TESTS=ON \
29+
-DAMReX_FORTRAN=OFF \
30+
-DAMReX_GPU_BACKEND=CUDA \
31+
-DCMAKE_C_COMPILER=$(which gcc) \
32+
-DCMAKE_CXX_COMPILER=$(which g++) \
33+
-DCMAKE_CUDA_HOST_COMPILER=$(which g++) \
34+
-DAMReX_CUDA_ARCH="9.0" \
35+
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
36+
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
37+
- cmake --build build -j 16
38+
- export OMPI_ALLOW_RUN_AS_ROOT=1
39+
- export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
40+
- export AMREX_THE_ARENA_INIT_SIZE=1e9
41+
- ctest -j 2 --test-dir build --output-on-failure
42+
43+
AMD-MI300A:
44+
extends: .dependency-n-fetch-pr
45+
tags: [amd-mi300]
46+
image: rocm/dev-ubuntu-24.04:6.4.3-complete
47+
script:
48+
- export ROCM_PATH=/opt/rocm-6.4.3
49+
- export PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH
50+
- export LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/lib64:$LD_LIBRARY_PATH
51+
- export HIP_PATH=$ROCM_PATH
52+
- export HIP_CLANG_PATH=$ROCM_PATH/llvm/bin
53+
- export CMAKE_PREFIX_PATH=$ROCM_PATH:$CMAKE_PREFIX_PATH
54+
- |
55+
cmake -S . -B build \
56+
-DCMAKE_VERBOSE_MAKEFILE=ON \
57+
-DAMReX_SPACEDIM="1;2;3" \
58+
-DAMReX_FFT=ON \
59+
-DAMReX_EB=ON \
60+
-DAMReX_ENABLE_TESTS=ON \
61+
-DAMReX_FORTRAN=OFF \
62+
-DAMReX_GPU_BACKEND=HIP \
63+
-DAMReX_AMD_ARCH=gfx942 \
64+
-DCMAKE_C_COMPILER=$(which clang) \
65+
-DCMAKE_CXX_COMPILER=$(which clang++) \
66+
-DCMAKE_CXX_STANDARD=17
67+
- cmake --build build -j 16
68+
- export OMPI_ALLOW_RUN_AS_ROOT=1
69+
- export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
70+
- export AMREX_THE_ARENA_INIT_SIZE=1e9
71+
- ctest -j 2 --test-dir build --output-on-failure
72+
73+
#Intel-PVC:
74+
# extends: .dependency-n-fetch-pr
75+
# tags: [intel-data-center-max-1100]
76+
# image: intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04
77+
# script:
78+
# - sycl-ls
79+
# - export ONEAPI_DEVICE_SELECTOR=level_zero:gpu
80+
# - |
81+
# cmake -S . -B build \
82+
# -DCMAKE_VERBOSE_MAKEFILE=ON \
83+
# -DAMReX_MPI=OFF \
84+
# -DAMReX_SPACEDIM="1;2;3" \
85+
# -DAMReX_FFT=ON \
86+
# -DAMReX_EB=ON \
87+
# -DAMReX_ENABLE_TESTS=ON \
88+
# -DAMReX_FORTRAN=OFF \
89+
# -DAMReX_GPU_BACKEND=SYCL \
90+
# -DCMAKE_C_COMPILER=$(which icx) \
91+
# -DCMAKE_CXX_COMPILER=$(which icpx) \
92+
# -DAMReX_PARALLEL_LINK_JOBS=8
93+
# - cmake --build build -j 16
94+
# - export AMREX_THE_ARENA_INIT_SIZE=1e9
95+
# - ctest -j 4 --test-dir build --output-on-failure
96+

Tests/Particles/NeighborParticles/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
foreach(D IN LISTS AMReX_SPACEDIM)
2+
if (D EQUAL 1)
3+
continue()
4+
endif ()
5+
26
set(_sources CheckPair.H Constants.H main.cpp MDParticleContainer.cpp MDParticleContainer.H )
37

48
set(_input_files inputs )

0 commit comments

Comments
 (0)