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

ensure localrc is created in the correct subdir for NVHPC v22.9+ #3240

Merged
merged 6 commits into from
Apr 3, 2024
Merged
Changes from 4 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
23 changes: 22 additions & 1 deletion easybuild/easyblocks/n/nvhpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import os
import fileinput
import re
import shutil
import stat
import sys
import tempfile
import platform

from easybuild.tools import LooseVersion
Expand Down Expand Up @@ -68,6 +70,14 @@
append LDLIBARGS=-L/usr/lib/x86_64-linux-gnu;
"""

# contents for minimal example compiled in sanity check, used to catch issue
# seen in: https://github.com/easybuilders/easybuild-easyblocks/pull/3240
NVHPC_MINIMAL_EXAMPLE = """
#include <ranges>

int main(){ return 0; }
"""


class EB_NVHPC(PackedBinary):
"""
Expand Down Expand Up @@ -165,7 +175,8 @@ def install_step(self):
sys.stdout.write(line)

if LooseVersion(self.version) >= LooseVersion('22.9'):
cmd = "%s -x %s" % (makelocalrc_filename, compilers_subdir)
bin_subdir = os.path.join(compilers_subdir, "bin")
cmd = "%s -x %s" % (makelocalrc_filename, bin_subdir)
else:
cmd = "%s -x %s -g77 /" % (makelocalrc_filename, compilers_subdir)
run_cmd(cmd, log_all=True, simple=True)
Expand Down Expand Up @@ -202,7 +213,17 @@ 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]

# 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)
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
Loading