@@ -31,6 +31,16 @@ info() {
31
31
echo -e " $JUHPC $message " >&2
32
32
}
33
33
34
+ info_start () {
35
+ local message=" $1 "
36
+ info " $message ..."
37
+ }
38
+
39
+ info_end () {
40
+ local message=" $1 "
41
+ info " ... done. $message completed."
42
+ }
43
+
34
44
cleanup () {
35
45
info " cleaning up temporary juliaup installation in $TMP_JULIAUP_ROOTDIR ."
36
46
rm -rf " $TMP_JULIAUP_ROOTDIR "
@@ -70,7 +80,15 @@ export JUHPC_POST_INSTALL_JL="$3"
70
80
# Set (derived) general environment variables
71
81
72
82
export JULIAUP_BINDIR=$JULIAUP_INSTALLDIR /bin # juliaup and julia binaries
73
- export TMP=/dev/shm/$USER
83
+
84
+ if [ -d " /dev/shm" ]; then
85
+ export TMP=" /dev/shm/$USER "
86
+ elif [ -d " /tmp" ]; then
87
+ export TMP=" /tmp/$USER "
88
+ else
89
+ error " Neither /dev/shm nor /tmp directories exist. Cannot set TMP environment variable."
90
+ fi
91
+
74
92
export TMP_JULIAUP_ROOTDIR=$TMP /juliaup
75
93
76
94
@@ -84,7 +102,8 @@ check_dir "$JUHPC_SETUP_INSTALLDIR"
84
102
85
103
# Download and install julia in /tmp using juliaup
86
104
87
- info " Installing temporary juliaup installation in $TMP_JULIAUP_ROOTDIR ..."
105
+ INFO_MSG=" Installing temporary juliaup installation in $TMP_JULIAUP_ROOTDIR "
106
+ info_start $INFO_MSG
88
107
89
108
export TMP_JULIAUP_BINDIR=$TMP_JULIAUP_ROOTDIR /bin # juliaup and julia binaries
90
109
export JULIAUP_DEPOT_PATH=$TMP_JULIAUP_ROOTDIR /depot
@@ -98,12 +117,13 @@ curl -fsSL https://install.julialang.org | sh -s -- --add-to-path=no --yes --pat
98
117
99
118
if [ ! -f " $TMP_JULIAUP_BINDIR /juliaup" ]; then error " temporary juliaup installation failed." ; fi
100
119
101
- info " ... done. "
120
+ info_end $INFO_MSG
102
121
103
122
104
123
# Create preferences for HPC key packages that require system libraries (MPI.jl, CUDA.jl, AMDGPU.jl, HDF5.jl, ADIOS2.jl, ...)
105
124
106
- info " Creating preferences for HPC key packages..."
125
+ INFO_MSG=" Creating preferences for HPC key packages"
126
+ info_start $INFO_MSG
107
127
108
128
export JULIA_PREFDIR=$JUHPC_SETUP_INSTALLDIR /julia_preferences
109
129
export JULIA_PREF_PROJECT=$JULIA_PREFDIR /Project.toml
@@ -154,12 +174,13 @@ if [ -n "${JUHPC_HDF5_HOME}" ]; then
154
174
julia --project=$JULIA_PREFDIR -e ' using HDF5; HDF5.API.set_libraries!("$(ENV["JUHPC_HDF5_HOME"])/lib/libhdf5.so", "$(ENV["JUHPC_HDF5_HOME"])/lib/libhdf5_hl.so")'
155
175
fi
156
176
157
- info " ... done. "
177
+ info_end $INFO_MSG
158
178
159
179
160
180
# Create a wrapper for juliaup that installs juliaup (and latest julia) on scratch if it is not already installed
161
181
162
- info " Creating wrapper for juliaup..."
182
+ INFO_MSG=" Creating wrapper for juliaup"
183
+ info_start $INFO_MSG
163
184
164
185
export JULIAUP_WRAPPER_BINDIR=$JUHPC_SETUP_INSTALLDIR /juliaup_wrapper
165
186
export JULIAUP_WRAPPER=$JULIAUP_WRAPPER_BINDIR /juliaup
@@ -177,27 +198,32 @@ info() {
177
198
echo -e "$(ENV["JUHPC"]) \$message" >&2
178
199
}
179
200
180
- if [ ! -f $(ENV["JULIAUP_BINDIR"])/juliaup ]; then
201
+ JULIAUP_EXE=$(ENV["JULIAUP_BINDIR"])/juliaup
202
+
203
+ if [ ! -f "$JULIAUP_EXE" ]; then
181
204
print_logo
182
205
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"])..."
206
+ sleep 3
183
207
PATH_OLD=\$PATH
184
208
export PATH=\$(echo \$PATH | perl -pe "s|[^:]*juliaup(?:_wrapper)?[^:]*:?||g") # Remove all juliaup paths from PATH
185
209
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; }
186
210
export PATH=\$PATH_OLD
187
- info "... done."
211
+ if [ ! -f "$JULIAUP_EXE" ]; then error "juliaup installation failed."; fi
212
+ info "... done. Installation of juliaup and the latest julia in $(ENV["JULIAUP_INSTALLDIR"]) completed. You can use juliaup and julia normally."
188
213
else
189
- $(ENV["JULIAUP_BINDIR"])/juliaup \$@
214
+ $JULIAUP_EXE \$@
190
215
fi
191
216
""")
192
217
' > $JULIAUP_WRAPPER
193
218
chmod +x $JULIAUP_WRAPPER
194
219
195
- info " ... done. "
220
+ info_end $INFO_MSG
196
221
197
222
198
223
# Create an activation script that sets environment variables for juliaup, julia and HPC key packages
199
224
200
- info " Creating activation script..."
225
+ INFO_MSG=" Creating activation script"
226
+ info_start $INFO_MSG
201
227
202
228
export JULIAUP_DEPOT=$JULIAUP_INSTALLDIR /depot
203
229
export JULIA_DEPOT=$JULIAUP_INSTALLDIR /depot
@@ -233,15 +259,16 @@ $(haskey(ENV,"JUHPC_ADIOS2_HOME") && ENV["JUHPC_ADIOS2_HOME"] != "" ? """
233
259
""" : "")
234
260
""")' > $ACTIVATE_SCRIPT
235
261
236
- info " ... done. "
262
+ info_end $INFO_MSG
237
263
238
264
239
265
# Optionally execute a site-specific post installation julia script (if passed a third argument)
240
266
241
267
if [ -n " ${JUHPC_POST_INSTALL_JL} " ]; then
242
- info " Executing site-specific post installation julia script (using the project where preferences were set)..."
268
+ INFO_MSG=" Executing site-specific post installation julia script (using the project where preferences were set)"
269
+ info_start $INFO_MSG
243
270
julia --project=$JULIA_PREFDIR $JUHPC_POST_INSTALL_JL
244
- info " ... done. "
271
+ info_end $INFO_MSG
245
272
fi
246
273
247
274
250
277
cleanup
251
278
rm -f $JULIA_PREFDIR /Manifest.toml
252
279
253
- info " ... Installation of HPC setup for juliaup, julia and HPC key packages requiring system libraries is complete."
280
+ info " ... Installation of HPC setup for juliaup, julia and HPC key packages requiring system libraries is complete.\n\n "
0 commit comments