Skip to content

Commit cafe26b

Browse files
authored
Merge pull request #4 from omlins/initial
Add additional configuration / update configurations
2 parents a608df9 + 45dc685 commit cafe26b

File tree

5 files changed

+121
-54
lines changed

5 files changed

+121
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Create an HPC setup for juliaup, julia and some HPC key packages (MPI.jl, CUDA.j
33
- preferences for HPC key packages that require system libraries;
44
- a wrapper for juliaup that installs juliaup (and latest julia) in an appropriate location (e.g., scratch) if it is not already installed;
55
- an activation script that sets environment variables for juliaup, julia and HPC key packages;
6-
- an uenv view equivalent to the activation script (optional).
6+
- optionally executing a site-specific post installation julia script, using the project where preferences were set (e.g, to modify preferences or to create an uenv view equivalent to the activation script).

configs/cscs/alps/gh200/craype_config

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ module list
1616

1717

1818
# Environment variables for HPC key packages that require system libraries that require system libraries (MPI.jl, CUDA.jl, HDF5.jl and ADIOS2.jl)
19-
export JUHPC_CUDA_HOME=$CUDA_HOME # Used for CUDA.jl runtime discovery (set as CUDA_HOME in the uenv view / activate script).
20-
export JUHPC_CUDA_RUNTIME_VERSION=$CRAY_CUDATOOLKIT_VERSION # Used for CUDA.jl runtime version definition (set in preferences).
21-
export JUHPC_ROCM_HOME= # Used for AMDGPU.jl runtime discovery (set as ROCM_PATH in the uenv view / activate script).
22-
export JUHPC_MPI_HOME= # Used for MPI.jl system binary discovery (set in preferences).
23-
export JUHPC_MPI_VENDOR="cray" # Used for MPI.jl system binary discovery (used to set preferences).
24-
export JUHPC_MPI_EXEC="srun -C gpu" # Used for MPI.jl exec command discovery (set in preferences). Arguments are space separated, e.g. "srun -C gpu".
25-
export JUHPC_HDF5_HOME=$HDF5_DIR # Used for HDF5.jl library discovery (set in preferences).
26-
export JUHPC_ADIOS2_HOME= # Used for ADIOS2.jl library discovery (set as JULIA_ADIOS2_PATH in the uenv view / activate script).
19+
export JUHPC_CUDA_HOME=$CUDA_HOME # Used for CUDA.jl runtime discovery (set as CUDA_HOME in the activate script).
20+
export JUHPC_CUDA_RUNTIME_VERSION=$CRAY_CUDATOOLKIT_VERSION # Used for CUDA.jl runtime version definition (set in preferences).
21+
export JUHPC_ROCM_HOME= # Used for AMDGPU.jl runtime discovery (set as ROCM_PATH in the activate script).
22+
export JUHPC_MPI_HOME= # Used for MPI.jl system binary discovery (set in preferences).
23+
export JUHPC_MPI_VENDOR="cray" # Used for MPI.jl system binary discovery (used to set preferences).
24+
export JUHPC_MPI_EXEC="srun -C gpu" # Used for MPI.jl exec command discovery (set in preferences). Arguments are space separated, e.g. "srun -C gpu".
25+
export JUHPC_HDF5_HOME=$HDF5_DIR # Used for HDF5.jl library discovery (set in preferences).
26+
export JUHPC_ADIOS2_HOME= # Used for ADIOS2.jl library discovery (set as JULIA_ADIOS2_PATH in the activate script).
2727

2828

2929
# Call JUHPC
3030
git clone https://github.com/omlins/JUHPC
3131
JUHPC=./JUHPC/src/juhpc
32-
JUHPC_SETUP_INSTALLDIR=$SCRATCH/${HOSTNAME%%-*}/juhpc_setup # HPC setup installation environment variables must be expanded during installation.
33-
JULIAUP_INSTALLDIR="\$SCRATCH/\${HOSTNAME%%-*}/juliaup" # User environment variables SCRATCH and HOSTNAME must not be expanded during uenv build, but during usage. Separate installation by HOSTNAME is required, because different hosts with different architectures can share the same file system (e.g., daint and eiger on ALPS).
32+
JUHPC_SETUP_INSTALLDIR=$SCRATCH/${HOSTNAME%%-*}/juhpc_setup # HPC setup installation environment variables must be expanded during installation.
33+
JULIAUP_INSTALLDIR="\$SCRATCH/\${HOSTNAME%%-*}/juliaup" # User environment variables SCRATCH and HOSTNAME must not be expanded HPC setup installation, but during usage. Separate installation by HOSTNAME is required, because different hosts with different architectures can share the same file system (e.g., daint and eiger on ALPS).
3434
bash -l $JUHPC $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR
3535

3636

configs/cscs/daint/gpu/craype_config

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,45 @@
33
# Author: Samuel Omlin, CSCS (omlins)
44
#
55
# Description: Definition of site specific variables and call of JUHPC.
6-
# Site: ALPS:todi, Swiss National Supercomputing Centre (CSCS)
6+
# Site: Piz Daint:gpu, Swiss National Supercomputing Centre (CSCS)
77
# Base: craype
88

99

10-
# Load required modules (including correct CPU and GPU target modules)
10+
# Load required modules, including correct CPU and GPU target modules (NOTE: the same modules should be loaded when running julia - JUHPC can be used in a module build recipe...)
1111
module load daint-gpu
1212
module switch PrgEnv-cray PrgEnv-gnu
13-
module load cudatoolkit craype-accel-nvidia60
13+
module load cudatoolkit/11.2.0_3.39-2.1__gf93aa1c craype-accel-nvidia60 # Load latest available cudatoolkit
1414
module load cray-hdf5-parallel
1515
module list
1616

1717

1818
# Environment variables for HPC key packages that require system libraries that require system libraries (MPI.jl, CUDA.jl, HDF5.jl and ADIOS2.jl)
19-
export JUHPC_CUDA_HOME=$CUDA_HOME # Used for CUDA.jl runtime discovery (set as CUDA_HOME in the uenv view / activate script).
20-
export JUHPC_CUDA_RUNTIME_VERSION=$CRAY_CUDATOOLKIT_VERSION # Used for CUDA.jl runtime version definition (set in preferences).
21-
export JUHPC_ROCM_HOME= # Used for AMDGPU.jl runtime discovery (set as ROCM_PATH in the uenv view / activate script).
22-
export JUHPC_MPI_HOME=$MPICH_DIR # Used for MPI.jl system binary discovery (set in preferences).
23-
export JUHPC_MPI_VENDOR= # Used for MPI.jl system binary discovery (used to set preferences).
24-
export JUHPC_MPI_EXEC="srun -C gpu" # Used for MPI.jl exec command discovery (set in preferences). Arguments are space separated, e.g. "srun -C gpu".
25-
export JUHPC_HDF5_HOME=$HDF5_DIR # Used for HDF5.jl library discovery (set in preferences).
26-
export JUHPC_ADIOS2_HOME= # Used for ADIOS2.jl library discovery (set as JULIA_ADIOS2_PATH in the uenv view / activate script).
19+
export JUHPC_CUDA_HOME=$CUDA_HOME # Used for CUDA.jl runtime discovery (set as CUDA_HOME in the activate script).
20+
export JUHPC_CUDA_RUNTIME_VERSION=$CRAY_CUDATOOLKIT_VERSION # Used for CUDA.jl runtime version definition (set in preferences).
21+
export JUHPC_ROCM_HOME= # Used for AMDGPU.jl runtime discovery (set as ROCM_PATH in the activate script).
22+
export JUHPC_MPI_HOME=$MPICH_DIR # Used for MPI.jl system binary discovery (set in preferences).
23+
export JUHPC_MPI_VENDOR= # Used for MPI.jl system binary discovery (used to set preferences).
24+
export JUHPC_MPI_EXEC="srun -C gpu" # Used for MPI.jl exec command discovery (set in preferences). Arguments are space separated, e.g. "srun -C gpu".
25+
export JUHPC_HDF5_HOME=$HDF5_DIR # Used for HDF5.jl library discovery (set in preferences).
26+
export JUHPC_ADIOS2_HOME= # Used for ADIOS2.jl library discovery (set as JULIA_ADIOS2_PATH in the activate script).
27+
28+
29+
# Create site-specific post-install script (currently MPIPreferences does not provide an option to set required preloads if not automatically detected; JUHPC_MPI_VENDOR fails on Piz Daint...)
30+
JUHPC_POST_INSTALL_JL=./post_install.jl
31+
echo 'using Preferences
32+
set_preferences!("MPIPreferences",
33+
"preloads" => ["libcuda.so", "libcudart.so"],
34+
"preloads_env_switch" => "MPICH_RDMA_ENABLED_CUDA";
35+
force=true
36+
)' > $JUHPC_POST_INSTALL_JL
2737

2838

2939
# Call JUHPC
3040
git clone https://github.com/omlins/JUHPC
3141
JUHPC=./JUHPC/src/juhpc
32-
JUHPC_SETUP_INSTALLDIR=$SCRATCH/${HOSTNAME%%-*}/juhpc_setup # HPC setup installation environment variables must be expanded during installation.
33-
JULIAUP_INSTALLDIR="\$SCRATCH/\${HOSTNAME%%-*}/juliaup" # User environment variables SCRATCH and HOSTNAME must not be expanded during uenv build, but during usage. Separate installation by HOSTNAME is required, because different hosts with different architectures can share the same file system (e.g., daint and eiger on ALPS).
34-
bash -l $JUHPC $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR
42+
JUHPC_SETUP_INSTALLDIR=$SCRATCH/../julia/${HOSTNAME%%[0-9]*}-gpu/juhpc_setup # HPC setup installation environment variables must be expanded during installation.
43+
JULIAUP_INSTALLDIR="\$SCRATCH/../julia/\$USER/\${HOSTNAME%%[0-9]*}-gpu/juliaup" # User environment variables SCRATCH and HOSTNAME must not be expanded HPC setup installation, but during usage. Separate installation by HOSTNAME is required, because different hosts with different architectures can share the same file system (e.g., daint and eiger on ALPS).
44+
bash -l $JUHPC $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR $JUHPC_POST_INSTALL_JL
3545

3646

3747
# Activate the HPC setup environment variables
@@ -58,5 +68,3 @@ julia -e 'using Pkg; Pkg.add("HDF5"); using HDF5; @show HDF5.has_parallel()'
5868
# Test CUDA-aware MPI
5969
cd ~/cudaaware
6070
MPICH_GPU_SUPPORT_ENABLED=1 srun -Acsstaff -C'gpu' -N2 -n2 julia cudaaware.jl
61-
62-
# julia -e 'import Pkg; Pkg.test("MPI"; test_args=["--backend=CUDA"])'

configs/cscs/daint/mc/craype_config

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Author: Samuel Omlin, CSCS (omlins)
4+
#
5+
# Description: Definition of site specific variables and call of JUHPC.
6+
# Site: Piz Daint:mc, Swiss National Supercomputing Centre (CSCS)
7+
# Base: craype
8+
9+
10+
# Load required modules, including correct CPU and GPU target modules (NOTE: the same modules should be loaded when running julia - JUHPC can be used in a module build recipe...)
11+
module load daint-mc
12+
module switch PrgEnv-cray PrgEnv-gnu
13+
module load cray-hdf5-parallel
14+
module list
15+
16+
17+
# Environment variables for HPC key packages that require system libraries that require system libraries (MPI.jl, CUDA.jl, HDF5.jl and ADIOS2.jl)
18+
export JUHPC_CUDA_HOME= # Used for CUDA.jl runtime discovery (set as CUDA_HOME in the activate script).
19+
export JUHPC_CUDA_RUNTIME_VERSION=$CRAY_CUDATOOLKIT_VERSION # Used for CUDA.jl runtime version definition (set in preferences).
20+
export JUHPC_ROCM_HOME= # Used for AMDGPU.jl runtime discovery (set as ROCM_PATH in the activate script).
21+
export JUHPC_MPI_HOME=$MPICH_DIR # Used for MPI.jl system binary discovery (set in preferences).
22+
export JUHPC_MPI_VENDOR= # Used for MPI.jl system binary discovery (used to set preferences).
23+
export JUHPC_MPI_EXEC="srun -C mc" # Used for MPI.jl exec command discovery (set in preferences). Arguments are space separated, e.g. "srun -C mc".
24+
export JUHPC_HDF5_HOME=$HDF5_DIR # Used for HDF5.jl library discovery (set in preferences).
25+
export JUHPC_ADIOS2_HOME= # Used for ADIOS2.jl library discovery (set as JULIA_ADIOS2_PATH in the activate script).
26+
27+
28+
# Call JUHPC
29+
git clone https://github.com/omlins/JUHPC
30+
JUHPC=./JUHPC/src/juhpc
31+
JUHPC_SETUP_INSTALLDIR=$SCRATCH/../julia/${HOSTNAME%%[0-9]*}-mc/juhpc_setup # HPC setup installation environment variables must be expanded during installation.
32+
JULIAUP_INSTALLDIR="\$SCRATCH/../julia/\$USER/\${HOSTNAME%%[0-9]*}-mc/juliaup" # User environment variables SCRATCH and HOSTNAME must not be expanded HPC setup installation, but during usage. Separate installation by HOSTNAME is required, because different hosts with different architectures can share the same file system (e.g., daint and eiger on ALPS).
33+
bash -l $JUHPC $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR
34+
35+
36+
# Activate the HPC setup environment variables
37+
. $JUHPC_SETUP_INSTALLDIR/activate
38+
39+
# Call juliaup to install juliaup and latest julia on scratch
40+
juliaup
41+
42+
# Call juliaup to see its options
43+
juliaup
44+
45+
# Call julia Pkg
46+
julia -e 'using Pkg; Pkg.status()'
47+
48+
# Add MPI.jl
49+
julia -e 'using Pkg; Pkg.add("MPI"); using MPI; MPI.versioninfo()'
50+
51+
# Add HDF5.jl
52+
julia -e 'using Pkg; Pkg.add("HDF5"); using HDF5; @show HDF5.has_parallel()'

src/juhpc

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# - preferences for HPC key packages that require system libraries;
66
# - a wrapper for juliaup that installs juliaup (and latest julia) in an appropriate location (e.g., scratch) if it is not already installed;
77
# - an activation script that sets environment variables for juliaup, julia and HPC key packages;
8-
# - an uenv view equivalent to the activation script (optional).
8+
# - optionally executing a site-specific post installation julia script, using the project where preferences were set (e.g, to modify preferences or to create an uenv view equivalent to the activation script).
99

1010

1111
# Define info, error, cleanup and check functions
@@ -50,7 +50,7 @@ check_dir() {
5050

5151
export JUHPC_SETUP_INSTALLDIR="$1"
5252
export JULIAUP_INSTALLDIR="$2"
53-
export JUHPC_UENV_VIEW_CREATOR="$3"
53+
export JUHPC_POST_INSTALL_JL="$3"
5454

5555

5656
# Set (derived) general environment variables
@@ -62,14 +62,14 @@ export TMP_JULIAUP_ROOTDIR=$TMP/juliaup
6262

6363
# Start installation
6464

65-
info "starting installation of HPC setup for juliaup, julia and HPC key packages requiring system libraries..."
65+
info "Starting installation of HPC setup for juliaup, julia and HPC key packages requiring system libraries..."
6666
check_var "JULIAUP_INSTALLDIR" "JUHPC_SETUP_INSTALLDIR"
6767
check_dir "$JUHPC_SETUP_INSTALLDIR"
6868

6969

7070
# Download and install julia in /tmp using juliaup
7171

72-
info "installing temporary juliaup installation in $TMP_JULIAUP_ROOTDIR..."
72+
info "Installing temporary juliaup installation in $TMP_JULIAUP_ROOTDIR..."
7373

7474
export TMP_JULIAUP_BINDIR=$TMP_JULIAUP_ROOTDIR/bin # juliaup and julia binaries
7575
export JULIAUP_DEPOT_PATH=$TMP_JULIAUP_ROOTDIR/depot
@@ -85,7 +85,7 @@ info "... done."
8585

8686
# Create preferences for HPC key packages that require system libraries (MPI.jl, CUDA.jl, HDF5.jl, ADIOS2.jl, ...)
8787

88-
info "creating preferences for HPC key packages..."
88+
info "Creating preferences for HPC key packages..."
8989

9090
export JULIA_PREFDIR=$JUHPC_SETUP_INSTALLDIR/julia_preferences
9191
export JULIA_PREF_PROJECT=$JULIA_PREFDIR/Project.toml
@@ -141,7 +141,7 @@ info "... done."
141141

142142
# Create a wrapper for juliaup that installs juliaup (and latest julia) on scratch if it is not already installed
143143

144-
info "creating wrapper for juliaup..."
144+
info "Creating wrapper for juliaup..."
145145

146146
export JULIAUP_WRAPPER_BINDIR=$JUHPC_SETUP_INSTALLDIR/juliaup_wrapper
147147
export JULIAUP_WRAPPER=$JULIAUP_WRAPPER_BINDIR/juliaup
@@ -156,7 +156,7 @@ info() {
156156
}
157157
158158
if [ ! -f $(ENV["JULIAUP_BINDIR"])/juliaup ]; then
159-
info "installing juliaup and latest julia in $(ENV["JULIAUP_INSTALLDIR"])..."
159+
info "This is the first call to juliaup; juliaup and the latest julia will now be installed. After that, you can use juliaup and julia normally. Installing in $(ENV["JULIAUP_INSTALLDIR"])..."
160160
PATH_OLD=\$PATH
161161
export PATH=\$(echo \$PATH | perl -pe "s|[^:]*juliaup(?:_wrapper)?[^:]*:?||g") # Remove all juliaup paths from PATH
162162
curl -fsSL https://install.julialang.org | sh -s -- --add-to-path=no --yes --path=$(ENV["JULIAUP_INSTALLDIR"]) --background-selfupdate 0 --startup-selfupdate 0 || { echo "Failed to install Juliaup (and Julia)." >&2; exit 1; }
@@ -174,7 +174,7 @@ info "... done."
174174

175175
# Create an activation script that sets environment variables for juliaup, julia and HPC key packages
176176

177-
info "creating activation script..."
177+
info "Creating activation script..."
178178

179179
export JULIAUP_DEPOT=$JULIAUP_INSTALLDIR/depot
180180
export JULIA_DEPOT=$JULIAUP_INSTALLDIR/depot
@@ -185,39 +185,46 @@ info() {
185185
local message="\$1"
186186
echo -e "$(ENV["JUHPC"]) \$message" >&2
187187
}
188-
info "activating HPC setup for juliaup, julia and HPC key packages requiring system libraries..."
188+
info "Activating HPC setup for juliaup, julia and HPC key packages requiring system libraries..."
189189
export PATH=$(ENV["JULIAUP_WRAPPER_BINDIR"]):$(ENV["JULIAUP_BINDIR"]):\$PATH # The wrapper must be before the juliaup bindir
190+
info "PATH: \$PATH"
190191
export JULIAUP_DEPOT_PATH=$(ENV["JULIAUP_DEPOT"])
192+
info "JULIAUP_DEPOT_PATH: \$JULIAUP_DEPOT_PATH"
191193
export JULIA_DEPOT_PATH=$(ENV["JULIA_DEPOT"])
194+
info "JULIA_DEPOT_PATH: \$JULIA_DEPOT_PATH"
192195
export JULIA_LOAD_PATH=:$(ENV["JULIA_PREFDIR"])
193-
$(haskey(ENV,"JUHPC_CUDA_HOME") && ENV["JUHPC_CUDA_HOME"] != "" ?
194-
"export CUDA_HOME=$(ENV["JUHPC_CUDA_HOME"]); export JULIA_CUDA_MEMORY_POOL=none" : "")
195-
$(haskey(ENV,"JUHPC_ROCM_HOME") && ENV["JUHPC_ROCM_HOME"] != "" ?
196-
"export ROCM_PATH=$(ENV["JUHPC_ROCM_HOME"])" : "")
197-
$(haskey(ENV,"JUHPC_ADIOS2_HOME") && ENV["JUHPC_ADIOS2_HOME"] != "" ?
198-
"export JULIA_ADIOS2_PATH=$(ENV["JUHPC_ADIOS2_HOME"])" : "")
199-
echo -e "PATH=\$PATH\n"\
200-
"JULIAUP_DEPOT_PATH=\$JULIAUP_DEPOT_PATH\n"\
201-
"JULIA_DEPOT_PATH=\$JULIA_DEPOT_PATH\n"\
202-
"JULIA_LOAD_PATH=\$JULIA_LOAD_PATH\n"\
203-
"CUDA_HOME=\$CUDA_HOME\n"\
204-
"JULIA_ADIOS2_PATH=\$JULIA_ADIOS2_PATH" >&2
196+
info "JULIA_LOAD_PATH: \$JULIA_LOAD_PATH"
197+
$(haskey(ENV,"JUHPC_CUDA_HOME") && ENV["JUHPC_CUDA_HOME"] != "" ? """
198+
export CUDA_HOME=$(ENV["JUHPC_CUDA_HOME"])
199+
info "CUDA_HOME: \$CUDA_HOME"
200+
export JULIA_CUDA_MEMORY_POOL=none
201+
info "JULIA_CUDA_MEMORY_POOL: \$JULIA_CUDA_MEMORY_POOL"
202+
""" : "")
203+
$(haskey(ENV,"JUHPC_ROCM_HOME") && ENV["JUHPC_ROCM_HOME"] != "" ? """
204+
export ROCM_PATH=$(ENV["JUHPC_ROCM_HOME"])
205+
info "ROCM_PATH: \$ROCM_PATH"
206+
""" : "")
207+
$(haskey(ENV,"JUHPC_ADIOS2_HOME") && ENV["JUHPC_ADIOS2_HOME"] != "" ? """
208+
export JULIA_ADIOS2_PATH=$(ENV["JUHPC_ADIOS2_HOME"])
209+
info "JULIA_ADIOS2_PATH: \$JULIA_ADIOS2_PATH"
210+
""" : "")
205211
""")' > $ACTIVATE_SCRIPT
206212

207213
info "... done."
208214

209215

210-
# Optionally create an uenv view equivalent to the activation script - only done if JUHPC_UENV_VIEW_CREATOR is set
216+
# Optionally execute a site-specific post installation julia script (if passed a third argument)
211217

212-
if [ -n "${JUHPC_UENV_VIEW_CREATOR}" ]; then
213-
info "creating uenv view..."
214-
julia $JUHPC_UENV_VIEW_CREATOR
218+
if [ -n "${JUHPC_POST_INSTALL_JL}" ]; then
219+
info "Executing site-specific post installation julia script (using the project where preferences were set)..."
220+
julia --project=$JULIA_PREFDIR $JUHPC_POST_INSTALL_JL
215221
info "... done."
216222
fi
217223

218224

219-
# Remove temporary juliaup installation
225+
# Remove temporary juliaup installation and Manifest.toml in the preferences directory
220226

221227
cleanup
228+
rm -f $JULIA_PREFDIR/Manifest.toml
222229

223-
info "... HPC setup for juliaup, julia and HPC key packages requiring system libraries is complete."
230+
info "... Installation of HPC setup for juliaup, julia and HPC key packages requiring system libraries is complete."

0 commit comments

Comments
 (0)