Configure nvhpc GCC from Spack variables (#29769)
Alter the `install_components/install` script to pass the `-gcc $SPACK_CC`, `-gpp $SPACK_CXX`, and `-g77 $SPACK_F77` flags to `makelocalrc`. This ensures that nvhpc is configured to use the spack gcc spec, rather than whatever gcc is found on the path. Co-authored-by: Mikael Simberg <simberg@cscs.ch> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
This commit is contained in:
parent
53eb044b28
commit
943d463a2d
@ -5,7 +5,6 @@
|
||||
#
|
||||
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
||||
from spack import *
|
||||
@ -123,22 +122,42 @@ class Nvhpc(Package):
|
||||
conflicts('%intel')
|
||||
conflicts('%xl')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# Enable the silent installation feature
|
||||
os.environ['NVHPC_SILENT'] = "true"
|
||||
os.environ['NVHPC_ACCEPT_EULA'] = "accept"
|
||||
os.environ['NVHPC_INSTALL_DIR'] = prefix
|
||||
def _version_prefix(self):
|
||||
return join_path(
|
||||
self.prefix, 'Linux_%s' % self.spec.target.family, self.version)
|
||||
|
||||
if spec.variants['install_type'].value == 'network':
|
||||
os.environ['NVHPC_INSTALL_TYPE'] = "network"
|
||||
os.environ['NVHPC_INSTALL_LOCAL_DIR'] = \
|
||||
"%s/%s/%s/share_objects" % \
|
||||
(prefix, 'Linux_%s' % spec.target.family, self.version)
|
||||
def setup_build_environment(self, env):
|
||||
env.set('NVHPC_SILENT', 'true')
|
||||
env.set('NVHPC_ACCEPT_EULA', 'accept')
|
||||
env.set('NVHPC_INSTALL_DIR', self.prefix)
|
||||
|
||||
if self.spec.variants['install_type'].value == 'network':
|
||||
local_dir = join_path(self._version_prefix(), 'share_objects')
|
||||
env.set('NVHPC_INSTALL_TYPE', 'network')
|
||||
env.set('NVHPC_INSTALL_LOCAL_DIR', local_dir)
|
||||
else:
|
||||
os.environ['NVHPC_INSTALL_TYPE'] = "single"
|
||||
env.set('NVHPC_INSTALL_TYPE', 'single')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
compilers_bin = join_path(self._version_prefix(), 'compilers', 'bin')
|
||||
install = Executable('./install')
|
||||
makelocalrc = Executable(join_path(compilers_bin, 'makelocalrc'))
|
||||
|
||||
makelocalrc_args = [
|
||||
'-gcc', self.compiler.cc,
|
||||
'-gpp', self.compiler.cxx,
|
||||
'-g77', self.compiler.f77,
|
||||
'-x', compilers_bin
|
||||
]
|
||||
if self.spec.variants['install_type'].value == 'network':
|
||||
local_dir = join_path(self._version_prefix(), 'share_objects')
|
||||
makelocalrc_args.extend(['-net', local_dir])
|
||||
|
||||
# Run install script
|
||||
os.system("./install")
|
||||
install()
|
||||
|
||||
# Update localrc to use Spack gcc
|
||||
makelocalrc(*makelocalrc_args)
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
prefix = Prefix(join_path(self.prefix,
|
||||
|
Loading…
Reference in New Issue
Block a user