Skip to content

Commit 45dc685

Browse files
committed
update src
1 parent 0b48e92 commit 45dc685

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

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)