Skip to content

Commit fc7707e

Browse files
committed
{2023.06,2023a} dependencies for PyTorch-bundle v2.1.2
1 parent 093601c commit fc7707e

12 files changed

+412
-14
lines changed

EESSI-install-software.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ display_help() {
1717
echo " --skip-cuda-install - disable installing a full CUDA SDK in the host_injections prefix (e.g. in CI)"
1818
}
1919

20-
# Function to check if a command exists
21-
function command_exists() {
22-
command -v "$1" >/dev/null 2>&1
23-
}
24-
2520
function copy_build_log() {
2621
# copy specified build log to specified directory, with some context added
2722
build_log=${1}
@@ -159,8 +154,13 @@ fi
159154
# are:
160155
# - .lmod/lmodrc.lua
161156
# - .lmod/SitePackage.lua
157+
#
162158
# We run scripts to create them if they don't exist or if the scripts have been
163159
# changed in the PR.
160+
#
161+
# (TODO do we need to change the path if we have sub-directories for
162+
# accelerators? And would we need different scripts for creating lua files under
163+
# different directories?)
164164

165165
# Set base directory for software and for Lmod config files
166166
_eessi_software_path=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR_OVERRIDE}
@@ -256,6 +256,12 @@ if command_exists "nvidia-smi"; then
256256
${EESSI_PREFIX}/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
257257
fi
258258

259+
# Install extra software that is needed (e.g., for providing a custom ctypes
260+
# library when needed)
261+
cd ${TOPDIR}/scripts/extra
262+
./install_extra_packages.sh --temp-dir /tmp/temp --easystack eessi-2023.06-extra-packages.yml
263+
cd ${TOPDIR}
264+
259265
# use PR patch file to determine in which easystack files stuff was added
260266
changed_easystacks=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | egrep -v 'known-issues|missing')
261267
if [ -z "${changed_easystacks}" ]; then

bot/build.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,20 @@ mkdir -p ${TARBALL_TMP_BUILD_STEP_DIR}
266266
BUILD_STEP_ARGS+=("--save" "${TARBALL_TMP_BUILD_STEP_DIR}")
267267
BUILD_STEP_ARGS+=("--storage" "${STORAGE}")
268268
# add options required to handle NVIDIA support
269-
BUILD_STEP_ARGS+=("--nvidia" "all")
269+
if command_exists "nvidia-smi"; then
270+
echo "Command 'nvidia-smi' found, using available GPU"
271+
BUILD_STEP_ARGS+=("--nvidia" "all")
272+
else
273+
echo "No 'nvidia-smi' found, no available GPU but allowing overriding this check"
274+
BUILD_STEP_ARGS+=("--nvidia" "install")
275+
fi
276+
# Retain location for host injections so we don't reinstall CUDA
277+
# (Always need to run the driver installation as available driver may change)
278+
270279
if [[ ! -z ${SHARED_FS_PATH} ]]; then
271280
BUILD_STEP_ARGS+=("--host-injections" "${SHARED_FS_PATH}/host-injections")
272281
fi
273282

274-
# Don't run the Lmod GPU driver check when doing builds (may not have a GPU, and it's not relevant for vanilla builds anyway)
275-
echo "EESSI_OVERRIDE_GPU_CHECK='${EESSI_OVERRIDE_GPU_CHECK}'"
276-
export EESSI_OVERRIDE_GPU_CHECK=1
277-
echo "EESSI_OVERRIDE_GPU_CHECK='${EESSI_OVERRIDE_GPU_CHECK}'"
278-
279283
# create tmp file for output of build step
280284
build_outerr=$(mktemp build.outerr.XXXX)
281285

easystacks/pilot.nessi.no/2023.06/eessi-2023.06-eb-4.9.1-2023a.yml

+20
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,23 @@ easyconfigs:
5555
- PyTorch-2.1.2-foss-2023a-CUDA-12.1.1.eb:
5656
options:
5757
cuda-compute-capabilities: 6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0
58+
# PyTorch-bundle-CUDA's dependencies without CUDA
59+
- librosa-0.10.1-foss-2023a.eb
60+
- NLTK-3.8.1-foss-2023a.eb
61+
- parameterized-0.9.0-GCCcore-12.3.0.eb
62+
- Scalene-1.5.26-GCCcore-12.3.0.eb
63+
- scikit-image-0.22.0-foss-2023a.eb
64+
- SentencePiece-0.2.0-GCC-12.3.0.eb:
65+
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/19987
66+
options:
67+
from-pr: 19987
68+
- libmad-0.15.1b-GCCcore-12.3.0.eb:
69+
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/19987
70+
options:
71+
from-pr: 19987
72+
- SoX-14.4.2-GCCcore-12.3.0.eb:
73+
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/19987
74+
options:
75+
from-pr: 19987
76+
- tensorboard-2.15.1-gfbf-2023a.eb
77+
- tqdm-4.66.1-GCCcore-12.3.0.eb

eb_hooks.py

+86
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import easybuild.tools.environment as env
77
from easybuild.easyblocks.generic.configuremake import obtain_config_guess
88
from easybuild.framework.easyconfig.constants import EASYCONFIG_CONSTANTS
9+
from easybuild.easyblocks.python import EXTS_FILTER_PYTHON_PACKAGES
910
from easybuild.tools.build_log import EasyBuildError, print_msg
1011
from easybuild.tools.config import build_option, update_build_option
1112
from easybuild.tools.filetools import apply_regex_substitutions, copy_file, remove_file, symlink, which
@@ -311,6 +312,31 @@ def parse_hook_qt5_check_qtwebengine_disable(ec, eprefix):
311312
raise EasyBuildError("Qt5-specific hook triggered for non-Qt5 easyconfig?!")
312313

313314

315+
316+
def parse_hook_sentencepiece_disable_tcmalloc_aarch64(ec, eprefix):
317+
"""
318+
Disable using TC_Malloc on 'aarch64/generic'
319+
"""
320+
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
321+
if ec.name == 'SentencePiece' and ec.version in ['0.2.0']:
322+
if cpu_target == CPU_TARGET_AARCH64_GENERIC:
323+
print_msg("parse_hook for SentencePiece: OLD '%s'", ec['components'])
324+
new_components = []
325+
for item in ec['components']:
326+
if item[2]['easyblock'] == 'CMakeMake':
327+
new_item = item[2]
328+
new_item['configopts'] = '-DSPM_ENABLE_TCMALLOC=OFF'
329+
new_components.append((item[0], item[1], new_item))
330+
else:
331+
new_components.append(item)
332+
ec['components'] = new_components
333+
print_msg("parse_hook for SentencePiece: NEW '%s'", ec['components'])
334+
else:
335+
print_msg("parse_hook for SentencePiece on %s -> leaving configopts unchanged", cpu_target)
336+
else:
337+
raise EasyBuildError("SentencePiece-specific hook triggered for non-SentencePiece easyconfig?!")
338+
339+
314340
def parse_hook_ucx_eprefix(ec, eprefix):
315341
"""Make UCX aware of compatibility layer via additional configuration options."""
316342
if ec.name == 'UCX':
@@ -349,6 +375,30 @@ def parse_hook_lammps_remove_deps_for_CI_aarch64(ec, *args, **kwargs):
349375
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
350376

351377

378+
def parse_hook_librosa_custom_ctypes(ec, *args, **kwargs):
379+
"""
380+
Add exts_filter to soundfile extension in exts_list
381+
"""
382+
if ec.name == 'librosa' and ec.version in ('0.10.1',):
383+
ec_dict = ec.asdict()
384+
eessi_software_path = get_eessi_envvar('EESSI_SOFTWARE_PATH')
385+
custom_ctypes_path = os.path.join(eessi_software_path, "software", "custom_ctypes", "1.2")
386+
ebpythonprefixes = "EBPYTHONPREFIXES=%s" % custom_ctypes_path
387+
exts_list_new = []
388+
for item in ec_dict['exts_list']:
389+
if item[0] == 'soundfile':
390+
ext_dict = item[2]
391+
ext_dict['exts_filter'] = (ebpythonprefixes + ' ' + EXTS_FILTER_PYTHON_PACKAGES[0],
392+
EXTS_FILTER_PYTHON_PACKAGES[1])
393+
exts_list_new.append((item[0], item[1], ext_dict))
394+
else:
395+
exts_list_new.append(item)
396+
ec['exts_list'] = exts_list_new
397+
print_msg("New exts_list: '%s'", ec['exts_list'])
398+
else:
399+
raise EasyBuildError("librosa/0.10.1-specific hook triggered for non-librosa/0.10.1 easyconfig?!")
400+
401+
352402
def pre_prepare_hook_highway_handle_test_compilation_issues(self, *args, **kwargs):
353403
"""
354404
Solve issues with compiling or running the tests on both
@@ -852,17 +902,49 @@ def inject_gpu_property(ec):
852902
return ec
853903

854904

905+
906+
def pre_module_hook(self, *args, **kwargs):
907+
"""Main pre-module-check hook: trigger custom functions based on software name."""
908+
if self.name in PRE_MODULE_HOOKS:
909+
PRE_MODULE_HOOKS[self.name](self, *args, **kwargs)
910+
911+
912+
def pre_module_hook_librosa_augment_modluafooter(self, *args, **kwargs):
913+
"""
914+
Add EBPYTHONPREFIXES to modluafooter
915+
"""
916+
if self.name == 'librosa' and self.version == '0.10.1':
917+
eessi_software_path = get_eessi_envvar('EESSI_SOFTWARE_PATH')
918+
custom_ctypes_path = os.path.join(eessi_software_path, "software", "custom_ctypes", "1.2")
919+
key = 'modluafooter'
920+
values = ['prepend_path("EBPYTHONPREFIXES","%s")' % (custom_ctypes_path)]
921+
print_msg("Adding '%s' to modluafooter", values[0])
922+
if not key in self.cfg:
923+
self.cfg[key] = '\n'.join(values)
924+
else:
925+
new_value = self.cfg[key]
926+
for value in values:
927+
if not value in new_value:
928+
new_value = '\n'.join([new_value, value])
929+
self.cfg[key] = new_value
930+
print_msg("Full modluafooter is '%s'", self.cfg[key])
931+
else:
932+
raise EasyBuildError("librosa/0.10.1-specific hook triggered for non-librosa/0.10.1 easyconfig?!")
933+
934+
855935
PARSE_HOOKS = {
856936
'casacore': parse_hook_casacore_disable_vectorize,
857937
'CGAL': parse_hook_cgal_toolchainopts_precise,
858938
'fontconfig': parse_hook_fontconfig_add_fonts,
859939
'GPAW': parse_hook_gpaw_harcoded_path,
860940
'ImageMagick': parse_hook_imagemagick_add_dependency,
861941
'LAMMPS': parse_hook_lammps_remove_deps_for_CI_aarch64,
942+
'librosa': parse_hook_librosa_custom_ctypes,
862943
'OpenBLAS': parse_hook_openblas_relax_lapack_tests_num_errors,
863944
'Pillow-SIMD' : parse_hook_Pillow_SIMD_harcoded_paths,
864945
'pybind11': parse_hook_pybind11_replace_catch2,
865946
'Qt5': parse_hook_qt5_check_qtwebengine_disable,
947+
'SentencePiece': parse_hook_sentencepiece_disable_tcmalloc_aarch64,
866948
'UCX': parse_hook_ucx_eprefix,
867949
}
868950

@@ -909,3 +991,7 @@ def inject_gpu_property(ec):
909991
'cuDNN': post_sanitycheck_cudnn,
910992
'cuTENSOR': post_sanitycheck_cutensor,
911993
}
994+
995+
PRE_MODULE_HOOKS = {
996+
'librosa': pre_module_hook_librosa_augment_modluafooter,
997+
}

eessi_container.sh

+5
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ if [[ ${SETUP_NVIDIA} -eq 1 ]]; then
477477
mkdir -p ${EESSI_USR_LOCAL_CUDA}
478478
BIND_PATHS="${BIND_PATHS},${EESSI_VAR_LOG}:/var/log,${EESSI_USR_LOCAL_CUDA}:/usr/local/cuda"
479479
[[ ${VERBOSE} -eq 1 ]] && echo "BIND_PATHS=${BIND_PATHS}"
480+
if [[ "${NVIDIA_MODE}" == "install" ]] ; then
481+
# No GPU so we need to "trick" Lmod to allow us to load CUDA modules even without a CUDA driver
482+
# (this variable means EESSI_OVERRIDE_GPU_CHECK=1 will be set inside the container)
483+
export SINGULARITYENV_EESSI_OVERRIDE_GPU_CHECK=1
484+
fi
480485
fi
481486
fi
482487

install_scripts.sh

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ nvidia_files=(
113113
eessi-2023.06-cuda-and-libraries.yml
114114
install_cuda_and_libraries.sh
115115
link_nvidia_host_libraries.sh
116+
copy_nvidia_host_libraries.sh
116117
)
117118
copy_files_by_list ${TOPDIR}/scripts/gpu_support/nvidia ${INSTALL_PREFIX}/scripts/gpu_support/nvidia "${nvidia_files[@]}"
118119

run_in_compat_layer_env.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ fi
2626
if [ ! -z ${EESSI_VERSION_OVERRIDE} ]; then
2727
INPUT="export EESSI_VERSION_OVERRIDE=${EESSI_VERSION_OVERRIDE}; ${INPUT}"
2828
fi
29-
if [ ! -z ${http_proxy} ]; then
30-
INPUT="export http_proxy=${http_proxy}; ${INPUT}"
31-
fi
3229
if [ ! -z ${EESSI_OVERRIDE_GPU_CHECK} ]; then
3330
INPUT="export EESSI_OVERRIDE_GPU_CHECK=${EESSI_OVERRIDE_GPU_CHECK}; ${INPUT}"
3431
fi
32+
if [ ! -z ${http_proxy} ]; then
33+
INPUT="export http_proxy=${http_proxy}; ${INPUT}"
34+
fi
3535
if [ ! -z ${https_proxy} ]; then
3636
INPUT="export https_proxy=${https_proxy}; ${INPUT}"
3737
fi

scripts/extra/custom_ctypes-1.2.eb

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
##
2+
# This is a contribution from the NESSI project
3+
# Homepage: https://documentation.sigma2.no
4+
#
5+
# Authors:: Thomas Roeblitz <[email protected]>
6+
# License:: GPL-2.0-only
7+
#
8+
##
9+
10+
easyblock = 'Tarball'
11+
12+
name = 'custom_ctypes'
13+
version = '1.2'
14+
15+
homepage = 'https://github.com/ComputeCanada/custom_ctypes'
16+
description = """custum_ctypes is a small Python package to fix the discovery of libraries with Python's ctypes module. It changes the behavior of find_library to return absolute paths to shared objects rather than just the names."""
17+
18+
toolchain = SYSTEM
19+
20+
source_urls = ['https://github.com/ComputeCanada/custom_ctypes/archive/refs/tags']
21+
sources = ['%(version)s.tar.gz']
22+
checksums = ['3b30ce633c6a329169f2b10ff24b8eaaeef3fa208a66cdacdb53c22f02a88d9b']
23+
24+
sanity_check_paths = {
25+
'files': ['README.md'],
26+
'dirs': ['lib'],
27+
}
28+
29+
moduleclass = 'lib'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
easyconfigs:
2+
- custom_ctypes-1.2.eb
+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env bash
2+
3+
# This script can be used to install extra packages under ${EESSI_SOFTWARE_PATH}
4+
5+
# some logging
6+
echo ">>> Running ${BASH_SOURCE}"
7+
8+
# Initialise our bash functions
9+
TOPDIR=$(dirname $(realpath ${BASH_SOURCE}))
10+
source "${TOPDIR}"/../utils.sh
11+
12+
# Function to display help message
13+
show_help() {
14+
echo "Usage: $0 [OPTIONS]"
15+
echo "Options:"
16+
echo " --help Display this help message"
17+
echo " -e, --easystack EASYSTACKFILE Easystack file which specifies easyconfigs to be installed."
18+
echo " -t, --temp-dir /path/to/tmpdir Specify a location to use for temporary"
19+
echo " storage during the installation"
20+
}
21+
22+
# Initialize variables
23+
TEMP_DIR=
24+
EASYSTACK_FILE=
25+
26+
# Parse command-line options
27+
while [[ $# -gt 0 ]]; do
28+
case "$1" in
29+
--help)
30+
show_help
31+
exit 0
32+
;;
33+
-e|--easystack)
34+
if [ -n "$2" ]; then
35+
EASYSTACK_FILE="$2"
36+
shift 2
37+
else
38+
echo "Error: Argument required for $1"
39+
show_help
40+
exit 1
41+
fi
42+
;;
43+
-t|--temp-dir)
44+
if [ -n "$2" ]; then
45+
TEMP_DIR="$2"
46+
shift 2
47+
else
48+
echo "Error: Argument required for $1"
49+
show_help
50+
exit 1
51+
fi
52+
;;
53+
*)
54+
show_help
55+
fatal_error "Error: Unknown option: $1"
56+
;;
57+
esac
58+
done
59+
60+
if [[ -z ${EASYSTACK_FILE} ]]; then
61+
show_help
62+
fatal_error "Error: need to specify easystack file"
63+
fi
64+
65+
# Make sure NESSI is initialised
66+
check_eessi_initialised
67+
68+
# As an installation location just use $EESSI_SOFTWARE_PATH
69+
export NESSI_CVMFS_INSTALL=${EESSI_SOFTWARE_PATH}
70+
71+
# we need a directory we can use for temporary storage
72+
if [[ -z "${TEMP_DIR}" ]]; then
73+
tmpdir=$(mktemp -d)
74+
else
75+
mkdir -p ${TEMP_DIR}
76+
tmpdir=$(mktemp -d --tmpdir=${TEMP_DIR} extra.XXX)
77+
if [[ ! -d "$tmpdir" ]] ; then
78+
fatal_error "Could not create directory ${tmpdir}"
79+
fi
80+
fi
81+
echo "Created temporary directory '${tmpdir}'"
82+
export WORKING_DIR=${tmpdir}
83+
84+
# load EasyBuild
85+
ml EasyBuild
86+
87+
# load NESSI-extend/2023.06-easybuild
88+
ml NESSI-extend/2023.06-easybuild
89+
90+
eb --show-config
91+
92+
eb --easystack ${EASYSTACK_FILE} --robot
93+
94+
# clean up tmpdir
95+
rm -rf "${tmpdir}"

0 commit comments

Comments
 (0)