Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{2023.06}[foss/2023a] librosa v0.10.1 #391

Closed
6 changes: 6 additions & 0 deletions EESSI-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ if command_exists "nvidia-smi"; then
${EESSI_PREFIX}/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
fi

# Install extra software that is needed (e.g., for providing a custom ctypes
# library when needed)
cd ${TOPDIR}/scripts/extra
./install_extra_packages.sh --temp-dir /tmp/temp --easystack eessi-2023.06-extra-packages.yml
cd ${TOPDIR}

# use PR patch file to determine in which easystack files stuff was added
changed_easystacks=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^easystacks/.*yml$' | egrep -v 'known-issues|missing')
if [ -z "${changed_easystacks}" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ easyconfigs:
- PyTorch-2.1.2-foss-2023a-CUDA-12.1.1.eb:
options:
cuda-compute-capabilities: 6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0
- librosa-0.10.1-foss-2023a.eb
59 changes: 59 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import easybuild.tools.environment as env
from easybuild.easyblocks.generic.configuremake import obtain_config_guess
from easybuild.easyblocks.python import EXTS_FILTER_PYTHON_PACKAGES
from easybuild.framework.easyconfig.constants import EASYCONFIG_CONSTANTS
from easybuild.tools.build_log import EasyBuildError, print_msg
from easybuild.tools.config import build_option, update_build_option
Expand Down Expand Up @@ -349,6 +350,30 @@ def parse_hook_lammps_remove_deps_for_CI_aarch64(ec, *args, **kwargs):
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")


def parse_hook_librosa_custom_ctypes(ec, *args, **kwargs):
"""
Add exts_filter to soundfile extension in exts_list
"""
if ec.name == 'librosa' and ec.version in ('0.10.1',):
ec_dict = ec.asdict()
eessi_software_path = get_eessi_envvar('EESSI_SOFTWARE_PATH')
custom_ctypes_path = os.path.join(eessi_software_path, "software", "custom_ctypes", "1.2")
ebpythonprefixes = "EBPYTHONPREFIXES=%s" % custom_ctypes_path
exts_list_new = []
for item in ec_dict['exts_list']:
if item[0] == 'soundfile':
ext_dict = item[2]
ext_dict['exts_filter'] = (ebpythonprefixes + ' ' + EXTS_FILTER_PYTHON_PACKAGES[0],
EXTS_FILTER_PYTHON_PACKAGES[1])
exts_list_new.append((item[0], item[1], ext_dict))
else:
exts_list_new.append(item)
ec['exts_list'] = exts_list_new
print_msg("New exts_list: '%s'", ec['exts_list'])
else:
raise EasyBuildError("librosa/0.10.1-specific hook triggered for non-librosa/0.10.1 easyconfig?!")


def pre_prepare_hook_highway_handle_test_compilation_issues(self, *args, **kwargs):
"""
Solve issues with compiling or running the tests on both
Expand Down Expand Up @@ -852,13 +877,43 @@ def inject_gpu_property(ec):
return ec


def pre_module_hook(self, *args, **kwargs):
"""Main pre-module-check hook: trigger custom functions based on software name."""
if self.name in PRE_MODULE_HOOKS:
PRE_MODULE_HOOKS[self.name](self, *args, **kwargs)


def pre_module_hook_librosa_augment_modluafooter(self, *args, **kwargs):
"""
Add EBPYTHONPREFIXES to modluafooter
"""
if self.name == 'librosa' and self.version == '0.10.1':
eessi_software_path = get_eessi_envvar('EESSI_SOFTWARE_PATH')
custom_ctypes_path = os.path.join(eessi_software_path, "software", "custom_ctypes", "1.2")
key = 'modluafooter'
values = ['prepend_path("EBPYTHONPREFIXES","%s")' % (custom_ctypes_path)]
print_msg("Adding '%s' to modluafooter", values[0])
if not key in self.cfg:
self.cfg[key] = '\n'.join(values)
else:
new_value = self.cfg[key]
for value in values:
if not value in new_value:
new_value = '\n'.join([new_value, value])
self.cfg[key] = new_value
print_msg("Full modluafooter is '%s'", self.cfg[key])
else:
raise EasyBuildError("librosa/0.10.1-specific hook triggered for non-librosa/0.10.1 easyconfig?!")


PARSE_HOOKS = {
'casacore': parse_hook_casacore_disable_vectorize,
'CGAL': parse_hook_cgal_toolchainopts_precise,
'fontconfig': parse_hook_fontconfig_add_fonts,
'GPAW': parse_hook_gpaw_harcoded_path,
'ImageMagick': parse_hook_imagemagick_add_dependency,
'LAMMPS': parse_hook_lammps_remove_deps_for_CI_aarch64,
'librosa': parse_hook_librosa_custom_ctypes,
'OpenBLAS': parse_hook_openblas_relax_lapack_tests_num_errors,
'Pillow-SIMD' : parse_hook_Pillow_SIMD_harcoded_paths,
'pybind11': parse_hook_pybind11_replace_catch2,
Expand Down Expand Up @@ -909,3 +964,7 @@ def inject_gpu_property(ec):
'cuDNN': post_sanitycheck_cudnn,
'cuTENSOR': post_sanitycheck_cutensor,
}

PRE_MODULE_HOOKS = {
'librosa': pre_module_hook_librosa_augment_modluafooter,
}
29 changes: 29 additions & 0 deletions scripts/extra/custom_ctypes-1.2.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
##
# This is a contribution from the NESSI project
# Homepage: https://documentation.sigma2.no
#
# Authors:: Thomas Roeblitz <[email protected]>
# License:: GPL-2.0-only
#
##

easyblock = 'Tarball'

name = 'custom_ctypes'
version = '1.2'

homepage = 'https://github.com/ComputeCanada/custom_ctypes'
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."""

toolchain = SYSTEM

source_urls = ['https://github.com/ComputeCanada/custom_ctypes/archive/refs/tags']
sources = ['%(version)s.tar.gz']
checksums = ['3b30ce633c6a329169f2b10ff24b8eaaeef3fa208a66cdacdb53c22f02a88d9b']

sanity_check_paths = {
'files': ['README.md'],
'dirs': ['lib'],
}

moduleclass = 'lib'
2 changes: 2 additions & 0 deletions scripts/extra/eessi-2023.06-extra-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
easyconfigs:
- custom_ctypes-1.2.eb
94 changes: 94 additions & 0 deletions scripts/extra/install_extra_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env bash

# This script can be used to install extra packages under ${EESSI_SOFTWARE_PATH}

# some logging
echo ">>> Running ${BASH_SOURCE}"

# Initialise our bash functions
TOPDIR=$(dirname $(realpath ${BASH_SOURCE}))
source "${TOPDIR}"/../utils.sh

# Function to display help message
show_help() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " --help Display this help message"
echo " -e, --easystack EASYSTACKFILE Easystack file which specifies easyconfigs to be installed."
echo " -t, --temp-dir /path/to/tmpdir Specify a location to use for temporary"
echo " storage during the installation"
}

# Initialize variables
TEMP_DIR=
EASYSTACK_FILE=

# Parse command-line options
while [[ $# -gt 0 ]]; do
case "$1" in
--help)
show_help
exit 0
;;
-e|--easystack)
if [ -n "$2" ]; then
EASYSTACK_FILE="$2"
shift 2
else
echo "Error: Argument required for $1"
show_help
exit 1
fi
;;
-t|--temp-dir)
if [ -n "$2" ]; then
TEMP_DIR="$2"
shift 2
else
echo "Error: Argument required for $1"
show_help
exit 1
fi
;;
*)
show_help
fatal_error "Error: Unknown option: $1"
;;
esac
done

if [[ -z ${EASYSTACK_FILE} ]]; then
show_help
fatal_error "Error: need to specify easystack file"
fi

# Make sure NESSI is initialised
check_eessi_initialised

# As an installation location just use $EESSI_SOFTWARE_PATH
export NESSI_CVMFS_INSTALL=${EESSI_SOFTWARE_PATH}

# we need a directory we can use for temporary storage
if [[ -z "${TEMP_DIR}" ]]; then
tmpdir=$(mktemp -d)
else
mkdir -p ${TEMP_DIR}
tmpdir=$(mktemp -d --tmpdir=${TEMP_DIR} extra.XXX)
if [[ ! -d "$tmpdir" ]] ; then
fatal_error "Could not create directory ${tmpdir}"
fi
fi
echo "Created temporary directory '${tmpdir}'"

# load EasyBuild
ml EasyBuild

# load NESSI-extend/2023.06-easybuild
ml NESSI-extend/2023.06-easybuild

eb --show-config

eb --easystack ${EASYSTACK_FILE} --robot

# clean up tmpdir
rm -rf "${tmpdir}"
Loading