NVHPC: Add support for NVIDIA HPC SDK compilers based on PGI

Identify the compilers as `NVHPC` to distinguish it from the older PGI
compilers from which they evolved, and from other `NVIDIA` compilers.

Fixes: #20887
This commit is contained in:
Tin Huynh
2020-08-25 19:54:13 -07:00
committed by Brad King
parent 9b96fbc358
commit 83ea49818f
13 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
nvhpc-compiler
--------------
* The NVIDIA HPC SDK compilers are now supported with compiler id ``NVHPC``.

View File

@@ -26,6 +26,7 @@ include:
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
MSVC = Microsoft Visual Studio (microsoft.com)
NVHPC = NVIDIA HPC SDK Compiler (nvidia.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
OpenWatcom = Open Watcom (openwatcom.org)
PGI = The Portland Group (pgroup.com)

View File

@@ -61,6 +61,7 @@ function(compiler_id_detection outvar lang)
XLClang
XL
VisualAge
NVHPC
PGI
Cray
TI

View File

@@ -82,6 +82,23 @@
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
# endif
#elif defined(__NVCOMPILER) || defined(__NVCOMPILER_LLVM__)
PRINT *, 'INFO:compiler[NVHPC]'
# if defined(__NVCOMPILER_MAJOR__)
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
# else
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# endif
# if defined(__NVCOMPILER_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
# else
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# endif
# if defined(__NVCOMPILER_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
# elif defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(__PGI)
PRINT *, 'INFO:compiler[PGI]'
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)

View File

@@ -0,0 +1,3 @@
include(Compiler/PGI-C)
include(Compiler/NVHPC)
__compiler_nvhpc(C)

View File

@@ -0,0 +1,3 @@
include(Compiler/PGI-CXX)
include(Compiler/NVHPC)
__compiler_nvhpc(CXX)

View File

@@ -0,0 +1,9 @@
set(_compiler_id_pp_test "defined(__NVCOMPILER)")
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__NVCOMPILER_MAJOR__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__NVCOMPILER_MINOR__)
# if defined(__NVCOMPILER_PATCHLEVEL__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__NVCOMPILER_PATCHLEVEL__)
# endif")

View File

@@ -0,0 +1,3 @@
include(Compiler/PGI-Fortran)
include(Compiler/NVHPC)
__compiler_nvhpc(Fortran)

View File

@@ -0,0 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_NVHPC)
return()
endif()
set(__COMPILER_NVHPC 1)
include(Compiler/PGI)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
endmacro()

View File

@@ -0,0 +1,2 @@
include(Platform/Linux-NVHPC)
__linux_compiler_nvhpc(C)

View File

@@ -0,0 +1,2 @@
include(Platform/Linux-NVHPC)
__linux_compiler_nvhpc(CXX)

View File

@@ -0,0 +1,2 @@
include(Platform/Linux-NVHPC)
__linux_compiler_nvhpc(Fortran)

View File

@@ -0,0 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__LINUX_COMPILER_NVIDIA)
return()
endif()
set(__LINUX_COMPILER_NVIDIA 1)
include(Platform/Linux-PGI)
macro(__linux_compiler_nvhpc lang)
__linux_compiler_pgi(${lang})
endmacro()