Skip to content

Commit 0eaff39

Browse files
brownbaerchenThomas
andauthored
Use sc_venv_template for tests on JUWELS (#576)
* Use sc_venv_template for tests on JUWELS * Changed path to venv * Fixed benchmarks * User specific venv path * Fix * Added explanatory link for obscure bash stuff --------- Co-authored-by: Thomas <[email protected]>
1 parent b460650 commit 0eaff39

File tree

9 files changed

+84
-28
lines changed

9 files changed

+84
-28
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,8 @@ prepare_JUWELS:
2727
- shell
2828
script:
2929
- mkdir -p benchmarks
30-
- module --force purge
31-
- module load Stages/2024
32-
- module load GCC
33-
- module load OpenMPI
34-
- module load FFTW
35-
- module load mpi4py
36-
- module load SciPy-Stack
37-
- module load CuPy
3830
- jutil env activate -p ${JUWELS_PROJECT}
39-
- python -m venv --clear $SCRATCH/.venv/pySDC
40-
- source $SCRATCH/.venv/pySDC/bin/activate
41-
- pip install -e .
42-
- pip install pytest-benchmark coverage
43-
- git submodule add -f https://github.com/brownbaerchen/mpi4py-fft.git
44-
- cd mpi4py-fft
45-
- git checkout cupy_implementation
46-
- FFTW_LIBRARY_DIR="/p/software/juwels/stages/2024/software/FFTW/3.3.10-GCC-12.3.0/lib64" pip install --force-reinstall .
47-
- cd ../
31+
- source ./etc/venv_juwels/setup.sh
4832

4933

5034
test_JUWELS:
@@ -77,16 +61,8 @@ test_JUWELS:
7761
- sbatch.out
7862
before_script:
7963
- mkdir -p benchmarks
80-
- module --force purge
81-
- module load Stages/2024
82-
- module load GCC
83-
- module load OpenMPI
84-
- module load FFTW
85-
- module load mpi4py
86-
- module load SciPy-Stack
87-
- module load CuPy
8864
- jutil env activate -p ${JUWELS_PROJECT}
89-
- source $SCRATCH/.venv/pySDC/bin/activate
65+
- source ./etc/venv_juwels/activate.sh
9066
script:
9167
- bash etc/check_node_avail.sh || PARTITION_AVAIL=$?
9268
- if [ -n "$PARTITION_AVAIL" ] ; then exit $PARTITION_AVAIL ; fi

etc/juwels_benchmark.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#SBATCH --account=cstma
33
#SBATCH --nodes=1
44
#SBATCH --time=00:10:00
5-
#SBATCH --partition=devel
5+
#SBATCH --partition=develgpus
66
#SBATCH --output=sbatch.out
77
#SBATCH --error=sbatch.err
88

etc/venv_juwels/activate.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# See https://stackoverflow.com/a/28336473
4+
SOURCE_PATH="${BASH_SOURCE[0]:-${(%):-%x}}"
5+
6+
RELATIVE_PATH="$(dirname "$SOURCE_PATH")"
7+
ABSOLUTE_PATH="$(realpath "${RELATIVE_PATH}")"
8+
9+
[[ "$0" != "${SOURCE_PATH}" ]] && echo "The activation script must be sourced, otherwise the virtual environment will not work." || ( echo "Vars script must be sourced." && exit 1) ;
10+
11+
source "${ABSOLUTE_PATH}"/config.sh
12+
source "${ABSOLUTE_PATH}"/modules.sh
13+
14+
jutil env activate -p $COMPUTE_PROJECT
15+
16+
export PYTHONPATH="$(echo "${ENV_DIR}"/lib/python*/site-packages):${PYTHONPATH}"
17+
18+
source "${ENV_DIR}"/bin/activate

etc/venv_juwels/config.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://stackoverflow.com/a/28336473
2+
SOURCE_PATH="${BASH_SOURCE[0]:-${(%):-%x}}"
3+
4+
## Check if this script is sourced
5+
[[ "$0" != "${SOURCE_PATH}" ]] && echo "Setting vars" || ( echo "Vars script must be sourced." && exit 1) ;
6+
## Determine location of this file
7+
RELATIVE_PATH="$(dirname "$SOURCE_PATH")"
8+
ABSOLUTE_PATH="$(realpath "${RELATIVE_PATH}")"
9+
####################################
10+
11+
### User Configuration
12+
export COMPUTE_PROJECT=ccstma
13+
export ENV_NAME="$(basename "$ABSOLUTE_PATH")" # Default Name of the venv is the directory that contains this file
14+
jutil env activate -p $COMPUTE_PROJECT
15+
export ENV_DIR="${SCRATCH}"/.pySDC_venvs/venv_juwels_"${USER}" # Default location of this VENV is "./venv"

etc/venv_juwels/modules.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module --force purge
2+
module load Stages/2025
3+
module load GCC/13.3.0
4+
module load ParaStationMPI
5+
module load NCCL
6+
module load MPI-settings/CUDA
7+
module load UCX-settings/RC-CUDA
8+
module load Python
9+
module load CuPy
10+
module load FFTW
11+
module load mpi4py
12+
module load SciPy-Stack

etc/venv_juwels/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Python venv for Juwels
2+
======================
3+
4+
This is a version of the [JSC venv template](https://gitlab.jsc.fz-juelich.de/kesselheim1/sc_venv_template/-/tree/master) adapted to the cluster partition of the Juelich wizard for European leadership in science (JUWELS).

etc/venv_juwels/requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Add here the pip packages you would like to install on this virtual environment / kernel
2+
numpy>=2.0
3+
matplotlib>=3.0
4+
dill>=0.2.6
5+
scipy>=1.14
6+
qmat
7+
pytest-benchmark
8+
coverage

etc/venv_juwels/setup.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# See https://stackoverflow.com/a/28336473
4+
SOURCE_PATH="${BASH_SOURCE[0]:-${(%):-%x}}"
5+
6+
RELATIVE_PATH="$(dirname "$SOURCE_PATH")"
7+
ABSOLUTE_PATH="$(realpath "${RELATIVE_PATH}")"
8+
9+
source "${ABSOLUTE_PATH}"/config.sh
10+
source "${ABSOLUTE_PATH}"/modules.sh
11+
12+
python3 -m venv --prompt "$ENV_NAME" --system-site-packages "${ENV_DIR}"
13+
14+
source "${ABSOLUTE_PATH}"/activate.sh
15+
16+
python3 -m pip install --upgrade pip
17+
18+
python3 -m pip install -r "${ABSOLUTE_PATH}"/requirements.txt
19+
20+
FFTW_LIBRARY_DIR="/p/software/juwels/stages/2025/software/FFTW/3.3.10-GCC-13.3.0/lib64/" python3 -m pip install git+https://github.com/brownbaerchen/mpi4py-fft.git@cupy_implementation
21+
22+
python3 -m pip install -e "${ABSOLUTE_PATH}"/../../
23+

pySDC/tests/test_helpers/test_spectral_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def test_tau_method(bc, N, bc_val, kind='Dirichlet', useGPU=False):
519519

520520
sol_poly = np.polynomial.Chebyshev(sol_hat)
521521
d_sol_poly = sol_poly.deriv(1)
522-
x = xp.linspace(-1, 1, 100)
522+
x = np.linspace(-1, 1, 100)
523523

524524
if kind == 'integral':
525525
integral = sol_poly.integ(1, lbnd=-1)

0 commit comments

Comments
 (0)