|
6 | 6 | import easybuild.tools.environment as env
|
7 | 7 | from easybuild.easyblocks.generic.configuremake import obtain_config_guess
|
8 | 8 | from easybuild.framework.easyconfig.constants import EASYCONFIG_CONSTANTS
|
| 9 | +from easybuild.easyblocks.python import EXTS_FILTER_PYTHON_PACKAGES |
9 | 10 | from easybuild.tools.build_log import EasyBuildError, print_msg
|
10 | 11 | from easybuild.tools.config import build_option, update_build_option
|
11 | 12 | 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):
|
311 | 312 | raise EasyBuildError("Qt5-specific hook triggered for non-Qt5 easyconfig?!")
|
312 | 313 |
|
313 | 314 |
|
| 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 | + |
314 | 340 | def parse_hook_ucx_eprefix(ec, eprefix):
|
315 | 341 | """Make UCX aware of compatibility layer via additional configuration options."""
|
316 | 342 | if ec.name == 'UCX':
|
@@ -349,6 +375,30 @@ def parse_hook_lammps_remove_deps_for_CI_aarch64(ec, *args, **kwargs):
|
349 | 375 | raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
|
350 | 376 |
|
351 | 377 |
|
| 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 | + |
352 | 402 | def pre_prepare_hook_highway_handle_test_compilation_issues(self, *args, **kwargs):
|
353 | 403 | """
|
354 | 404 | Solve issues with compiling or running the tests on both
|
@@ -852,17 +902,49 @@ def inject_gpu_property(ec):
|
852 | 902 | return ec
|
853 | 903 |
|
854 | 904 |
|
| 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 | + |
855 | 935 | PARSE_HOOKS = {
|
856 | 936 | 'casacore': parse_hook_casacore_disable_vectorize,
|
857 | 937 | 'CGAL': parse_hook_cgal_toolchainopts_precise,
|
858 | 938 | 'fontconfig': parse_hook_fontconfig_add_fonts,
|
859 | 939 | 'GPAW': parse_hook_gpaw_harcoded_path,
|
860 | 940 | 'ImageMagick': parse_hook_imagemagick_add_dependency,
|
861 | 941 | 'LAMMPS': parse_hook_lammps_remove_deps_for_CI_aarch64,
|
| 942 | + 'librosa': parse_hook_librosa_custom_ctypes, |
862 | 943 | 'OpenBLAS': parse_hook_openblas_relax_lapack_tests_num_errors,
|
863 | 944 | 'Pillow-SIMD' : parse_hook_Pillow_SIMD_harcoded_paths,
|
864 | 945 | 'pybind11': parse_hook_pybind11_replace_catch2,
|
865 | 946 | 'Qt5': parse_hook_qt5_check_qtwebengine_disable,
|
| 947 | + 'SentencePiece': parse_hook_sentencepiece_disable_tcmalloc_aarch64, |
866 | 948 | 'UCX': parse_hook_ucx_eprefix,
|
867 | 949 | }
|
868 | 950 |
|
@@ -909,3 +991,7 @@ def inject_gpu_property(ec):
|
909 | 991 | 'cuDNN': post_sanitycheck_cudnn,
|
910 | 992 | 'cuTENSOR': post_sanitycheck_cutensor,
|
911 | 993 | }
|
| 994 | + |
| 995 | +PRE_MODULE_HOOKS = { |
| 996 | + 'librosa': pre_module_hook_librosa_augment_modluafooter, |
| 997 | +} |
0 commit comments