Skip to content

CMake - Wrong identification of NVHPC #5498

@antoine-morvan

Description

@antoine-morvan

Hello,

I was playing with NVHPC (again), building OpenBLAS with CMake build system.

I spotted some issues in the file cmake/cc.cmake : several conditions are checking the compiler ID against "NVC", such as:

if (${CMAKE_C_COMPILER_ID} STREQUAL "NVC" AND NOT NO_SVE)

Whereas a simple debug shows that the name is "NVHPC":

# top of cc.cmake
message (FATAL_ERROR "C Compiler : ${CMAKE_C_COMPILER_ID}")

outputs:

CMake Error at cmake/cc.cmake:7 (message):
  C Compiler : NVHPC

This reproduces with CMake 3.26.5 and 4.1.2, was valid with OpenBLAS 0.3.30 as well as latest commit on develop, and detects NVHPC 25.7 and 25.9 as "NVHPC" (did not try with older versions of NVHPC).

In practice, this makes the compiler ID test fail, then go to the else branch over there :

OpenBLAS/cmake/cc.cmake

Lines 232 to 233 in 4ac29b9

else ()
if (${GCC_VERSION} VERSION_GREATER 13.0 OR ${GCC_VERSION} VERSION_EQUAL 13.0)

And with GCC_VERSION undefined/empty, the version comparison fails:

-- Running getarch
-- GETARCH results:
CORE=NEOVERSEV2
LIBCORE=neoversev2
NUM_CORES=288
MAKEFLAGS += -j 288

-- Compiling a 64-bit binary.
CMake Error at cmake/cc.cmake:233 (if):
  if given arguments:

    "VERSION_GREATER" "13.0" "OR" "VERSION_EQUAL" "13.0"

  Unknown arguments specified
Call Stack (most recent call first):
  cmake/system.cmake:400 (include)
  CMakeLists.txt:125 (include)


-- Configuring incomplete, errors occurred!

Edit: note that this last failure does not occur with OpenBLAS 0.3.30 when targetting Neoverse V2 : the following condition was not there in cc.cmake:

if (${CORE} STREQUAL NEOVERSEV2)

Best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions