Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] libcudf fails to configure with unpinned dependencies #16384

Closed
jlowe opened this issue Jul 24, 2024 · 2 comments
Closed

[BUG] libcudf fails to configure with unpinned dependencies #16384

jlowe opened this issue Jul 24, 2024 · 2 comments
Labels
bug Something isn't working CMake CMake build issue Spark Functionality that helps Spark RAPIDS

Comments

@jlowe
Copy link
Member

jlowe commented Jul 24, 2024

Describe the bug
After #16360 a cmake configure of libcudf with unpinned dependencies fails with the error:

-- CPM: Using local package [email protected]
CMake Error at build/_deps/rapids-cmake-src/rapids-cmake/cpm/detail/pinning_write_file.cmake:278 (string):
  string sub-command JSON failed parsing json string: * Line 145, Column 4

    Missing ',' or '}' in object declaration

  .
Call Stack (most recent call first):
  build/_deps/rapids-cmake-src/rapids-cmake/cpm/detail/pinning_root_dir_hook.cmake:29 (rapids_cpm_pinning_write_file)
  build/_deps/rapids-cmake-src/rapids-cmake/cpm/generate_pinned_versions.cmake:102 (include)
  CMakeLists.txt:DEFERRED


-- Configuring incomplete, errors occurred!

Steps/Code to reproduce bug

$ pwd
/home/jlowe/src/spark-rapids-jni/thirdparty/cudf/cpp/build

$ cat setup.cmake
string(TOLOWER "${CUDF_DEPENDENCY_PIN_MODE}" CUDF_DEPENDENCY_PIN_MODE)
if(NOT (CUDF_DEPENDENCY_PIN_MODE STREQUAL pinned OR
        CUDF_DEPENDENCY_PIN_MODE STREQUAL latest))
  message(FATAL_ERROR "The CUDF_DEPENDENCY_PIN_MODE variable must be set to either `pinned` or `latest`.")
 endif()

function(set_rapids_cmake_pin_sha1)
  set(rapids-cmake-sha "${rapids-cmake-sha}" PARENT_SCOPE)

  message(STATUS "Pinning rapids-cmake SHA1 to ${rapids-cmake-sha}")
endfunction()

# We need to set the rapids-cmake SHA1 before any CMake code in libcudf is executed when
# we are in pin mode. Otherwise we will use the latest rapids-cmake version since that
# is what cudf does via `fetch_rapids.cmake`
if(CUDF_DEPENDENCY_PIN_MODE STREQUAL pinned)
  # Extract the rapids sha1 from the file
  file(READ "${CMAKE_CURRENT_LIST_DIR}/rapids-cmake.sha" rapids-cmake-sha)
  string(STRIP rapids-cmake-sha "${rapids-cmake-sha}")
  string(REPLACE "\n" "" rapids-cmake-sha "${rapids-cmake-sha}")
  set(rapids-cmake-sha "${rapids-cmake-sha}" CACHE STRING "rapids-cmake sha to use" FORCE)
  message(STATUS "Pinning rapids-cmake SHA1 [${rapids-cmake-sha}]")
else()
  set(rapids-cmake-fetch-via-git "ON" CACHE STRING "Make sure rapids-cmake is cloned so we can get SHA value" FORCE)
endif()

# We need to use a project() call hook, since rapids-cmake cpm_init()
# can't be called from a `-C` CMake file
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/add_dependency_pins.cmake" CACHE FILEPATH "" )

$ cat add_dependency_pins.cmake
if(NOT DEFINED rapids-cmake-dir)
  include(../cudf/rapids_config.cmake)
endif()

include(rapids-cpm)
rapids_cpm_init()

function(add_override_if_requested)
  if(CUDF_DEPENDENCY_PIN_MODE STREQUAL pinned)
    include(${rapids-cmake-dir}/cpm/package_override.cmake)
    rapids_cpm_package_override(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/versions.json)

    message(STATUS "Pinning CUDF dependencies to values found in ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/versions.json")
  else()
    include(${rapids-cmake-dir}/cpm/generate_pinned_versions.cmake)
    rapids_cpm_generate_pinned_versions(OUTPUT ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/versions.json)

    message(STATUS "Building with latest CUDF dependencies (saving pinned versions to ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/versions.json)")
  endif()
endfunction()
add_override_if_requested()

$ cmake -DCMAKE_CUDA_ARCHITECTURES=89-real -DCUDF_DEPENDENCY_PIN_MODE=latest -DCUDF_ENABLE_ARROW_S3=OFF -C=setup.cmake ..

Expected behavior
libcudf should configure successfully as it did before #16360

@jlowe jlowe added bug Something isn't working CMake CMake build issue Spark Functionality that helps Spark RAPIDS labels Jul 24, 2024
@jlowe
Copy link
Member Author

jlowe commented Jul 24, 2024

Should be fixed by rapidsai/rapids-cmake#655

@ttnghia
Copy link
Contributor

ttnghia commented Jul 25, 2024

Close as it is fixed.

@ttnghia ttnghia closed this as completed Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CMake CMake build issue Spark Functionality that helps Spark RAPIDS
Projects
None yet
Development

No branches or pull requests

2 participants