Skip to content

Commit 1fc4c42

Browse files
authored
Merge pull request #710 from boegel/2023.06-software.eessi.io_accel-nvidia
take into account accelerator target when configuring EasyBuild
2 parents 105d191 + e8af7d8 commit 1fc4c42

File tree

5 files changed

+73
-32
lines changed

5 files changed

+73
-32
lines changed

EESSI-install-software.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,19 @@ echo ">> Setting up \$MODULEPATH..."
207207
module --force purge
208208
# ignore current $MODULEPATH entirely
209209
module unuse $MODULEPATH
210+
211+
# if an accelerator target is specified, we need to make sure that the CPU-only modules are also still available
212+
if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
213+
CPU_ONLY_MODULES_PATH=$(echo $EASYBUILD_INSTALLPATH | sed "s@/accel/${EESSI_ACCELERATOR_TARGET}@@g")/modules/all
214+
if [ -d ${CPU_ONLY_MODULES_PATH} ]; then
215+
module use ${CPU_ONLY_MODULES_PATH}
216+
else
217+
fatal_error "Derived path to CPU-only modules does not exist: ${CPU_ONLY_MODULES_PATH}"
218+
fi
219+
fi
220+
210221
module use $EASYBUILD_INSTALLPATH/modules/all
222+
211223
if [[ -z ${MODULEPATH} ]]; then
212224
fatal_error "Failed to set up \$MODULEPATH?!"
213225
else
@@ -297,8 +309,6 @@ else
297309
done
298310
fi
299311

300-
### add packages here
301-
302312
echo ">> Creating/updating Lmod RC file..."
303313
export LMOD_CONFIG_DIR="${EASYBUILD_INSTALLPATH}/.lmod"
304314
lmod_rc_file="$LMOD_CONFIG_DIR/lmodrc.lua"

bot/build.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ echo "bot/build.sh: EESSI_VERSION_OVERRIDE='${EESSI_VERSION_OVERRIDE}'"
141141
export EESSI_CVMFS_REPO_OVERRIDE=/cvmfs/$(cfg_get_value "repository" "repo_name")
142142
echo "bot/build.sh: EESSI_CVMFS_REPO_OVERRIDE='${EESSI_CVMFS_REPO_OVERRIDE}'"
143143

144-
# determine architecture to be used from entry .architecture in ${JOB_CFG_FILE}
144+
# determine CPU architecture to be used from entry .architecture in ${JOB_CFG_FILE}
145145
# fallbacks:
146146
# - ${CPU_TARGET} handed over from bot
147147
# - left empty to let downstream script(s) determine subdir to be used
@@ -150,6 +150,10 @@ EESSI_SOFTWARE_SUBDIR_OVERRIDE=${EESSI_SOFTWARE_SUBDIR_OVERRIDE:-${CPU_TARGET}}
150150
export EESSI_SOFTWARE_SUBDIR_OVERRIDE
151151
echo "bot/build.sh: EESSI_SOFTWARE_SUBDIR_OVERRIDE='${EESSI_SOFTWARE_SUBDIR_OVERRIDE}'"
152152

153+
# determine accelerator target (if any) from .architecture in ${JOB_CFG_FILE}
154+
export EESSI_ACCELERATOR_TARGET=$(cfg_get_value "architecture" "accelerator")
155+
echo "bot/build.sh: EESSI_ACCELERATOR_TARGET='${EESSI_ACCELERATOR_TARGET}'"
156+
153157
# get EESSI_OS_TYPE from .architecture.os_type in ${JOB_CFG_FILE} (default: linux)
154158
EESSI_OS_TYPE=$(cfg_get_value "architecture" "os_type")
155159
export EESSI_OS_TYPE=${EESSI_OS_TYPE:-linux}
@@ -278,8 +282,8 @@ export TGZ=$(printf "eessi-%s-software-%s-%s-%d.tar.gz" ${EESSI_VERSION} ${EESSI
278282
TMP_IN_CONTAINER=/tmp
279283
echo "Executing command to create tarball:"
280284
echo "./eessi_container.sh ${COMMON_ARGS[@]} ${TARBALL_STEP_ARGS[@]}"
281-
echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
285+
echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} \"${EESSI_ACCELERATOR_TARGET}\" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
282286
./eessi_container.sh "${COMMON_ARGS[@]}" "${TARBALL_STEP_ARGS[@]}" \
283-
-- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}
287+
-- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} "${EESSI_ACCELERATOR_TARGET}" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}
284288

285289
exit 0

configure_easybuild

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1+
# if $WORKDIR is not defined, use a local temporary directory
2+
if [ -z ${WORKDIR} ]; then
3+
WORKDIR=$(mktemp -d)
4+
fi
5+
16
export EASYBUILD_PREFIX=${WORKDIR}/easybuild
27
export EASYBUILD_INSTALLPATH=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR}
38
export EASYBUILD_SOURCEPATH=${WORKDIR}/easybuild/sources:${EESSI_SOURCEPATH}
49

10+
# take into account accelerator target (if specified via $EESSI_ACCELERATOR_TARGET)
11+
if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
12+
if [[ "${EESSI_ACCELERATOR_TARGET}" =~ ^nvidia/cc[0-9][0-9]$ ]]; then
13+
# tweak path to installation directories used by EasyBuild
14+
export EASYBUILD_INSTALLPATH=${EASYBUILD_INSTALLPATH}/accel/${EESSI_ACCELERATOR_TARGET}
15+
# nvidia/cc80 should result in setting $EASYBUILD_CUDA_COMPUTE_CAPABILITIES to '8.0'
16+
export EASYBUILD_CUDA_COMPUTE_CAPABILITIES=$(echo ${EESSI_ACCELERATOR_TARGET} | cut -f2 -d/ | sed 's/^cc\([0-9]\)\([0-9]\)/\1.\2/g')
17+
else
18+
fatal_error "Incorrect value for \$EESSI_ACCELERATOR_TARGET: ${EESSI_ACCELERATOR_TARGET}"
19+
fi
20+
else
21+
echo_yellow "(configure_easybuild) \$EESSI_ACCELERATOR_TARGET not defined"
22+
fi
23+
524
# just ignore OS dependencies for now, see https://github.com/easybuilders/easybuild-framework/issues/3430
625
export EASYBUILD_IGNORE_OSDEPS=1
726

create_tarball.sh

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ set -e
44

55
base_dir=$(dirname $(realpath $0))
66

7-
if [ $# -ne 4 ]; then
8-
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <path to tarball>" >&2
7+
if [ $# -ne 5 ]; then
8+
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <accelerator subdir (example: nvidia/cc80)> <path to tarball>" >&2
99
exit 1
1010
fi
1111
eessi_tmpdir=$1
1212
eessi_version=$2
1313
cpu_arch_subdir=$3
14-
target_tgz=$4
14+
accel_subdir=$4
15+
target_tgz=$5
1516

1617
tmpdir=`mktemp -d`
1718
echo ">> tmpdir: $tmpdir"
@@ -58,30 +59,34 @@ if [ -d ${eessi_version}/init ]; then
5859
find ${eessi_version}/init -type f | grep -v '/\.wh\.' >> ${files_list}
5960
fi
6061

61-
if [ -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules ]; then
62-
# module files
63-
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list}
64-
# module symlinks
65-
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list}
66-
# module files and symlinks
67-
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules/all -type f -o -type l \
68-
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
69-
>> ${module_files_list}
70-
fi
71-
72-
if [ -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/software -a -r ${module_files_list} ]; then
73-
# installation directories but only those for which module files were created
74-
# Note, we assume that module names (as defined by 'PACKAGE_NAME/VERSION.lua'
75-
# using EasyBuild's standard module naming scheme) match the name of the
76-
# software installation directory (expected to be 'PACKAGE_NAME/VERSION/').
77-
# If either side changes (module naming scheme or naming of software
78-
# installation directories), the procedure will likely not work.
79-
for package_version in $(cat ${module_files_list}); do
80-
echo "handling ${package_version}"
81-
ls -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/software/${package_version} \
82-
| grep -v '/\.wh\.' >> ${files_list}
83-
done
84-
fi
62+
# consider both CPU-only and accelerator subdirectories
63+
for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do
64+
65+
if [ -d ${eessi_version}/software/${os}/${subdir}/modules ]; then
66+
# module files
67+
find ${eessi_version}/software/${os}/${subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list}
68+
# module symlinks
69+
find ${eessi_version}/software/${os}/${subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list}
70+
# module files and symlinks
71+
find ${eessi_version}/software/${os}/${subdir}/modules/all -type f -o -type l \
72+
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
73+
>> ${module_files_list}
74+
fi
75+
76+
if [ -d ${eessi_version}/software/${os}/${subdir}/software -a -r ${module_files_list} ]; then
77+
# installation directories but only those for which module files were created
78+
# Note, we assume that module names (as defined by 'PACKAGE_NAME/VERSION.lua'
79+
# using EasyBuild's standard module naming scheme) match the name of the
80+
# software installation directory (expected to be 'PACKAGE_NAME/VERSION/').
81+
# If either side changes (module naming scheme or naming of software
82+
# installation directories), the procedure will likely not work.
83+
for package_version in $(cat ${module_files_list}); do
84+
echo "handling ${package_version}"
85+
ls -d ${eessi_version}/software/${os}/${subdir}/software/${package_version} \
86+
| grep -v '/\.wh\.' >> ${files_list}
87+
done
88+
fi
89+
done
8590

8691
# add a bit debug output
8792
echo "wrote file list to ${files_list}"

run_in_compat_layer_env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ fi
2020
if [ ! -z ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} ]; then
2121
INPUT="export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${EESSI_SOFTWARE_SUBDIR_OVERRIDE}; ${INPUT}"
2222
fi
23+
if [ ! -z ${EESSI_ACCELERATOR_TARGET} ]; then
24+
INPUT="export EESSI_ACCELERATOR_TARGET=${EESSI_ACCELERATOR_TARGET}; ${INPUT}"
25+
fi
2326
if [ ! -z ${EESSI_CVMFS_REPO_OVERRIDE} ]; then
2427
INPUT="export EESSI_CVMFS_REPO_OVERRIDE=${EESSI_CVMFS_REPO_OVERRIDE}; ${INPUT}"
2528
fi

0 commit comments

Comments
 (0)