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

WIP: Use HPC for CI #386

Merged
merged 94 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
37ebce5
Updated github action to mirror to JSC-Gitlab
jakob-fritz Dec 4, 2023
c29bbb8
Added tag for Gitlab-CI job
jakob-fritz Dec 4, 2023
e21db75
No scheduled runs on fork
jakob-fritz Dec 4, 2023
7a56c88
Mirror only if lint succeeded
jakob-fritz Dec 4, 2023
a256146
Added job for juwels to check if it runs
jakob-fritz Dec 6, 2023
fced7bf
Added job from jacamar-example
jakob-fritz Dec 6, 2023
bf43379
Forgot to add used stage
jakob-fritz Dec 6, 2023
5872275
Added scheduler parameters
jakob-fritz Dec 6, 2023
fe077b1
Updated to a single line
jakob-fritz Dec 6, 2023
8f1b094
Commented more jobs in github
jakob-fritz Dec 6, 2023
208413f
Checking other position of variables
jakob-fritz Dec 6, 2023
cd4dad7
First try to run pytest on juwels
jakob-fritz Dec 8, 2023
6f06382
Running on HPC-CI on Login-Node and submitting job
jakob-fritz Dec 14, 2023
2a482d6
Corrected path for installing pySDC
jakob-fritz Dec 14, 2023
94aeeac
Wrong command-line-argument for stdout to file
jakob-fritz Dec 14, 2023
2fdf56c
Hard-coded the used account for quota
jakob-fritz Dec 14, 2023
35d87b6
Use srun and always provide artifact of benchmark
jakob-fritz Dec 15, 2023
cb54f15
Reverted initial changes
jakob-fritz Dec 15, 2023
187a2ae
Changed Gitlab-repo to where it is mirrored
jakob-fritz Dec 18, 2023
49ed6f0
Use an updated version of github2lab-action
jakob-fritz Jan 3, 2024
db0d086
Added comments to trigger another CI
jakob-fritz Jan 3, 2024
83bc236
Another commit to trigger the CI
jakob-fritz Jan 3, 2024
7faf29d
Changed used secret
jakob-fritz Jan 3, 2024
88de46b
Another comment to trigger CI
jakob-fritz Jan 3, 2024
adad00d
Trying Project Access Token
jakob-fritz Jan 3, 2024
53db841
Merge branch 'master' into master
pancetta Jan 3, 2024
e2f9e83
Update ci_pipeline.yml
pancetta Jan 3, 2024
c54cad6
Update ci_pipeline.yml
pancetta Jan 3, 2024
100fc18
Use PAT from gitlab
jakob-fritz Jan 3, 2024
8cb989c
Check only is secrets are available
jakob-fritz Jan 4, 2024
0d97b94
Another try to check if vars are set
jakob-fritz Jan 4, 2024
0e03f88
Env vars seem to be set (why?). Check if mirror works
jakob-fritz Jan 4, 2024
e196140
Another try using pull_request_target
jakob-fritz Jan 4, 2024
8998564
Revert back to pul_request
jakob-fritz Jan 4, 2024
c38dd45
Run mirror only from main repo
jakob-fritz Jan 4, 2024
d6bcf7d
Exhibit secret (if not masked)
jakob-fritz Jan 4, 2024
c215fd0
Another try at checking secrets
jakob-fritz Jan 4, 2024
9692bed
incorrect expansion
jakob-fritz Jan 4, 2024
2725ca5
Another try of expansion
jakob-fritz Jan 4, 2024
07cc84c
showing test secret
jakob-fritz Jan 4, 2024
2b8fc35
Another try
jakob-fritz Jan 4, 2024
970f84e
Reverted to original config of GH-CI
jakob-fritz Jan 8, 2024
ca91516
Added trailing newline in md-file
jakob-fritz Jan 15, 2024
d2a7e07
Merge branch 'create_gitlab_ci' into master
jakob-fritz Jan 15, 2024
f391b92
Added a trailing newline in another md-file
jakob-fritz Jan 15, 2024
fc09e7d
Some more md-formatting
jakob-fritz Jan 15, 2024
4eb95dd
More md-formatting
jakob-fritz Jan 15, 2024
9e63c0a
even more md-formatting
jakob-fritz Jan 15, 2024
930f505
Checkout the latest version of the pull-request
jakob-fritz Jan 22, 2024
78b62ee
Minor formatting to trigger CI
jakob-fritz Jan 29, 2024
c2a0595
Updated which code to checkout
jakob-fritz Jan 29, 2024
5521e7e
Formatted with black
jakob-fritz Jan 30, 2024
d4b366d
Some minor md-formatting to trigger CI
jakob-fritz Feb 5, 2024
8d2177f
Added info on how to proceed after job failed due to lacking permissions
jakob-fritz Feb 19, 2024
9e12306
Updated filenames to merge coverages from
jakob-fritz Feb 19, 2024
2024e9a
Added test for cupy on HPC
jakob-fritz Feb 22, 2024
e96ca11
Corrected bug in gitlab-ci file
jakob-fritz Feb 22, 2024
e508a21
Corrected variable substitution
jakob-fritz Feb 22, 2024
5b46f9c
Corrected partition for cupy
jakob-fritz Feb 23, 2024
1dc5a3b
Print sbatch even for failures
jakob-fritz Feb 23, 2024
74588f1
Corrected partition-name
jakob-fritz Feb 23, 2024
0b5f380
Forgot to install coverage
jakob-fritz Feb 23, 2024
609c62e
Splitted cupy-test and benchmark into two jobs
jakob-fritz Feb 23, 2024
f3cfdde
Run coverage combine, even if there is no coverage
jakob-fritz Feb 26, 2024
376b44a
Adding empty coverage-file
jakob-fritz Feb 26, 2024
b8838bd
Update to trigger CI
jakob-fritz Apr 16, 2024
42279da
More formatting to trigger CI
jakob-fritz Apr 16, 2024
3f7da4d
Reformatting to trigger CI
jakob-fritz Apr 16, 2024
fabea5f
Just to trigger CI
jakob-fritz Apr 16, 2024
8f20f5e
Change to trigger CI
jakob-fritz Apr 16, 2024
4f4eab9
Another trigger for CI
jakob-fritz Apr 16, 2024
682101e
Change to trigger CI
jakob-fritz Apr 17, 2024
0964d18
Triggering CI
jakob-fritz Apr 17, 2024
27a66ef
Trigger CI again
jakob-fritz Apr 17, 2024
c0740ab
Commit to trigger CI
jakob-fritz Apr 17, 2024
9308d0a
Trigger CI
jakob-fritz Apr 17, 2024
1f61e67
Trigger CI again
jakob-fritz Apr 17, 2024
76fd32c
Trigger pipeline
jakob-fritz Apr 18, 2024
8961707
Trigger CI
jakob-fritz Apr 18, 2024
b1d1b82
Trigger pipeline again
jakob-fritz Apr 18, 2024
0de652b
Trigger CI again
jakob-fritz Apr 18, 2024
2a9e061
Again trigger CI
jakob-fritz Apr 18, 2024
3a90226
CI should fail now
jakob-fritz Apr 22, 2024
aab3b87
Removed ls from CI-Jobs
jakob-fritz Apr 22, 2024
7137094
Removed forced failure of tests
jakob-fritz Apr 22, 2024
27f517e
Added info on CI in documentation
jakob-fritz Apr 22, 2024
6f6737f
Reverted changelog (to avoid merge-conflicts
jakob-fritz Apr 22, 2024
3e4539a
File not needed
jakob-fritz Apr 22, 2024
279c16b
Update 02_continuous_integration.md
jakob-fritz Apr 22, 2024
462dca9
Include changes to documentation (done by T.Baumann)
jakob-fritz Apr 22, 2024
49cab56
Resolve merge-conflict where doc was changed
jakob-fritz Apr 22, 2024
573321b
Reverted some formatting in changelog
jakob-fritz Apr 22, 2024
b7d60db
Added trailing newline at end of file
jakob-fritz Apr 22, 2024
0cec1f3
Formatted code of conduct
jakob-fritz Apr 22, 2024
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
90 changes: 48 additions & 42 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,22 @@ jobs:
run: |
flakeheaven lint --benchmark pySDC

# mirror_to_gitlab:

# runs-on: ubuntu-latest

# steps:
# - name: Checkout
# uses: actions/checkout@v1

# - name: Mirror
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mirror_to_gitlab:
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Mirror
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'mirror' # Either 'mirror', 'get_status', 'get_artifact', or 'all'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_J }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.jsc.fz-juelich.de"
GITLAB_PROJECT_ID: "5992"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

user_cpu_tests_linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -170,31 +169,38 @@ jobs:
pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}


# wait_for_gitlab:
# runs-on: ubuntu-latest

# needs:
# - mirror_to_gitlab

# steps:
# - name: Wait
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# # - name: Get and prepare artifacts
# # run: |
# # pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# # job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# # curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# # rm -rf data
# # unzip artifacts.zip
# # ls -ratl
wait_for_gitlab:
runs-on: ubuntu-latest
needs:
- mirror_to_gitlab
steps:
- name: Wait
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'get_status' # Either 'mirror', 'get_status', 'get_artifact', or 'all'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_J }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.jsc.fz-juelich.de"
GITLAB_PROJECT_ID: "5992"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'get_artifact' # Either 'mirror', 'get_status', 'get_artifact', or 'all'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_J }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.jsc.fz-juelich.de"
GITLAB_PROJECT_ID: "5992"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Get and prepare artifacts
# run: |
# pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# rm -rf data
# unzip artifacts.zip
# ls -ratl


post-processing:
Expand Down
71 changes: 71 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,76 @@
stages:
- test
- benchmark
- execute
- upload


# job_juwels_compute:
# stage: execute
# variables:
# SCHEDULER_PARAMETERS: '--account=cstma --nodes=1 --partition=devel'
# tags:
# - juwels
# - jacamar
# - compute
# - slurm
# artifacts:
# paths:
# - test.file
# script:
# - echo $SYSTEMNAME
# - touch test.file
# after_script:
# - hostname
# - id


variables:
JUWELS_ACCOUNT: "cstma"


test_JUWELS:
stage: benchmark
rules:
- if: $CI_COMMIT_MESSAGE !~ /.*\[CI-no-benchmarks\]/
tags:
- jacamar
- juwels
- login
- shell
artifacts:
when: always
paths:
- benchmarks
- sbatch.err
- sbatch.out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also have a directory where all job scripts can post their output? It would be neat to allow multiple job scripts. Not really needed, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure we can have a directory for the outputs. Each job in Gitlab spawns in a separate directory. Therefore, multiple jobs (from Gitlab) won't put files in the same directory. If multiple tasks from slurm are spawned from a single Job in Gitlab, having this directory might make sense.

before_script:
- mkdir -p benchmarks
# load the latest Python module (currently 3.11)
- module --force purge
- module load Stages/2024
- module load GCC
- module load OpenMPI
- module load FFTW
- module load mpi4py
- module load SciPy-Stack
- module load CuPy
- pwd
- ls -lah
- pip install -e .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to pip install in the CI? User installation with pip is persistent, afaik. Is the gitlab not associated with any user?
I would prefer to put the module load commands in the job scripts. But if you need to repeat the pip installs every time, it's better here.

Copy link
Collaborator Author

@jakob-fritz jakob-fritz Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if we need pip install each time. The jobs are run as a predefined user (the one who triggers the CI in Gitlab). As mirroring is done with a personal access token, that user is impersonated and the CI will always run as this specific user. So if pip install is persistent, it will be available in all runs, as these runs are executed as the same user

Regarding module load: We can put them in the script. I find it easier/nicer if the scripts are as short as possible. Therefore, I moved the module load into the YAML-file. Furthermore, these steps (as module load or pip install) are executed on a login-node. The content of the sh-file is executed on a compute-node. In term of quota, it is "cheaper" if we don't spend compute-time for module load (although it does not take too long).

If you want to, feel free to move the pip install and module load into the script. If I shall do that, feel free to ping me!

- pip install pytest-benchmark
script:
# - touch benchmarks/output.json
- echo $SYSTEMNAME
- sbatch --wait etc/juwels_benchmark.sh
- echo "Following Errors occured:"
- cat sbatch.err
- echo "Following was written to stdout:"
- cat sbatch.out
after_script:
- ls -lh benchmarks


#test_kit:
# image: rcaspart/micromamba-cuda
# stage: benchmark
Expand Down Expand Up @@ -64,6 +132,9 @@ stages:
benchmark:
image: mambaorg/micromamba
stage: benchmark
when: manual
tags:
- docker
rules:
- if: $CI_COMMIT_MESSAGE !~ /.*\[CI-no-benchmarks\]/
artifacts:
Expand Down
9 changes: 9 additions & 0 deletions etc/juwels_benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -x
#SBATCH --account=cstma
#SBATCH --nodes=1
#SBATCH --time=00:10:00
#SBATCH --partition=devel
#SBATCH --output=sbatch.out
#SBATCH --error=sbatch.err

srun python -m pytest --continue-on-collection-errors -v pySDC/tests -m "benchmark" --benchmark-json=benchmarks/output.json
Loading