Skip to content

cc.cmake assumes GCC_VERSION, causing build failure with NVHPC #5764

@antoine-morvan

Description

@antoine-morvan

Hello,

I am trying to build OpenBLAS with NVHPC on anIntel Sapphire Rapids system, and I am running into issues in cc.cmake.

With this setup, the following section is triggered:

OpenBLAS/cmake/cc.cmake

Lines 188 to 198 in 02dc625

if (${CORE} STREQUAL SAPPHIRERAPIDS)
if (NOT DYNAMIC_ARCH)
if (NOT NO_AVX512)
if (${GCC_VERSION} VERSION_GREATER 11.0 OR ${GCC_VERSION} VERSION_EQUAL 11.0)
set (CCOMMON_OPT "${CCOMMON_OPT} -march=sapphirerapids")
else ()
set (CCOMMON_OPT "${CCOMMON_OPT} -march=skylake-avx512")
endif()
endif ()
endif ()
endif ()

However, when building with NVHPC, $GCC_VERSION is not defined. As a result CMake fails with an error like this :

CMake Error at cmake/cc.cmake:191 (if):
  if given arguments:

    "VERSION_GREATER" "11.0" "OR" "VERSION_EQUAL" "11.0"

  Unknown arguments specified

It seems that this condition assumes a GNU compiler, and should probably only be evaluated when that is the case.

I believe similar issues may occur for other microarchitectures, such as:

Whike looking further into the file, I also noticed that $GCC_VERSION is set even when the compiler is Intel LLVM :

set(GCC_VERSION 100)

This might contribute to inconsistent behavior accross compiler, and most likely implies missuse of this variable (testing against this value) somewhere else in the CMake files.

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