Skip to content

Commit 94b94c0

Browse files
committed
write tmp installation output into log
1 parent 6eecd69 commit 94b94c0

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

juhpc

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ check_dir() {
5959
done
6060
}
6161

62+
julia_pref() {
63+
local cmd="$1"
64+
julia --project="$JULIA_PREFDIR" -e "$cmd" >> "$TMP_JULIAUP_LOG" 2>&1
65+
}
66+
6267

6368
# Assign passed arguments to environment variables
6469

@@ -121,48 +126,48 @@ export JULIA_PREFS="$JULIA_PREFDIR/LocalPreferences.toml"
121126
mkdir -p "$JULIA_PREFDIR" || { error "failed to create directory: $JULIA_PREFDIR"; }
122127

123128
if [[ -n "${JUHPC_CUDA_HOME}" || -n "${JUHPC_ROCM_HOME}" ]]; then
124-
julia --project="$JULIA_PREFDIR" -e 'using Pkg; Pkg.add("Preferences")' >> $TMP_JULIAUP_LOG
129+
julia_pref 'using Pkg; Pkg.add("Preferences")'
125130
echo "[extras]" >> "$JULIA_PREF_PROJECT"
126131
fi
127132

128133
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
129134
echo 'CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"' >> "$JULIA_PREF_PROJECT"
130135

131-
julia --project="$JULIA_PREFDIR" -e 'using Preferences; set_preferences!("CUDA_Runtime_jll", "local"=>true)' >> $TMP_JULIAUP_LOG
136+
julia_pref 'using Preferences; set_preferences!("CUDA_Runtime_jll", "local"=>true)'
132137
if [ -n "${JUHPC_CUDA_RUNTIME_VERSION}" ]; then
133-
julia --project="$JULIA_PREFDIR" -e 'using Preferences; set_preferences!("CUDA_Runtime_jll", "version"=>join(split(ENV["JUHPC_CUDA_RUNTIME_VERSION"],".")[1:2],"."))' >> $TMP_JULIAUP_LOG
138+
julia_pref 'using Preferences; set_preferences!("CUDA_Runtime_jll", "version"=>join(split(ENV["JUHPC_CUDA_RUNTIME_VERSION"],".")[1:2],"."))'
134139
fi
135140
fi
136141

137142
if [ -n "${JUHPC_ROCM_HOME}" ]; then # Set preference for using the local ROCm runtime before any installation of AMDGPU.jl to avoid downloading of artifacts
138143
echo 'AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"' >> "$JULIA_PREF_PROJECT"
139144

140-
julia --project="$JULIA_PREFDIR" -e 'using Preferences; set_preferences!("AMDGPU", "use_artifacts"=>false, "eager_gc"=>false)' >> $TMP_JULIAUP_LOG
145+
julia_pref 'using Preferences; set_preferences!("AMDGPU", "use_artifacts"=>false, "eager_gc"=>false)'
141146
fi
142147

143148
if [ -n "${JUHPC_CUDA_HOME}" ]; then export CUDA_HOME="$JUHPC_CUDA_HOME"; fi
144149
if [ -n "${JUHPC_ROCM_HOME}" ]; then export ROCM_PATH="$JUHPC_ROCM_HOME"; fi
145150

146-
julia --project="$JULIA_PREFDIR" -e 'using Pkg; Pkg.add([p for (p,l) in [("MPIPreferences", "JUHPC_MPI_VENDOR"), ("MPIPreferences", "JUHPC_MPI_HOME"), ("CUDA", "JUHPC_CUDA_HOME"), ("AMDGPU", "JUHPC_ROCM_HOME"), ("HDF5", "JUHPC_HDF5_HOME")] if haskey(ENV,l) && ENV[l]!=""])' >> $TMP_JULIAUP_LOG
151+
julia_pref 'using Pkg; Pkg.add([p for (p,l) in [("MPIPreferences", "JUHPC_MPI_VENDOR"), ("MPIPreferences", "JUHPC_MPI_HOME"), ("CUDA", "JUHPC_CUDA_HOME"), ("AMDGPU", "JUHPC_ROCM_HOME"), ("HDF5", "JUHPC_HDF5_HOME")] if haskey(ENV,l) && ENV[l]!=""])'
147152

148153
if [ -n "${JUHPC_CUDA_HOME}" ]; then # Set preference for using the local CUDA runtime in a more stable way (in case the previous would not be valid anymore)
149-
julia --project="$JULIA_PREFDIR" -e 'using CUDA; CUDA.set_runtime_version!((VersionNumber(join(split(ENV[key],".")[1:2],".")) for key in ["JUHPC_CUDA_RUNTIME_VERSION"] if haskey(ENV,key) && ENV[key]!=="")...; local_toolkit=true)' >> $TMP_JULIAUP_LOG
154+
julia_pref 'using CUDA; CUDA.set_runtime_version!((VersionNumber(join(split(ENV[key],".")[1:2],".")) for key in ["JUHPC_CUDA_RUNTIME_VERSION"] if haskey(ENV,key) && ENV[key]!=="")...; local_toolkit=true)'
150155
fi
151156

152157
if [ -n "${JUHPC_ROCM_HOME}" ]; then # Set preference for using the local ROCm runtime in a more stable way (in case the previous would not be valid anymore)
153-
julia --project="$JULIA_PREFDIR" -e 'using AMDGPU; AMDGPU.ROCmDiscovery.use_artifacts!(false)' >> $TMP_JULIAUP_LOG
158+
julia_pref 'using AMDGPU; AMDGPU.ROCmDiscovery.use_artifacts!(false)'
154159
fi
155160

156161
if [ -n "${JUHPC_MPI_VENDOR}" ]; then
157162
check_var "JUHPC_MPI_EXEC"
158-
julia --project="$JULIA_PREFDIR" -e 'using MPIPreferences; MPIPreferences.use_system_binary(mpiexec=split(ENV["JUHPC_MPI_EXEC"]), vendor=ENV["JUHPC_MPI_VENDOR"])' >> $TMP_JULIAUP_LOG
163+
julia_pref 'using MPIPreferences; MPIPreferences.use_system_binary(mpiexec=split(ENV["JUHPC_MPI_EXEC"]), vendor=ENV["JUHPC_MPI_VENDOR"])'
159164
elif [ -n "${JUHPC_MPI_HOME}" ]; then
160165
check_var "JUHPC_MPI_EXEC"
161-
julia --project="$JULIA_PREFDIR" -e 'using MPIPreferences; MPIPreferences.use_system_binary(mpiexec=split(ENV["JUHPC_MPI_EXEC"]), extra_paths=["$(ENV["JUHPC_MPI_HOME"])/lib"])' >> $TMP_JULIAUP_LOG
166+
julia_pref 'using MPIPreferences; MPIPreferences.use_system_binary(mpiexec=split(ENV["JUHPC_MPI_EXEC"]), extra_paths=["$(ENV["JUHPC_MPI_HOME"])/lib"])'
162167
fi
163168

164169
if [ -n "${JUHPC_HDF5_HOME}" ]; then
165-
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")' >> $TMP_JULIAUP_LOG
170+
julia_pref 'using HDF5; HDF5.API.set_libraries!("$(ENV["JUHPC_HDF5_HOME"])/lib/libhdf5.so", "$(ENV["JUHPC_HDF5_HOME"])/lib/libhdf5_hl.so")'
166171
fi
167172

168173
if [ ! -s "$JULIA_PREFS" ]; then error "preferences file is missing or empty."; fi

0 commit comments

Comments
 (0)