Skip to content

Commit 93ba15f

Browse files
authored
Merge pull request #31 from JuliaParallel/initial
Add Preferences package in any case
2 parents 9153666 + 2befb28 commit 93ba15f

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

examples/cscs/daint/gpu/craype_config_no_cudaaware

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,36 @@
1010
# 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 # A toolkit needs to be loaded during installation in order to be able to set JUHPC_CUDA_HOME (even though we set preferences to use artifacts in the postinstall)
1314
module load cray-hdf5-parallel
1415
module list
1516

1617

1718
# Environment variables for HPC key packages that require system libraries that require system libraries (MPI.jl, CUDA.jl, AMDGPU.jl, HDF5.jl and ADIOS2.jl)
19+
export JUHPC_CUDA_HOME=$CUDA_HOME
20+
export JUHPC_CUDA_RUNTIME_VERSION="11.8" # Set to the highest possible version that can work on daint (using artifacts - below "local" is set to false...)
1821
export JUHPC_MPI_HOME=$MPICH_DIR
1922
export JUHPC_MPI_EXEC="srun -C gpu"
2023
export JUHPC_HDF5_HOME=$HDF5_DIR
2124

2225

26+
# 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...)
27+
JUHPC_POST_INSTALL_JL=./post_install.jl
28+
echo 'using Preferences
29+
set_preferences!("CUDA_Runtime_jll",
30+
"local" => false;
31+
force=true
32+
)
33+
set_preferences!("MPIPreferences",
34+
"preloads" => ["libcuda.so", "libcudart.so"],
35+
"preloads_env_switch" => "MPICH_RDMA_ENABLED_CUDA";
36+
force=true
37+
)' > $JUHPC_POST_INSTALL_JL
38+
39+
2340
# Call JUHPC
2441
JUHPC_SETUP_INSTALLDIR=$SCRATCH/../julia/${HOSTNAME%%[0-9]*}-gpu-nocudaaware/juhpc_setup
2542
JULIAUP_INSTALLDIR="\$SCRATCH/../julia/\$USER/\${HOSTNAME%%[0-9]*}-gpu-nocudaaware/juliaup"
2643
VERSION="v0.2.0"
2744
wget https://raw.githubusercontent.com/JuliaParallel/JUHPC/$VERSION/juhpc -O /tmp/juhpc
28-
bash -l /tmp/juhpc $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR
45+
bash -l /tmp/juhpc $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR $JUHPC_POST_INSTALL_JL

juhpc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,8 @@ mkdir -p "$JULIA_PREFDIR" || { error "failed to create directory: $JULIA_PREFDIR
194194
progress_bar 1 # Initialize progress bar.
195195
julia_pref 'using Pkg' 10 # Initialize project.
196196

197-
if [[ -n "${JUHPC_CUDA_HOME}" || -n "${JUHPC_ROCM_HOME}" ]]; then
198-
julia_pref 'using Pkg; Pkg.add("Preferences")' 30
199-
echo "[extras]" >> "$JULIA_PREF_PROJECT"
200-
fi
197+
julia_pref 'using Pkg; Pkg.add("Preferences")' 30 # Add Preferences package in any case to avoid that it has to be installed in postinstall scripts that only want to set preferences.
198+
echo "[extras]" >> "$JULIA_PREF_PROJECT"
201199

202200
if [ -n "${JUHPC_CUDA_HOME}" ]; then # Set preference for using the local CUDA runtime before any installation of CUDA.jl to avoid downloading of artifacts
203201
echo 'CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"' >> "$JULIA_PREF_PROJECT"

0 commit comments

Comments
 (0)