Skip to content

{2023.06}[NVHPC/25.1-CUDA-12.6] add hook for nvhpc #1043

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

Closed
Changes from 2 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
20 changes: 20 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,25 @@ def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs):
else:
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")

def pre_configure_hook_nvhpc_x86_64(self, *args, **kwargs):
"""
pre-configure hook for nvhpc
- search and replace operations in the ec dict
"""
if self.name == "NVHPC":
Copy link
Member

@ocaisa ocaisa Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for now, but there is quite a bit of discussion currently about changing the naming in the EasyBuild context. We are currently naming the compilers only NVHPC but we should perhaps be defining a toolchain hierarchy for NVHPC since they also contain MPI and some math libraries. This may lead to the compilers being called something like nvidia_compilers or NVHPC becoming a fatter toolchain.

Copy link
Member

@ocaisa ocaisa Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're also going to need some versioning clauses here for things you have actually tested.

This is definitely a corner case at present as EESSI itself will not ship his toolchain (currently), and I wonder if we should not allow an environment variable to force the use of the hook, something like

Suggested change
if self.name == "NVHPC":
if self.name == "NVHPC":
force_nvhpc_hook = 'EESSI_FORCE_NVHPC_HOOK'
if self.version in [...] or os.getenv(force_nvhpc_hook, False):
...
else:
print_msg(f"Not using existing hook for {self.name}/{self.version}, if you wish to force this please set the envvar {force_nvhpc_hook}")

eprefix = get_eessi_envvar("EPREFIX")
new_opts = f'''installdir=%(installdir)s/Linux_x86_64/%(version)s
EPREFIX={eprefix}
sed -i "s@\(set LDSO=.*\);@\\1 --sysroot=$EPREFIX;@" $installdir/compilers/bin/localrc
echo "set DEFLIBDIR=$EPREFIX/usr/lib64;" >> $installdir/compilers/bin/localrc
echo "set DEFSTDOBJDIR=$EPREFIX/usr/lib64;" >> $installdir/compilers/bin/localrc'''
Copy link
Member

@ocaisa ocaisa Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this a bit more, the logic here could be added directly to the relevant section of the NVHPC easyblock (and used conditionally based on whether the EB build option --sysroot is set).

Copy link
Member

@ocaisa ocaisa Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old_opts = self.cfg['postinstallcmds']
self.cfg.update('postinstallcmds', new_opts)
print_msg("Updated postinstall cmds from %s to %s", old_opts, new_opts)
else:
raise EasyBuildError("NVHPC-specific hook triggered for non-NVHPC easyconfig?!")



def pre_test_hook(self, *args, **kwargs):
"""Main pre-test hook: trigger custom functions based on software name."""
Expand Down Expand Up @@ -1218,6 +1237,7 @@ def post_module_hook(self, *args, **kwargs):
'GROMACS': pre_configure_hook_gromacs,
'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic,
'MetaBAT': pre_configure_hook_metabat_filtered_zlib_dep,
'NVHPC': pre_configure_hook_nvhpc_x86_64,
'OpenBLAS': pre_configure_hook_openblas_optarch_generic,
'WRF': pre_configure_hook_wrf_aarch64,
'LAMMPS': pre_configure_hook_LAMMPS_zen4,
Expand Down