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

Use earthshot slurm account at PNNL (deception & newell) #114

Merged
merged 27 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
861dec0
use earthshot slurm account [deception-rebuild] [incline-rebuild] [ne…
jaelynlitz Jan 17, 2024
f6ba1be
update gitlab remote
jaelynlitz Feb 19, 2024
f93522d
update pipeline url
jaelynlitz Feb 19, 2024
a2645b3
add initial CI notes [deception-rebuild]
jaelynlitz Feb 21, 2024
62d5b0e
Apply pre-commmit fixes
jaelynlitz Feb 21, 2024
d2cdce2
set up mirror [deception-rebuild]
jaelynlitz Feb 21, 2024
657c23c
[deception-rebuild]
jaelynlitz Feb 21, 2024
e0d76fd
[deception-rebuild]
jaelynlitz Feb 21, 2024
c042403
Attempt to fix spack environment issue with new syntax and no copy. (…
cameronrutherford Feb 23, 2024
5f801ce
run each spack command with -e instead of activating the env [decepti…
jaelynlitz Feb 23, 2024
6f11564
add spack env flags [deception-rebuild]
jaelynlitz Feb 23, 2024
426f193
remove call to binary_mirror and add more -e spack flags [deception-r…
jaelynlitz Feb 23, 2024
008164e
exclude fetching exago for spack mirror [deception-rebuild]
jaelynlitz Feb 23, 2024
f532b24
[deception-rebuild]
jaelynlitz Feb 23, 2024
ba12f42
export SPACKENV [deception-rebuild]
jaelynlitz Feb 23, 2024
2c9779e
add changes to incline and newell [incline-rebuild] [newell-rebuild]
jaelynlitz Feb 23, 2024
627391f
refine README [skip-ci]
jaelynlitz Feb 24, 2024
3a49a49
Apply pre-commmit fixes
jaelynlitz Feb 24, 2024
4faf82b
Update spack.yaml [deception-rebuild] [incline-rebuild] [newell-rebuild]
cameronrutherford Feb 27, 2024
aa01e8f
Update newell spack built tcl modules - [newell-test]
Feb 27, 2024
06cc91a
[deception-rebuild]
jaelynlitz Mar 19, 2024
2a12efc
add +batch to petsc spec [deception-rebuild]
jaelynlitz Mar 22, 2024
8b015b4
Update deception spack built tcl modules - [deception-test]
Mar 22, 2024
3220825
add +batch to petsc spec [incline-rebuild]
jaelynlitz Mar 22, 2024
9b066c9
temporarily disable incline testing
jaelynlitz Mar 27, 2024
8f1aa72
apply suggestions from code review
jaelynlitz Apr 2, 2024
1a3fcdd
fix formatting [skip-ci]
jaelynlitz Apr 2, 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
4 changes: 2 additions & 2 deletions .github/workflows/pnnl_mirror.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
# Give actions access to some secrets
with:
GIT_PUSH_ARGS: '--tags --force --push-option=ci.skip'
REMOTE: 'https://gitlab.pnnl.gov/exasgd/frameworks/exago-github-mirror'
REMOTE: 'https://gitlab.pnnl.gov/earthshot-exago/exago-github-mirror'
GIT_USERNAME: ${{ secrets.GIT_USER }}
GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}

# Trigger CI pipeline since it was skipped in the above push
- name: Trigger Pipeline
run: curl -X POST -F token=${{ secrets.PNNL_PIPELINE_TRIGGER }} -F ref=${{ steps.extract_branch.outputs.branch }} https://gitlab.pnnl.gov/api/v4/projects/1619/trigger/pipeline
run: curl -X POST -F token=${{ secrets.PNNL_PIPELINE_TRIGGER }} -F ref=${{ steps.extract_branch.outputs.branch }} https://gitlab.pnnl.gov/api/v4/projects/1719/trigger/pipeline
13 changes: 7 additions & 6 deletions .gitlab/pnnl/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ trigger_newell:
- local: .gitlab/pnnl/base.gitlab-ci.yml
- local: .gitlab/pnnl/newell.gitlab-ci.yml

trigger_incline:
needs: []
trigger:
include:
- local: .gitlab/pnnl/base.gitlab-ci.yml
- local: .gitlab/pnnl/incline.gitlab-ci.yml
# See - #132
#trigger_incline:
jaelynlitz marked this conversation as resolved.
Show resolved Hide resolved
# needs: []
# trigger:
# include:
# - local: .gitlab/pnnl/base.gitlab-ci.yml
# - local: .gitlab/pnnl/incline.gitlab-ci.yml

SVC-Account-Cleanup:
image: kfox1111/slurm:deception2
Expand Down
93 changes: 93 additions & 0 deletions .gitlab/pnnl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# How to connect GitHub to a PNNL GitLab (push) Mirror

To run on our HPC clusters at PNNL while hosting our code base on GitHub, we utilize PNNL's CI/CD services on GitLab.

With GitLab premium, integration between GitHub and GitLab is included. The tier of GitLab that we have does not and did not initially support this. While switching to premium would alleviate some of the burden here, our technical requirements expanded having to test on more than one cluster. This is how we have architected a solution with the base level GitLab offering.

The PNNL GitLab repository is a push mirror of the GitHub. So whenever a commit is pushed to a pull request or the `main` branch - the changes are pushed to the GitLab and a CI pipeline is triggered.

## Steps in linking the GitLab and GitHub

1. Push mirror & pipeline trigger

In [`pnnl_mirror.yaml`](/.github/workflows/pnnl_mirror.yaml), we use the variables `GIT_USER`, `GIT_PASSWORD`, and `PNNL_PIPELINE_TRIGGER`. `GIT_PASSWORD` and `PNNL_PIPELINE_TRIGGER` are generated in GitLab and then added to GitHub.

`GIT_USER` is the username of whoever will be authenticated when pushing to GitLab for the mirror action. Since we then manually trigger CI after that, and explicitly skip CI here, this name is cosmetic.

a) GIT_PASSWORD
Go to Settings > Access Tokens. Click `Add new token`.

Pick a reasonable name & expiration date. (ie "GITHUB_PUSH_PASSWORD")

Pick the `Developer` role.

Under `Select scopes`, select `write_repository`.

Create.

Go to GitHub > Settings > Secrets and variables > Actions. Click `New repository secret`.
Name it `GIT_PASSWORD` and paste in the value generated from GitLab.

Add secret.

b) PNNL_PIPELINE_TRIGGER
Go to Settings > CI/CD > Pipeline trigger tokens. Click `Add new token`.

Give it a name and click create.

Go to GitHub > Settings > Secrets and variables > Actions. Click `New repository secret`.
Name it `PNNL_PIPELINE_TRIGGER` and paste in the value generated from GitLab.
jaelynlitz marked this conversation as resolved.
Show resolved Hide resolved

2. Push back status & modules

In our module rebuild pipelines, we rebuild spack modules on each PNNL platform, then commit the new module paths/hashes back to the repository.

a) Generate token #1 (`GITLAB_MIRROR_STATUS`)

Go to your GitHub profile > Settings > Developer Settings > Personal access tokens > Fine-grained tokens.

Generate new token:
```
resource owner = pnnl
select repositories = pnnl/exago
permissions > repository permissions > commit statuses (read and write)
copy this token
```

Go to GitLab > Settings > CI/CD > Variables:
```
add variable
type = file
do not protect/mask/expand
key = GITHUB_CURL_HEADER
Value = `Authorization: token <token value>`
```

See https://ecp-ci.gitlab.io/docs/guides/build-status-gitlab.html for more details.

b) Generate token #2 (`GITLAB_COMMIT`)

Go to your GitHub profile > Settings > Developer Settings > Personal access tokens > Fine-grained tokens.

Generate new token:
```
resource owner = pnnl
select repositories = pnnl/exago
permissions > repository permissions > contents (read and write)
<copy this token>
```

Go to GitLab > Settings > CI/CD > Variables:
```
add variable
type = variable
do not protect
key = SPACK_GIT_TOKEN
<paste in value field>
```

## Change path to `.gitlab-ci.yml`

Go to > Settings > CI/CD > General Pipelines, change the `CI/CD configuration file` to the correct path to `.gitlab-ci.yml`.

In our repo, the path is `.gitlab/pnnl/.gitlab-ci.yml`.
58 changes: 29 additions & 29 deletions .gitlab/pnnl/base.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ include:
if: '$CI_COMMIT_TITLE =~ /\[deception-rebuild\]/'
when: never
# Only run when the commit **DOES NOT** contains "[incline-rebuild]"
- &rule_no_incline_rebuild
if: '$CI_COMMIT_TITLE =~ /\[incline-rebuild\]/'
when: never
# - &rule_no_incline_rebuild
# if: '$CI_COMMIT_TITLE =~ /\[incline-rebuild\]/'
# when: never
# Only run when the commit **DOES NOT** contains "[ascent-rebuild]"
- &rule_no_ascent_rebuild
if: '$CI_COMMIT_TITLE =~ /\[ascent-rebuild\]/'
Expand All @@ -45,13 +45,13 @@ include:
if: '$CI_COMMIT_TITLE =~ /\[deception-test\]/'
when: always
# Only run when the commit **DOES NOT** contains "[incline-test]"
- &rule_no_incline_test
if: '$CI_COMMIT_TITLE =~ /\[incline-test\]/'
when: never
# - &rule_no_incline_test
# if: '$CI_COMMIT_TITLE =~ /\[incline-test\]/'
# when: never
# Only run when the commit **DOES** contains "[incline-test]"
- &rule_yes_incline_test
if: '$CI_COMMIT_TITLE =~ /\[incline-test\]/'
when: always
# - &rule_yes_incline_test
# if: '$CI_COMMIT_TITLE =~ /\[incline-test\]/'
# when: always
# Only run when the commit **DOES NOT** contains "[ascent-test]"
- &rule_no_ascent_test
if: '$CI_COMMIT_TITLE =~ /\[ascent-test\]/'
Expand Down Expand Up @@ -173,7 +173,7 @@ stages:

# jobid used in pnnl_after_script_template to cancel job if cancelled or
# timed out by gitlab through the UI
jobid=$(sbatch --export=ALL -A EXASGD $SLURM_ARGS -p $SLURM_Q -o $output -e $output -t 1:00:00 $WORKDIR/buildsystem/build.sh $SCRIPT_ARGS)
jobid=$(sbatch --export=ALL -A earthshot $SLURM_ARGS -p $SLURM_Q -o $output -e $output -t 1:00:00 $WORKDIR/buildsystem/build.sh $SCRIPT_ARGS)
export jobid=$(echo $jobid | cut -f4 -d' ')

partition=$(squeue -j $jobid -h --format="%P")
Expand Down Expand Up @@ -372,8 +372,8 @@ stages:
- *rule_no_deception_rebuild
- *rule_no_newell_test
- *rule_no_newell_rebuild
- *rule_no_incline_test
- *rule_no_incline_rebuild
# - *rule_no_incline_test
# - *rule_no_incline_rebuild
- *rule_no_ascent_test
- *rule_no_ascent_rebuild
- *default
Expand All @@ -389,8 +389,8 @@ stages:
- *rule_no_deception_rebuild
- *rule_yes_newell_test
- *rule_no_newell_rebuild
- *rule_no_incline_test
- *rule_no_incline_rebuild
# - *rule_no_incline_test
# - *rule_no_incline_rebuild
- *rule_no_ascent_test
- *rule_no_ascent_rebuild
- *default
Expand All @@ -399,18 +399,18 @@ stages:
MY_CLUSTER: "newell"
SLURM_ARGS: " --gres=gpu:1 --ntasks=3 "

.incline:
rules:
- *rule_no_deception_test
- *rule_no_deception_rebuild
- *rule_no_newell_test
- *rule_no_newell_rebuild
- *rule_yes_incline_test
- *rule_no_incline_rebuild
- *rule_no_ascent_test
- *rule_no_ascent_rebuild
- *default
variables:
WORKDIR_SUFFIX: "x86_64-clang-hip-build"
MY_CLUSTER: "incline"
SLURM_ARGS: " --exclusive --ntasks=3 "
#.incline:
# rules:
# - *rule_no_deception_test
# - *rule_no_deception_rebuild
# - *rule_no_newell_test
# - *rule_no_newell_rebuild
# - *rule_yes_incline_test
# - *rule_no_incline_rebuild
# - *rule_no_ascent_test
# - *rule_no_ascent_rebuild
# - *default
# variables:
# WORKDIR_SUFFIX: "x86_64-clang-hip-build"
# MY_CLUSTER: "incline"
# SLURM_ARGS: " --exclusive --ntasks=3 "
12 changes: 6 additions & 6 deletions buildsystem/spack/binary_mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

source buildsystem/spack/load_spack.sh &&
SPACK_MIRROR="${SPACK_MIRROR:?SPACK_MIRROR is unset. Please use the load_spack script first.}" &&
spack develop --path=$(pwd) exago@develop &&
spack bootstrap now &&
spack concretize -f &&
(spack mirror create -a --directory $SPACK_MIRROR || true) &&
spack mirror add local file://$SPACK_MIRROR &&
spack mirror list
spack -e $SPACKENV develop --path=$(pwd) exago@develop &&
spack -e $SPACKENV bootstrap now &&
spack -e $SPACKENV concretize -f &&
spack -e $SPACKENV mirror create -a --exclude-specs exago@develop --directory $SPACK_MIRROR &&
spack -e $SPACKENV mirror add local file://$SPACK_MIRROR &&
spack -e $SPACKENV mirror list

res=$?

Expand Down
10 changes: 6 additions & 4 deletions buildsystem/spack/configure_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ base="./buildsystem/spack/${MY_CLUSTER,,""""}"
# Printing out loaded modules for debugging...
module list

echo $SPACKENV

# This assumes that we are installing from a binary mirror, and don't want to fetch files
# Make sure to use binary_mirror.sh if this is failing
spack install -j $1 && \
spack -e $SPACKENV install -j $1 && \

# This deletes the previous modules that are installed
# Either use a different module path than other users, or deal with frequent updates
# To use a different module path, you must update the variable $SPACK_MODULES
# This is configured for the default for the branch in /buildsystem/spack/platform/env.sh
spack module tcl refresh -y && \
spack -e $SPACKENV module tcl refresh -y && \

# We will create a new modules file, with the first line being the module path
mkdir -p $base/modules && \
Expand All @@ -35,10 +37,10 @@ echo module use -a $SPACK_INSTALL/$SPACK_MODULES/$arch &> $base/modules/dependen
echo module use -a $SPACK_INSTALL/$SPACK_MODULES/$arch &> $base/modules/exago.sh && \

# Now we can append to the files
spack module tcl loads -r -x exago -x openssl exago &>> $base/modules/dependencies.sh && \
spack -e $SPACKENV module tcl loads -r -x exago -x openssl exago &>> $base/modules/dependencies.sh && \
# spack module tcl loads -r -x exago -x openssl exago &>> $base/modules/optimized-dependencies.sh && \
# spack module tcl loads exago &>> $base/modules/exago-optimized.sh && \
spack module tcl loads exago &>> $base/modules/exago.sh
spack -e $SPACKENV module tcl loads exago &>> $base/modules/exago.sh

exit_code=$?

Expand Down
2 changes: 1 addition & 1 deletion buildsystem/spack/deception/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module load openmpi/4.1.0mlx5.0
# Define environment variables for where spack stores key files
# For now, SPACK_INSTALL is the path where everything spack related is installed
# If you want to modify the module install path, edit the spack.yaml manually
BASE=/qfs/projects/exasgd/src/deception-ci
BASE=/qfs/projects/earthshot/src/deception-ci
export SPACK_INSTALL=$BASE/install
export SPACK_MODULES=ci-modules
export SPACK_CACHE=$BASE/../$(whoami)/spack-cache
Expand Down
Loading
Loading