mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
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:
4
Help/release/dev/nvhpc-compiler.rst
Normal file
4
Help/release/dev/nvhpc-compiler.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
nvhpc-compiler
|
||||
--------------
|
||||
|
||||
* The NVIDIA HPC SDK compilers are now supported with compiler id ``NVHPC``.
|
||||
@@ -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)
|
||||
|
||||
@@ -61,6 +61,7 @@ function(compiler_id_detection outvar lang)
|
||||
XLClang
|
||||
XL
|
||||
VisualAge
|
||||
NVHPC
|
||||
PGI
|
||||
Cray
|
||||
TI
|
||||
|
||||
@@ -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__)
|
||||
|
||||
3
Modules/Compiler/NVHPC-C.cmake
Normal file
3
Modules/Compiler/NVHPC-C.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(Compiler/PGI-C)
|
||||
include(Compiler/NVHPC)
|
||||
__compiler_nvhpc(C)
|
||||
3
Modules/Compiler/NVHPC-CXX.cmake
Normal file
3
Modules/Compiler/NVHPC-CXX.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(Compiler/PGI-CXX)
|
||||
include(Compiler/NVHPC)
|
||||
__compiler_nvhpc(CXX)
|
||||
9
Modules/Compiler/NVHPC-DetermineCompiler.cmake
Normal file
9
Modules/Compiler/NVHPC-DetermineCompiler.cmake
Normal 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")
|
||||
3
Modules/Compiler/NVHPC-Fortran.cmake
Normal file
3
Modules/Compiler/NVHPC-Fortran.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
include(Compiler/PGI-Fortran)
|
||||
include(Compiler/NVHPC)
|
||||
__compiler_nvhpc(Fortran)
|
||||
15
Modules/Compiler/NVHPC.cmake
Normal file
15
Modules/Compiler/NVHPC.cmake
Normal 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()
|
||||
2
Modules/Platform/Linux-NVHPC-C.cmake
Normal file
2
Modules/Platform/Linux-NVHPC-C.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/Linux-NVHPC)
|
||||
__linux_compiler_nvhpc(C)
|
||||
2
Modules/Platform/Linux-NVHPC-CXX.cmake
Normal file
2
Modules/Platform/Linux-NVHPC-CXX.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/Linux-NVHPC)
|
||||
__linux_compiler_nvhpc(CXX)
|
||||
2
Modules/Platform/Linux-NVHPC-Fortran.cmake
Normal file
2
Modules/Platform/Linux-NVHPC-Fortran.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(Platform/Linux-NVHPC)
|
||||
__linux_compiler_nvhpc(Fortran)
|
||||
15
Modules/Platform/Linux-NVHPC.cmake
Normal file
15
Modules/Platform/Linux-NVHPC.cmake
Normal 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()
|
||||
Reference in New Issue
Block a user