Skip to content
Snippets Groups Projects
Commit 721b828e authored by Eric Müller's avatar Eric Müller :mountain_bicyclist:
Browse files

feat: parallelize spack install (i.e. build) of uncached packages

Change-Id: Ibb9cb13002dcfe159e93cd1676cb7d5e142ff328
parent c11627ad
No related branches found
No related tags found
No related merge requests found
...@@ -120,7 +120,7 @@ parser.add_argument( ...@@ -120,7 +120,7 @@ parser.add_argument(
# optional options # optional options
parser.add_argument( parser.add_argument(
"-j", "--jobs", type=int, default=1, "-j", "--jobs", type=int, default=1,
help="Number of parallel jobs to use when concurt execution of tasks is available.") help="Number of parallel jobs to use when concurrent execution of tasks is available.")
parser.add_argument( parser.add_argument(
"--debug", action="store_true", "--debug", action="store_true",
help="Enable debug-level logging.") help="Enable debug-level logging.")
......
...@@ -14,6 +14,8 @@ cd "$HOME" ...@@ -14,6 +14,8 @@ cd "$HOME"
install_from_buildcache "${spack_packages[@]+"${spack_packages[@]}"}" install_from_buildcache "${spack_packages[@]+"${spack_packages[@]}"}"
echo "INSTALLING PACKAGES" echo "INSTALLING PACKAGES"
# heurisitic: let's use -j 8 typically… (and parallelize spack builds)
SPACK_INSTALL_PARALLELISM=1 # ECM (2024-09-16): disabled $(( (${YASHCHIKI_JOBS} - 8) / 8 + 1))
for package in "${spack_packages[@]+"${spack_packages[@]}"}"; do for package in "${spack_packages[@]+"${spack_packages[@]}"}"; do
# Disable cache because we already installed from build cache. # Disable cache because we already installed from build cache.
# Also there is a bug that when `--no-cache` is not specified, install will # Also there is a bug that when `--no-cache` is not specified, install will
...@@ -24,8 +26,12 @@ for package in "${spack_packages[@]+"${spack_packages[@]}"}"; do ...@@ -24,8 +26,12 @@ for package in "${spack_packages[@]+"${spack_packages[@]}"}"; do
echo "ERROR: Failed to concretize ${package} for install." >&2 echo "ERROR: Failed to concretize ${package} for install." >&2
exit 1 exit 1
fi fi
echo "Installing: ${package}" >&2
${MY_SPACK_CMD} "${SPACK_ARGS_INSTALL[@]+"${SPACK_ARGS_INSTALL[@]}"}" install --fresh --no-cache --show-log-on-error --file "${specfile}" echo "Installing: ${package} (parallelism factor ${SPACK_INSTALL_PARALLELISM})" >&2
for i in `seq 1 ${SPACK_INSTALL_PARALLELISM}`; do
(nohup ${MY_SPACK_CMD} "${SPACK_ARGS_INSTALL[@]+"${SPACK_ARGS_INSTALL[@]}"}" install -j $(( (${YASHCHIKI_JOBS} - ${SPACK_INSTALL_PARALLELISM}) / ${SPACK_INSTALL_PARALLELISM} + 1 )) --fresh --no-cache --show-log-on-error --file "${specfile}" | sed -e "s:^:[${package}-${i}] :g") &
done
wait
done done
# create the filesystem views (exposed via singularity --app option) # create the filesystem views (exposed via singularity --app option)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment