Skip to content

Commit 117c194

Browse files
simonpintarellibcummingomlins
authored
add julia with cuda 12.6, spack 0.23 (#184)
--------- Co-authored-by: bcumming <[email protected]> Co-authored-by: Samuel Omlin <[email protected]>
1 parent d0d6f12 commit 117c194

File tree

8 files changed

+251
-0
lines changed

8 files changed

+251
-0
lines changed

config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ uenvs:
169169
zen3: "24.9/mc"
170170
gh200: "24.9/gh200"
171171
develop: False
172+
"25.5":
173+
recipes:
174+
gh200: "25.5/gh200"
175+
develop: False
172176
lammps:
173177
"2023":
174178
recipes:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bootstrap:
2+
3+
gcc:
4+
specs:
5+

recipes/julia/25.5/gh200/config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: julia
2+
spack:
3+
commit: releases/v0.23
4+
repo: https://github.com/spack/spack.git
5+
store: /user-environment
6+
description: HPC setup for Juliaup, Julia and some HPC key packages (MPI.jl, CUDA.jl, AMDGPU.jl, HDF5.jl, ADIOS2.jl, ...) + GNU Compiler toolchain with cray-mpich, HDF5, ADIOS2, Python, CMake and other development tools.
7+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
gcc-env:
2+
compiler:
3+
- toolchain: gcc
4+
spec: gcc@13
5+
mpi:
6+
7+
gpu: cuda
8+
unify: true
9+
specs:
10+
11+
12+
- fftw
13+
- fmt
14+
- hdf5+hl
15+
- libtree
16+
- meson
17+
- nccl
18+
- nccl-tests
19+
- ninja
20+
- openblas threads=openmp
21+
22+
- python
23+
- bzip2
24+
- zfp
25+
- sz
26+
- libpng
27+
- c-blosc2
28+
29+
- mgard
30+
- libcatalyst
31+
- [email protected]+hdf5+python+fortran
32+
- '[email protected]+hdf5+python+fortran+sst+pic+shared+bzip2+zfp+sz+png+blosc2+mgard+libcatalyst'
33+
# disable libpressio because it causes compilation errors when building adios2
34+
#- '[email protected]+hdf5+python+fortran+sst+pic+shared+bzip2+zfp+sz+png+blosc2+libpressio+mgard+libcatalyst'
35+
variants:
36+
- +mpi
37+
- +cuda
38+
- cuda_arch=90
39+
views:
40+
default:
41+
link: roots
42+
uenv:
43+
prefix_paths:
44+
LD_LIBRARY_PATH: [lib, lib64]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
default:
2+
features:
3+
- cuda
4+
- mpi
5+
- osu-micro-benchmarks
6+
- openmp
7+
- serial
8+
cc: mpicc
9+
cxx: mpic++
10+
ftn: mpifort
11+
activation: /user-environment/env/default/activate.sh
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Author: Samuel Omlin, CSCS (omlins)
2+
#
3+
# Description: Creation of an uenv view equivalent to the activation script in JUHPC.
4+
5+
6+
using Pkg; Pkg.add("JSON")
7+
using JSON
8+
9+
10+
# Functions
11+
12+
function check_env(vars...)
13+
for var in vars
14+
if !haskey(ENV, var)
15+
error("uenv-view: $var is not set.")
16+
elseif isempty(ENV[var])
17+
error("uenv-view: $var is empty.")
18+
end
19+
end
20+
end
21+
22+
function uenv_env(key::AbstractString)
23+
s = ENV[key]
24+
pattern = r"\$\{(.*?)\}"
25+
for m in eachmatch(pattern, s)
26+
s = replace(s, m.match => "\${@" * m.captures[1] * "@}")
27+
end
28+
return s
29+
end
30+
31+
32+
# Check if the required environment variables are set and not empty
33+
34+
check_env("JULIA_WRAPPER_BINDIR", "JULIAUP_WRAPPER_BINDIR", "JULIAUP_BINDIR", "JULIAUP_DEPOT", "JULIA_DEPOT", "JULIA_PREFDIR", "JULIAUP_INSTALLDIR", "ENV_JSON")
35+
36+
37+
# Define the environment variables part of the juliaup view
38+
39+
juliaup_view_env = Dict(
40+
"values" => Dict(
41+
"list" => Dict(
42+
"PATH" => [
43+
Dict(
44+
"value" => [uenv_env("JULIAUP_WRAPPER_BINDIR"), uenv_env("JULIAUP_BINDIR")], # The wrapper must be before the juliaup bindir
45+
"op" => "prepend",
46+
),
47+
],
48+
),
49+
"scalar" => Dict(
50+
"JULIAUP_DEPOT_PATH" => uenv_env("JULIAUP_DEPOT"),
51+
"JULIA_DEPOT_PATH" => uenv_env("JULIA_DEPOT"),
52+
"JULIA_LOAD_PATH" => ":$(uenv_env("JULIA_PREFDIR"))", # ":" means appending!
53+
[key => uenv_env(env_key) for (key, env_key) in
54+
[("CUDA_HOME", "JUHPC_CUDA_HOME"),
55+
("ROCM_PATH", "JUHPC_ROCM_HOME"),
56+
("JULIA_ADIOS2_PATH", "JUHPC_ADIOS2_HOME")]
57+
if haskey(ENV, env_key) && !isempty(uenv_env(env_key))]..., # Conditional inclusion for variables if they are set and not empty
58+
[("JULIA_CUDA_MEMORY_POOL" => "none") for env_key in ["JUHPC_CUDA_HOME"] if haskey(ENV, env_key) && !isempty(uenv_env(env_key))]... # Conditionally include JULIA_CUDA_MEMORY_POOL
59+
)
60+
),
61+
"version" => 1
62+
)
63+
64+
65+
# Define the environment variables part of the jupyter view
66+
67+
jupyter_view_env = deepcopy(juliaup_view_env)
68+
jupyter_view_env["values"]["list"]["PATH"] = [
69+
Dict(
70+
"value" => [uenv_env("IJULIA_INSTALLER_BINDIR"), uenv_env("JULIA_WRAPPER_BINDIR"), uenv_env("JULIAUP_WRAPPER_BINDIR"), uenv_env("JULIAUP_BINDIR")], # The wrappers must be before the juliaup bindir
71+
"op" => "prepend",
72+
),
73+
]
74+
75+
76+
# Define the juliaup view
77+
78+
juliaup_view = Dict(
79+
"juliaup" => Dict(
80+
"root" => "/user-environment/env/juliaup",
81+
"env" => juliaup_view_env,
82+
"activate" => "/dev/null",
83+
"description" => "description: HPC setup for Juliaup, Julia and some HPC key packages (Juliaup and Julia are installed on first execution of `juliaup`` in $(ENV["JULIAUP_INSTALLDIR"]))",
84+
"type" => "augment"
85+
)
86+
)
87+
88+
89+
# Define the jupyter view
90+
jupyter_view = Dict(
91+
"jupyter" => Dict(
92+
"root" => "/user-environment/env/jupyter",
93+
"env" => jupyter_view_env,
94+
"activate" => "/dev/null",
95+
"description" => "description: HPC setup for Julia in Jupyter: IJulia can be installed from a Jupyter terminal by typing `install_ijulia`. The setup includes furthermore Juliaup, Julia and some HPC key packages (if not present, Juliaup and Julia are installed on first execution of `install_ijulia`/`julia`/`juliaup` in $(ENV["JULIAUP_INSTALLDIR"]))",
96+
"type" => "augment"
97+
)
98+
)
99+
100+
101+
# Merge the juliaup view with the existing views in the JSON file
102+
103+
env = JSON.parsefile(ENV["ENV_JSON"])
104+
views = env["views"]
105+
views = merge(views, juliaup_view)
106+
views = merge(views, jupyter_view)
107+
env["views"] = views
108+
open(ENV["ENV_JSON"],"w") do f
109+
JSON.print(f, env, 4)
110+
end
111+
112+
113+
# Print the new views to the console
114+
@info "New views:"
115+
@info "Juliaup view:"
116+
JSON.print(stdout, juliaup_view, 4)
117+
@info "Jupyter view:"
118+
JSON.print(stdout, jupyter_view, 4)
119+
120+
121+
# Remove the added package
122+
Pkg.rm("JSON")

recipes/julia/25.5/gh200/modules.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
modules:
2+
# Paths to check when creating modules for all module sets
3+
prefix_inspections:
4+
bin:
5+
- PATH
6+
lib:
7+
- LD_LIBRARY_PATH
8+
lib64:
9+
- LD_LIBRARY_PATH
10+
11+
default:
12+
arch_folder: false
13+
# Where to install modules
14+
roots:
15+
tcl: /user-environment/modules
16+
tcl:
17+
all:
18+
autoload: run
19+
hash_length: 0
20+
exclude_implicits: true
21+
hide_implicits: true
22+
exclude: ['%[email protected]', 'gcc %[email protected]']
23+
projections:
24+
all: '{name}/{version}'

recipes/julia/25.5/gh200/post-install

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Author: Samuel Omlin, CSCS (omlins)
4+
#
5+
# Description: Definition of site specific variables and call of JUHPC.
6+
# Site: ALPS:daint, Swiss National Supercomputing Centre (CSCS)
7+
# Base: uenv
8+
9+
10+
# UENV specific environment variables
11+
export ENV_MOUNT={{ env.mount }} # export ENV_MOUNT=/user-environment
12+
export ENV_META=$ENV_MOUNT/meta
13+
export ENV_EXTRA=$ENV_META/extra
14+
export ENV_JSON=$ENV_META/env.json
15+
16+
17+
# Environment variables for HPC key packages that require system libraries (MPI.jl, CUDA.jl, AMDGPU.jl, HDF5.jl and ADIOS2.jl)
18+
export JUHPC_CUDA_HOME=$(spack -C $ENV_MOUNT/config location -i cuda)
19+
export JUHPC_CUDA_RUNTIME_VERSION=$(spack --color=never -C $ENV_MOUNT/config find cuda | \
20+
perl -ne 'print $1 if /cuda@([\d.]+)/')
21+
export JUHPC_MPI_HOME=$(spack -C $ENV_MOUNT/config location -i cray-mpich)
22+
export JUHPC_MPI_EXEC="srun"
23+
export JUHPC_HDF5_HOME=$(spack -C $ENV_MOUNT/config location -i hdf5)
24+
export JUHPC_ADIOS2_HOME=$(spack -C $ENV_MOUNT/config location -i adios2)
25+
26+
27+
# Call JUHPC
28+
JUHPC_SETUP_INSTALLDIR=$ENV_MOUNT/juhpc_setup
29+
UARCH=gh200
30+
JULIAUP_INSTALLDIR="\${SCRATCH}/$UARCH/juliaup"
31+
JUHPC_POST_INSTALL_JL=$ENV_EXTRA/uenv_view.jl # This will convert environment variables of the form ${...} to ${@...@} as required by uenv
32+
VERSION="v0.4.0"
33+
wget https://raw.githubusercontent.com/JuliaParallel/JUHPC/$VERSION/juhpc -O /tmp/juhpc
34+
bash -l /tmp/juhpc $JUHPC_SETUP_INSTALLDIR $JULIAUP_INSTALLDIR --postinstall=$JUHPC_POST_INSTALL_JL --verbose=1

0 commit comments

Comments
 (0)