Merge pull request #7447 from scivision/nvc

Add support for NVidia HPC SDK compilers
pull/7634/head
Jussi Pakkanen 4 years ago committed by GitHub
commit c42298e146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      docs/markdown/Reference-tables.md
  2. 3
      docs/markdown/snippets/add_nvidia_hpc_sdk_compilers.md
  3. 6
      mesonbuild/compilers/__init__.py
  4. 9
      mesonbuild/compilers/c.py
  5. 17
      mesonbuild/compilers/cpp.py
  6. 17
      mesonbuild/compilers/fortran.py
  7. 27
      mesonbuild/environment.py
  8. 6
      mesonbuild/linkers.py

@ -25,6 +25,7 @@ These are return values of the `get_id` (Compiler family) and
| mono | Xamarin C# compiler | |
| msvc | Microsoft Visual Studio | msvc |
| nagfor | The NAG Fortran compiler | |
| nvidia_hpc| NVidia HPC SDK compilers | |
| open64 | The Open64 Fortran Compiler | |
| pathscale | The Pathscale Fortran compiler | |
| pgi | Portland PGI C/C++/Fortran compilers | |

@ -0,0 +1,3 @@
## Added NVidia HPC SDK compilers
Added support for `nvidia_hpc` NVidia HPC SDK compilers, which are currently in public beta testing.

@ -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,

@ -58,6 +58,8 @@ from .linkers import (
QualcommLLVMDynamicLinker,
MSVCDynamicLinker,
OptlinkDynamicLinker,
NvidiaHPC_DynamicLinker,
NvidiaHPC_StaticLinker,
PGIDynamicLinker,
PGIStaticLinker,
SolarisDynamicLinker,
@ -105,6 +107,9 @@ from .compilers import (
NAGFortranCompiler,
Open64FortranCompiler,
PathScaleFortranCompiler,
NvidiaHPC_CCompiler,
NvidiaHPC_CPPCompiler,
NvidiaHPC_FortranCompiler,
PGICCompiler,
PGICPPCompiler,
PGIFortranCompiler,
@ -768,11 +773,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']
@ -1303,6 +1308,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)
@ -1474,6 +1486,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)

@ -712,7 +712,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):
@ -964,6 +964,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]):
@ -977,6 +979,8 @@ class PGIStaticLinker(StaticLinker):
def get_output_args(self, target: str) -> T.List[str]:
return [target]
NvidiaHPC_StaticLinker = PGIStaticLinker
class VisualStudioLikeLinkerMixin:

Loading…
Cancel
Save