Skip to content

Commit

Permalink
Merge pull request #3 from boegel/20240301121404_new_pr_nvhpc
Browse files Browse the repository at this point in the history
run minimal NVHPC compilation command via custom_commands passed to sanity_check_step
  • Loading branch information
jfgrimm authored Mar 1, 2024
2 parents 1f3c98b + dbc1c84 commit a6b882b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions easybuild/easyblocks/n/nvhpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,18 @@ def sanity_check_step(self):
'dirs': [os.path.join(prefix, 'compilers', 'bin'), os.path.join(prefix, 'compilers', 'lib'),
os.path.join(prefix, 'compilers', 'include'), os.path.join(prefix, 'compilers', 'man')]
}

custom_commands = ["%s -v" % compiler for compiler in compiler_names]
super(EB_NVHPC, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)

# compile minimal example using -std=c++20 to catch issue where it picks up the wrong GCC
# (as long as system gcc is < 9.0)
# see: https://github.com/easybuilders/easybuild-easyblocks/pull/3240
tmpdir = tempfile.mkdtemp()
write_file(os.path.join(tmpdir, 'minimal.cpp'), NVHPC_MINIMAL_EXAMPLE)
os.chdir(tmpdir)
cmd = "nvc++ -std=c++20 minimal.cpp -o minimal"
run_cmd(cmd, log_all=True, simple=True)
try:
shutil.rmtree(tmpdir)
except OSError as err:
raise EasyBuildError("Failed to remove temporary sanity check directory %s: %s", tmpdir, err)
minimal_compiler_cmd = "cd %s && nvc++ -std=c++20 minimal.cpp -o minimal" % tmpdir
custom_commands.append(minimal_compiler_cmd)

super(EB_NVHPC, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)

def _nvhpc_extended_components(self, dirs, basepath, env_vars_dirs):
"""
Expand Down

0 comments on commit a6b882b

Please sign in to comment.