add Nvidia HPC SDK compilers

pull/7447/head
Michael Hirsch, Ph.D 5 years ago
parent c57616884f
commit f985bb7383
No known key found for this signature in database
GPG Key ID: 6D23CDADAB0294F9
  1. 6
      mesonbuild/compilers/__init__.py
  2. 9
      mesonbuild/compilers/c.py
  3. 17
      mesonbuild/compilers/cpp.py
  4. 17
      mesonbuild/compilers/fortran.py
  5. 27
      mesonbuild/environment.py
  6. 6
      mesonbuild/linkers.py

@ -85,6 +85,9 @@ __all__ = [
'ObjCPPCompiler',
'Open64FortranCompiler',
'PathScaleFortranCompiler',
'NvidiaHPC_CCompiler',
'NvidiaHPC_CPPCompiler',
'NvidiaHPC_FortranCompiler',
'PGICCompiler',
'PGICPPCompiler',
'PGIFortranCompiler',
@ -135,6 +138,7 @@ from .c import (
EmscriptenCCompiler,
IntelCCompiler,
IntelClCCompiler,
NvidiaHPC_CCompiler,
PGICCompiler,
CcrxCCompiler,
Xc16CCompiler,
@ -153,6 +157,7 @@ from .cpp import (
EmscriptenCPPCompiler,
IntelCPPCompiler,
IntelClCPPCompiler,
NvidiaHPC_CPPCompiler,
PGICPPCompiler,
CcrxCPPCompiler,
C2000CPPCompiler,
@ -177,6 +182,7 @@ from .fortran import (
NAGFortranCompiler,
Open64FortranCompiler,
PathScaleFortranCompiler,
NvidiaHPC_FortranCompiler,
PGIFortranCompiler,
SunFortranCompiler,
)

@ -255,6 +255,15 @@ class PGICCompiler(PGICompiler, CCompiler):
PGICompiler.__init__(self)
class NvidiaHPC_CCompiler(PGICompiler, CCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
CCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, **kwargs)
PGICompiler.__init__(self)
self.id = 'nvidia_hpc'
class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,

@ -156,7 +156,7 @@ class CPPCompiler(CLikeCompiler, Compiler):
class ClangCPPCompiler(ClangCompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
defines : T.Optional[T.List[str]] = None, **kwargs):
defines: T.Optional[T.List[str]] = None, **kwargs):
CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, **kwargs)
ClangCompiler.__init__(self, defines)
@ -240,8 +240,8 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
CPPCompiler.__init__(self, exelist=exelist, version=version,
for_machine=for_machine, is_cross=is_cross,
info=info, exe_wrapper=exe_wrapper, **kwargs)
for_machine=for_machine, is_cross=is_cross,
info=info, exe_wrapper=exe_wrapper, **kwargs)
ArmclangCompiler.__init__(self)
default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
self.warn_args = {'0': [],
@ -305,7 +305,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
'std': coredata.UserComboOption(
'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
'none',
),
'debugstl': coredata.UserBooleanOption(
@ -356,6 +356,15 @@ class PGICPPCompiler(PGICompiler, CPPCompiler):
PGICompiler.__init__(self)
class NvidiaHPC_CPPCompiler(PGICompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
PGICompiler.__init__(self)
self.id = 'nvidia_hpc'
class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,

@ -418,6 +418,23 @@ class PGIFortranCompiler(PGICompiler, FortranCompiler):
return ['-lpgf90rtl', '-lpgf90', '-lpgf90_rpm1', '-lpgf902',
'-lpgf90rtl', '-lpgftnrtl', '-lrt']
class NvidiaHPC_FortranCompiler(PGICompiler, FortranCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,
**kwargs):
FortranCompiler.__init__(self, exelist, version, for_machine,
is_cross, info, exe_wrapper, **kwargs)
PGICompiler.__init__(self)
self.id = 'nvidia_hpc'
default_warn_args = ['-Minform=inform']
self.warn_args = {'0': [],
'1': default_warn_args,
'2': default_warn_args,
'3': default_warn_args + ['-Mdclchk']}
class FlangFortranCompiler(ClangCompiler, FortranCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None,

@ -54,6 +54,8 @@ from .linkers import (
LLVMDynamicLinker,
MSVCDynamicLinker,
OptlinkDynamicLinker,
NvidiaHPC_DynamicLinker,
NvidiaHPC_StaticLinker,
PGIDynamicLinker,
PGIStaticLinker,
SolarisDynamicLinker,
@ -101,6 +103,9 @@ from .compilers import (
NAGFortranCompiler,
Open64FortranCompiler,
PathScaleFortranCompiler,
NvidiaHPC_CCompiler,
NvidiaHPC_CPPCompiler,
NvidiaHPC_FortranCompiler,
PGICCompiler,
PGICPPCompiler,
PGIFortranCompiler,
@ -622,11 +627,11 @@ class Environment:
self.default_objc = []
self.default_objcpp = []
else:
self.default_c = ['cc', 'gcc', 'clang', 'pgcc', 'icc']
self.default_cpp = ['c++', 'g++', 'clang++', 'pgc++', 'icpc']
self.default_c = ['cc', 'gcc', 'clang', 'nvc', 'pgcc', 'icc']
self.default_cpp = ['c++', 'g++', 'clang++', 'nvc++', 'pgc++', 'icpc']
self.default_objc = ['cc', 'gcc', 'clang']
self.default_objcpp = ['c++', 'g++', 'clang++']
self.default_fortran = ['gfortran', 'flang', 'pgfortran', 'ifort', 'g95']
self.default_fortran = ['gfortran', 'flang', 'nvfortran', 'pgfortran', 'ifort', 'g95']
self.default_cs = ['mcs', 'csc']
self.default_d = ['ldc2', 'ldc', 'gdc', 'dmd']
self.default_java = ['javac']
@ -1148,6 +1153,13 @@ class Environment:
return cls(
ccache + compiler, version, for_machine, is_cross,
info, exe_wrap, linker=linker)
if 'NVIDIA Compilers and Tools' in out:
cls = NvidiaHPC_CCompiler if lang == 'c' else NvidiaHPC_CPPCompiler
self.coredata.add_lang_args(cls.language, cls, for_machine, self)
linker = NvidiaHPC_DynamicLinker(compiler, for_machine, cls.LINKER_PREFIX, [], version=version)
return cls(
ccache + compiler, version, for_machine, is_cross,
info, exe_wrap, linker=linker)
if '(ICC)' in out:
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
l = self._guess_nix_linker(compiler, cls, for_machine)
@ -1319,6 +1331,15 @@ class Environment:
compiler, version, for_machine, is_cross, info, exe_wrap,
full_version=full_version, linker=linker)
if 'NVIDIA Compilers and Tools' in out:
cls = NvidiaHPC_FortranCompiler
self.coredata.add_lang_args(cls.language, cls, for_machine, self)
linker = PGIDynamicLinker(compiler, for_machine,
cls.LINKER_PREFIX, [], version=version)
return cls(
compiler, version, for_machine, is_cross, info, exe_wrap,
full_version=full_version, linker=linker)
if 'flang' in out or 'clang' in out:
linker = self._guess_nix_linker(
compiler, FlangFortranCompiler, for_machine)

@ -715,7 +715,7 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam
"""Representation of GNU ld.bfd and ld.gold."""
def get_accepts_rsp(self) -> bool:
return True;
return True
class GnuGoldDynamicLinker(GnuDynamicLinker):
@ -961,6 +961,8 @@ class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
return (['-R' + os.path.join(build_dir, p) for p in rpath_paths], set())
return ([], set())
NvidiaHPC_DynamicLinker = PGIDynamicLinker
class PGIStaticLinker(StaticLinker):
def __init__(self, exelist: T.List[str]):
@ -974,6 +976,8 @@ class PGIStaticLinker(StaticLinker):
def get_output_args(self, target: str) -> T.List[str]:
return [target]
NvidiaHPC_StaticLinker = PGIStaticLinker
class VisualStudioLikeLinkerMixin:

Loading…
Cancel
Save