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

Print LmodError when loading GCCcore-12.2.0-based modules on zen4 #841

Merged
merged 8 commits into from
Jan 10, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
EESSI_INSTALLATION_REGEX = r"^/cvmfs/[^/]*.eessi.io/versions/"
HOST_INJECTIONS_LOCATION = "/cvmfs/software.eessi.io/host_injections/"

# Make sure a single environment variable name is used for this throughout the hooks
EESSI_IGNORE_ZEN4_GCC1220_ENVVAR="EESSI_IGNORE_LMOD_ERROR_ZEN4_GCC1220"

def is_gcccore_1220_based(ecname, ecversion, tcname, tcversion):
casparvl marked this conversation as resolved.
Show resolved Hide resolved
"""Checks if this easyconfig either _is_ or _uses_ a GCCcore-12.2.2 based toolchain"""
casparvl marked this conversation as resolved.
Show resolved Hide resolved
gcccore_based_names = ['GCCcore', 'GCC']
foss_based_names = ['gfbf', 'gompi', 'foss']
return (
(tcname in foss_based_names and tcversion == '2022b') or
(tcname in gcccore_based_names and LooseVersion(tcversion) == LooseVersion('12.2.0')) or
(ecname in foss_based_names and ecversion == '2022b') or
(ecname in gcccore_based_names and LooseVersion(ecversion) == LooseVersion('12.2.0'))
)


def get_eessi_envvar(eessi_envvar):
"""Get an EESSI environment variable from the environment"""
Expand Down Expand Up @@ -77,6 +91,11 @@ def parse_hook(ec, *args, **kwargs):
if ec.name in PARSE_HOOKS:
PARSE_HOOKS[ec.name](ec, eprefix)

# Always trigger this one, regardless of ec.name
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
if cpu_target == CPU_TARGET_ZEN4:
parse_hook_zen4_module_only(ec, eprefix)

# inject the GPU property (if required)
ec = inject_gpu_property(ec)

Expand Down Expand Up @@ -130,6 +149,11 @@ def pre_prepare_hook(self, *args, **kwargs):
if self.name in PRE_PREPARE_HOOKS:
PRE_PREPARE_HOOKS[self.name](self, *args, **kwargs)

# Always trigger this one, regardless of ec.name
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
if cpu_target == CPU_TARGET_ZEN4:
pre_prepare_hook_ignore_zen4_gcccore1220_error(self, *args, **kwargs)


def post_prepare_hook_gcc_prefixed_ld_rpath_wrapper(self, *args, **kwargs):
"""
Expand Down Expand Up @@ -175,6 +199,11 @@ def post_prepare_hook(self, *args, **kwargs):
if self.name in POST_PREPARE_HOOKS:
POST_PREPARE_HOOKS[self.name](self, *args, **kwargs)

# Always trigger this one, regardless of ec.name
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
if cpu_target == CPU_TARGET_ZEN4:
post_prepare_hook_ignore_zen4_gcccore1220_error(self, *args, **kwargs)


def parse_hook_casacore_disable_vectorize(ec, eprefix):
"""
Expand Down Expand Up @@ -353,6 +382,50 @@ def parse_hook_CP2K_remove_deps_for_aarch64(ec, *args, **kwargs):
raise EasyBuildError("CP2K-specific hook triggered for non-CP2K easyconfig?!")


def parse_hook_zen4_module_only(ec, eprefix):
"""
Use --force --module-only if building a foss-2022b-based EasyConfig for Zen4.
This toolchain will not be supported on Zen4, so we will generate a modulefile
and have it print an LmodError.
"""
if is_gcccore_1220_based(ec['name'], ec['version'], ec['toolchain']['name'], ec['toolchain']['version']):
casparvl marked this conversation as resolved.
Show resolved Hide resolved
env_varname=EESSI_IGNORE_ZEN4_GCC1220_ENVVAR
update_build_option('force', 'True')
update_build_option('module_only', 'True')
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
# TODO: create a docs page to which we can refer for more info here
# TODO: then update the link to the known issues page to the _specific_ issue
# Need to escape newline character so that the newline character actually ends up in the module file
# (otherwise, it splits the string, and a 2-line string ends up in the modulefile, resulting in syntax error)
errmsg = "EasyConfigs using toolchains based on GCCcore-12.2.0 are not supported for the Zen4 architecture.\\n"
errmsg += "See https://www.eessi.io/docs/known_issues/eessi-2023.06/"
casparvl marked this conversation as resolved.
Show resolved Hide resolved
ec['modluafooter'] = 'if (not os.getenv("%s")) then LmodError("%s") end' % (env_varname, errmsg)


def pre_fetch_hook(ec, *args, **kwargs):
"""Main parse hook: trigger custom functions based on software name."""

if ec.name in PRE_FETCH_HOOKS:
PRE_FETCH_HOOKS[ec.name](ec, *args, **kwargs)

# Always trigger this one, regardless of ec.name
cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR')
if cpu_target == CPU_TARGET_ZEN4:
pre_fetch_hook_ignore_zen4_gcccore1220_error(ec, *args, **kwargs)


# We do this as early as possible - and remove it all the way in the last step hook (post_testcases_hook)
casparvl marked this conversation as resolved.
Show resolved Hide resolved
def pre_prepare_hook_ignore_zen4_gcccore1220_error(self, *args, **kwargs):
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
"""Set environment variable to ignore the LmodError from parse_hook_zen4_module_only during build phase"""
if is_gcccore_1220_based(self.name, self.version, self.toolchain.name, self.toolchain.version):
os.environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR] = "1"


def post_prepare_hook_ignore_zen4_gcccore1220_error(self, *args, **kwargs):
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
ocaisa marked this conversation as resolved.
Show resolved Hide resolved
"""Unset environment variable to ignore the LmodError from parse_hook_zen4_module_only during build phase"""
if is_gcccore_1220_based(self.name, self.version, self.toolchain.name, self.toolchain.version):
del os.environ[EESSI_IGNORE_ZEN4_GCC1220_ENVVAR]


def pre_prepare_hook_highway_handle_test_compilation_issues(self, *args, **kwargs):
"""
Solve issues with compiling or running the tests on both
Expand Down
Loading