Skip to content

[BUG] nvForest cannot be built with CUDA disabled when consumed via CPM #145

Description

@hcho3

Currently, when a downstream C++ application consumes nvForest via CPM, it cannot build nvForest in CPU-only mode.

Reproducer:

cmake_minimum_required(VERSION 4.3)

set(rapids-cmake-version 26.06)
file(DOWNLOAD
    https://raw.githubusercontent.com/rapidsai/rapids-cmake/refs/tags/v26.06.00/RAPIDS.cmake
    ${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)
include(rapids-cmake)
include(rapids-cpm)
include(rapids-export)
include(rapids-find)

project(nvforest-demo LANGUAGES CXX VERSION 0.0.1)

rapids_cpm_init()
rapids_cpm_find(nvforest 26.06.00
  GLOBAL_TARGETS      nvforest++
  BUILD_EXPORT_SET    rapids_triton-exports
  INSTALL_EXPORT_SET  rapids_triton-exports
    CPM_ARGS
        GIT_REPOSITORY https://github.com/rapidsai/nvforest.git
        GIT_TAG        v26.06.00
        SOURCE_SUBDIR  cpp
        GIT_SHALLOW    TRUE
        OPTIONS
          "BUILD_NVFOREST_TESTS OFF"
          "BUILD_SHARED_LIBS ON"
          "NVFOREST_ENABLE_GPU OFF"   # <<---- Note this line
          "NVFOREST_USE_TREELITE_STATIC ON"
          "USE_CCACHE ON"
)

add_executable(main main.cc)
target_link_libraries(main PRIVATE nvforest::nvforest++ treelite::treelite_static)

Output from CMake:

-- CPM: Adding package nvforest@26.06.00 (v26.06.00)
-- Project NVForest is building for CUDA architectures:
  75-real
  80-real
  86-real
  90a-real
  100f-real
  120a-real
  120
...

-- Configuring done (25.3s)
CMake Error in CMakeLists.txt:
  No known features for CUDA compiler

  ""

  version .
CMake Generate step failed.  Build files cannot be regenerated correctly.

It should be possible to build nvForest in the CPU-only mode when consuming it via CPM.

Context: I found this problem while working on triton-inference-server/fil_backend#453

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions