Skip to content

Commit

Permalink
use dynamic treelite in conda builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Jan 13, 2025
1 parent 2ef32ea commit e35df32
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ci/build_wheel_cuml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ case "${RAPIDS_CUDA_VERSION}" in
;;
esac

export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/;-DUSE_CUVS_WHEEL=ON${EXTRA_CMAKE_ARGS};-DSINGLEGPU=OFF"
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DDISABLE_DEPRECATION_WARNINGS=ON;-DCPM_cumlprims_mg_SOURCE=${GITHUB_WORKSPACE}/cumlprims_mg/;-DUSE_CUVS_WHEEL=ON${EXTRA_CMAKE_ARGS};-DSINGLEGPU=OFF;-DUSE_LIBCUML_WHEEL=ON"
./ci/build_wheel.sh "${package_name}" "${package_dir}"

mkdir -p ${package_dir}/final_dist
Expand Down
29 changes: 22 additions & 7 deletions python/cuml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ project(
option(CUML_UNIVERSAL "Build all cuML Python components." ON)
option(SINGLEGPU "Disable all mnmg components and comms libraries" OFF)
option(USE_CUVS_WHEEL "Use the cuVS wheel" OFF)
option(USE_LIBCUML_WHEEL "Use libcuml wheel to provide some dependencies" OFF)

# todo: use CMAKE_MESSAGE_CONTEXT for prefix for logging.
# https://github.com/rapidsai/cuml/issues/4843
Expand Down Expand Up @@ -85,13 +86,14 @@ else()
include(rapids-export)
rapids_cpm_init()

# find CCCL, RMM, and RAFT before cuVS, to avoid
# --- CCCL, RAFT, RMM ---#
# find CCCL, RAFT, and RMM before cuVS, to avoid
# cuVS CMake defining conflicting versions of targets like 'nvidia::cutlaass'
include(${CUML_CPP_SRC}/cmake/thirdparty/get_cccl.cmake)
include(${CUML_CPP_SRC}/cmake/thirdparty/get_rmm.cmake)
include(${CUML_CPP_SRC}/cmake/thirdparty/get_raft.cmake)

# --- cuvs --- #
# --- cuVS --- #
# Once there are 'libcuvs' wheels, it should be possible to remove this CPM build of cuvs.
#
# * conda builds will find 'libcuvs' in the build environment
Expand All @@ -112,15 +114,28 @@ else()
# And because cuml Cython code needs to headers to satisfy calls like 'cdef extern from "treelite/c_api.h"'
#
# and it needs to come before find_package(cuml), because it's a PUBLIC
# dependency of cuml::cuml
set(CUML_PYTHON_TREELITE_TARGET treelite::treelite_static)
# TODO(jameslamb): is it safe for libcuml and cuml to both use their own static treelite?
set(CUML_USE_TREELITE_STATIC ON)
# dependency of cuml::cuml.
#
# TODO(jameslamb): clean up these comments

# wheel builds use a static treelite, because the 'libtreelite.so' in 'treelite' wheels
# isn't intended for dynamic linking by third-party projects (e.g. hides its symbols)
if(USE_LIBCUML_WHEEL)
# TODO(jameslamb): is it safe for libcuml++ libcuml wheels and Cython extensions in 'cuml' wheels
# to use separate static treelite?
set(CUML_PYTHON_TREELITE_TARGET treelite::treelite_static)
set(CUML_USE_TREELITE_STATIC ON)
else()
set(CUML_PYTHON_TREELITE_TARGET treelite::treelite)
set(CUML_USE_TREELITE_STATIC OFF)
endif()

set(CUML_EXCLUDE_TREELITE_FROM_ALL ON)

message(STATUS "--- [debug] finding treelite for cuML")
include(${CUML_CPP_SRC}/cmake/thirdparty/get_treelite.cmake)
message(STATUS "--- [debug] done finding treelite for cuML")

# --- libcuml --- #
message(STATUS "--- [debug] finding cuML")
find_package(cuml "${RAPIDS_VERSION}" REQUIRED)
message(STATUS "--- [debug] found cuML")
Expand Down

0 comments on commit e35df32

Please sign in to comment.