1616from easybuild .tools .build_log import EasyBuildError , print_msg , print_warning
1717from easybuild .tools .config import build_option , install_path , update_build_option
1818from easybuild .tools .filetools import apply_regex_substitutions , copy_dir , copy_file , remove_file , symlink , which
19+ from easybuild .tools .modules import get_software_root , get_software_root_env_var_name
1920from easybuild .tools .run import run_cmd
2021from easybuild .tools .systemtools import AARCH64 , POWER , X86_64 , det_parallelism , get_cpu_architecture , get_cpu_features
2122from easybuild .tools .toolchain .compiler import OPTARCH_GENERIC
2223from easybuild .tools .toolchain .toolchain import is_system_toolchain
2324from easybuild .tools .version import VERSION as EASYBUILD_VERSION
24- from easybuild .tools .modules import get_software_root_env_var_name
2525
2626# prefer importing LooseVersion from easybuild.tools, but fall back to distuils in case EasyBuild <= 4.7.0 is used
2727try :
5252
5353EESSI_INSTALLATION_REGEX = r"^/cvmfs/[^/]*.eessi.io/versions/"
5454HOST_INJECTIONS_LOCATION = "/cvmfs/software.eessi.io/host_injections/"
55+ SITE_INSTALLATION_LOCATION = os .getenv ("EESSI_SITE_SOFTWARE_PREFIX" , HOST_INJECTIONS_LOCATION )
5556
5657# Make sure a single environment variable name is used for this throughout the hooks
5758EESSI_IGNORE_ZEN4_GCC1220_ENVVAR = "EESSI_IGNORE_LMOD_ERROR_ZEN4_GCC1220"
@@ -744,7 +745,7 @@ def pre_fetch_hook_check_installation_path(self, *args, **kwargs):
744745 accelerator_toolchains = ['rocm-compilers' , 'rompi' , 'rfbf' , 'rfoss' ]
745746 strict_eessi_installation = (
746747 bool (re .search (EESSI_INSTALLATION_REGEX , self .installdir )) or
747- self .installdir .startswith (HOST_INJECTIONS_LOCATION ))
748+ self .installdir .startswith (SITE_INSTALLATION_LOCATION ))
748749 if strict_eessi_installation and not os .getenv ("EESSI_OVERRIDE_STRICT_INSTALLPATH_CHECK" ):
749750 dependency_names = self .cfg .dependency_names ()
750751 if (
@@ -757,15 +758,19 @@ def pre_fetch_hook_check_installation_path(self, *args, **kwargs):
757758 raise EasyBuildError (
758759 f"It seems you are trying to install an accelerator package { self .cfg .name } into a "
759760 f"non-accelerator location { self .installdir } . You need to reconfigure your installation to target "
760- "the correct location."
761+ "the correct location. If using the EESSI-extend module, this means reloading that module "
762+ "with EESSI_ACCELERATOR_INSTALL set:\n "
763+ " EESSI_ACCELERATOR_TARGET=1 module load EESSI-extend"
761764 )
762765 else :
763766 # If we don't have an accelerator dependency then we should be in a CPU installation path
764767 if "/accel/" in self .installdir :
765768 raise EasyBuildError (
766769 f"It seems you are trying to install a CPU-only package { self .cfg .name } into accelerator location "
767770 f"{ self .installdir } . If this is a dependency of the package you are really interested in you will "
768- "need to first install the CPU-only dependencies of that package."
771+ "need to first install the CPU-only dependencies of that package. If using the EESSI-extend "
772+ "module, this means reloading that module with EESSI_ACCELERATOR_INSTALL unset:\n "
773+ " unset EESSI_ACCELERATOR_TARGET=1 && module load EESSI-extend"
769774 )
770775
771776
@@ -1480,6 +1485,23 @@ def pre_configure_hook_cmake_system(self, *args, **kwargs):
14801485 raise EasyBuildError ("CMake-specific hook triggered for non-CMake easyconfig?!" )
14811486
14821487
1488+ def pre_configure_hook_Zoltan (self , * args , ** kwargs ):
1489+ """
1490+ Pre-configure hook for Zoltan to filter out ParMETIS configure options,
1491+ since we filter out ParMETIS as a dependency
1492+ """
1493+ if self .name == 'Zoltan' :
1494+ if get_software_root ('ParMETIS' ) is None :
1495+ configopts = self .cfg ['configopts' ]
1496+ # get rid of all --with-parmetis configure options, and inject --without-parmetis
1497+ configopts = re .sub ('--with-parmetis[^ ]*' , '' , configopts )
1498+ configopts += " --without-parmetis"
1499+ self .cfg ['configopts' ] = configopts
1500+ self .log .info ("Removed --with-parmetis* configure options for {self.name}, ParMETIS is not a dependency" )
1501+ else :
1502+ raise EasyBuildError ("Zoltan-specific hook triggered for non-Zoltan easyconfig?!" )
1503+
1504+
14831505def pre_test_hook (self , * args , ** kwargs ):
14841506 """Main pre-test hook: trigger custom functions based on software name."""
14851507 if self .name in PRE_TEST_HOOKS :
@@ -2068,24 +2090,25 @@ def post_easyblock_hook(self, *args, **kwargs):
20682090
20692091PRE_CONFIGURE_HOOKS = {
20702092 'BLIS' : pre_configure_hook_BLIS ,
2093+ 'CMake' : pre_configure_hook_cmake_system ,
20712094 'CUDA-Samples' : pre_configure_hook_CUDA_Samples_test_remove ,
2072- 'GObject-Introspection ' : pre_configure_hook_gobject_introspection ,
2095+ 'Dyninst ' : pre_configure_hook_dyninst ,
20732096 'Extrae' : pre_configure_hook_extrae ,
2097+ 'GObject-Introspection' : pre_configure_hook_gobject_introspection ,
20742098 'Graphviz' : pre_configure_hook_graphviz ,
20752099 'GRASS' : pre_configure_hook_grass ,
2100+ 'LAMMPS' : pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda ,
20762101 'libfabric' : pre_configure_hook_libfabric_disable_psm3_x86_64_generic ,
20772102 'LLVM' : pre_configure_hook_llvm ,
2078- 'ROCm-LLVM' : pre_configure_hook_llvm ,
20792103 'MetaBAT' : pre_configure_hook_metabat_filtered_zlib_dep ,
20802104 'OpenBLAS' : pre_configure_hook_openblas_optarch_generic ,
20812105 'OpenMPI' : pre_configure_hook_openmpi_ipv6 ,
20822106 'PMIx' : pre_configure_hook_pmix_ipv6 ,
20832107 'PRRTE' : pre_configure_hook_prrte_ipv6 ,
2084- 'WRF' : pre_configure_hook_wrf_aarch64 ,
2085- 'LAMMPS' : pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda ,
2108+ 'ROCm-LLVM' : pre_configure_hook_llvm ,
20862109 'Score-P' : pre_configure_hook_score_p ,
2087- 'Dyninst ' : pre_configure_hook_dyninst ,
2088- 'CMake ' : pre_configure_hook_cmake_system ,
2110+ 'WRF ' : pre_configure_hook_wrf_aarch64 ,
2111+ 'Zoltan ' : pre_configure_hook_Zoltan ,
20892112}
20902113
20912114PRE_TEST_HOOKS = {
0 commit comments