Add NVHPC (nvc++) compiler support and CI build/test jobs

libeigen/eigen!2186

Closes #3032

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-23 18:51:15 -08:00
parent f3f2c676b5
commit 241af1c0ba
5 changed files with 43 additions and 6 deletions

View File

@@ -278,10 +278,10 @@
/// \internal EIGEN_COMP_GNUC_STRICT set to 1 if the compiler is really GCC and not a compatible compiler (e.g., ICC,
/// clang, mingw, etc.)
#if EIGEN_COMP_GNUC && \
!(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_CLANGICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || \
EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN || EIGEN_COMP_FCC || EIGEN_COMP_CLANGFCC || \
EIGEN_COMP_CPE || EIGEN_COMP_CLANGCPE || EIGEN_COMP_LCC)
#if EIGEN_COMP_GNUC && \
!(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_CLANGICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || \
EIGEN_COMP_NVHPC || EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN || EIGEN_COMP_FCC || \
EIGEN_COMP_CLANGFCC || EIGEN_COMP_CPE || EIGEN_COMP_CLANGCPE || EIGEN_COMP_LCC)
#define EIGEN_COMP_GNUC_STRICT 1
#else
#define EIGEN_COMP_GNUC_STRICT 0

View File

@@ -34,7 +34,9 @@
/* --- To print date and time of compilation of current source on stdout --- */
#if defined(__GNUC__)
#if defined(__NVCOMPILER)
#define COMPILER "nvc++";
#elif defined(__GNUC__)
#define COMPILER "g++";
#elif defined(__sun)
#define COMPILER "CC";

View File

@@ -140,6 +140,20 @@ build:linux:docs:
# -DEIGEN_TEST_CUSTOM_CXX_FLAGS=-fsanitize=memory
# -DEIGEN_TEST_CUSTOM_LINKER_FLAGS=-fsanitize=memory
######## NVHPC #################################################################
# NVHPC (nvc++) uses NVIDIA's HPC SDK container image with the compilers
# pre-installed. We override EIGEN_CI_INSTALL to avoid trying to apt-get
# install the compiler.
build:linux:x86-64:nvhpc-25.1:default:
extends: .build:linux:cross:x86-64
image: nvcr.io/nvidia/nvhpc:25.1-devel-cuda12.6-ubuntu22.04
variables:
EIGEN_CI_C_COMPILER: nvc
EIGEN_CI_CXX_COMPILER: nvc++
EIGEN_CI_INSTALL: ""
EIGEN_CI_CROSS_INSTALL: ""
######## CUDA ##################################################################
.build:linux:cuda:
@@ -312,3 +326,4 @@ build:linux:cross:x86-64:clang-12:default:smoketest:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
tags:
- saas-linux-medium-amd64

View File

@@ -220,6 +220,25 @@ test:linux:x86-64:clang-19:generic:avx512dq:unsupported:
variables:
EIGEN_CI_CTEST_LABEL: Unsupported
##### NVHPC ####################################################################
.test:linux:x86-64:nvhpc-25.1:default:
extends: .test:linux:x86-64
image: nvcr.io/nvidia/nvhpc:25.1-devel-cuda12.6-ubuntu22.04
needs: [ build:linux:x86-64:nvhpc-25.1:default ]
variables:
EIGEN_CI_INSTALL: ""
test:linux:x86-64:nvhpc-25.1:default:official:
extends: .test:linux:x86-64:nvhpc-25.1:default
variables:
EIGEN_CI_CTEST_LABEL: Official
test:linux:x86-64:nvhpc-25.1:default:unsupported:
extends: .test:linux:x86-64:nvhpc-25.1:default
variables:
EIGEN_CI_CTEST_LABEL: Unsupported
##### CUDA #####################################################################
.test:linux:cuda:
extends: .test:linux
@@ -420,3 +439,4 @@ test:linux:x86-64:clang-12:default:smoketest:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
tags:
- saas-linux-medium-amd64

View File

@@ -458,7 +458,7 @@ macro(ei_get_compilerver VAR)
endif()
if(MSVC)
set(${VAR} "${CMAKE_CXX_COMPILER_VERSION}")
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI")
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "NVHPC")
set(${VAR} "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
else()
# on all other system we rely on ${CMAKE_CXX_COMPILER}