Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd "$(dirname $0)"; pwd)

VALIDTARGETS="clean libcuml cuml cuml-cpu cpp-mgtests prims bench prims-bench cppdocs pydocs"
VALIDTARGETS="clean libcuml cuml cpp-mgtests prims bench prims-bench cppdocs pydocs"
VALIDFLAGS="-v -g -n --allgpuarch --singlegpu --nolibcumltest --nvtx --show_depr_warn --codecov --ccache --configure-only -h --help "
VALIDARGS="${VALIDTARGETS} ${VALIDFLAGS}"
HELP="$0 [<target> ...] [<flag> ...]
Expand All @@ -27,7 +27,6 @@ HELP="$0 [<target> ...] [<flag> ...]
libcuml - build the cuml C++ code only. Also builds the C-wrapper library
around the C++ code.
cuml - build the cuml Python package
cuml-cpu - build the cuml CPU Python package
cpp-mgtests - build libcuml mnmg tests. Builds MPI communicator, adding MPI as dependency.
prims - build the ml-prims tests
bench - build the libcuml C++ benchmark
Expand Down Expand Up @@ -306,8 +305,3 @@ if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs
make html
fi
fi

if hasArg cuml-cpu; then
SKBUILD_CMAKE_ARGS="-DCUML_CPU=ON;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE" \
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true ${REPODIR}/python/cuml
fi
105 changes: 32 additions & 73 deletions python/cuml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ cmake_minimum_required(VERSION 3.30.4 FATAL_ERROR)

include(../../cmake/rapids_config.cmake)

option(CUML_CPU "Build only cuML CPU Python components." OFF)
set(language_list "CXX")

if(NOT CUML_CPU)
# We always need CUDA for cuML GPU because the raft dependency brings in a
# header-only cuco dependency that enables CUDA unconditionally.
include(rapids-cuda)
rapids_cuda_init_architectures(cuml-python)
list(APPEND language_list "CUDA")
endif()
# We always need CUDA for cuML GPU because the raft dependency brings in a
# header-only cuco dependency that enables CUDA unconditionally.
Comment thread
jcrist marked this conversation as resolved.
Outdated
include(rapids-cuda)
rapids_cuda_init_architectures(cuml-python)
list(APPEND language_list "CUDA")

project(
cuml-python
Expand All @@ -41,7 +38,6 @@ 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
message(VERBOSE "CUML_PY: Build only cuML CPU Python components.: ${CUML_CPU}")
message(VERBOSE "CUML_PY: Disabling all mnmg components and comms libraries: ${SINGLEGPU}")

set(CUML_ALGORITHMS "ALL" CACHE STRING "Choose which algorithms are built cuML. Can specify individual algorithms or groups in a semicolon-separated list.")
Expand All @@ -52,70 +48,39 @@ set(CUML_CPP_SRC "../../cpp")
################################################################################
# - Process User Options ------------------------------------------------------

if(CUML_CPU)
set(CUML_UNIVERSAL OFF)
set(SINGLEGPU ON)

# only a subset of algorithms are supported in CPU-only cuML
set(CUML_ALGORITHMS "linearregression")
list(APPEND CUML_ALGORITHMS "pca")
list(APPEND CUML_ALGORITHMS "tsvd")
list(APPEND CUML_ALGORITHMS "elasticnet")
list(APPEND CUML_ALGORITHMS "logisticregression")
list(APPEND CUML_ALGORITHMS "ridge")
list(APPEND CUML_ALGORITHMS "lasso")
list(APPEND CUML_ALGORITHMS "umap")
list(APPEND CUML_ALGORITHMS "knn")
list(APPEND CUML_ALGORITHMS "hdbscan")
list(APPEND CUML_ALGORITHMS "dbscan")
list(APPEND CUML_ALGORITHMS "kmeans")

# this won't be needed when we add CPU libcuml++ (FIL)
set(cuml_sg_libraries "")

list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=0")

# cuml-cpu does not need libcuml++.so
else()

include(rapids-cpm)
include(rapids-export)
rapids_cpm_init()

# --- treelite --- #
# Need to call get_treelite explicitly because we need the correct
# ${TREELITE_LIBS} definition for RF.
#
# And because cuml Cython code needs the headers to satisfy calls like
# 'cdef extern from "treelite/c_api.h"'

# 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)
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()
include(rapids-cpm)
include(rapids-export)
rapids_cpm_init()

set(CUML_EXCLUDE_TREELITE_FROM_ALL ON)
# --- treelite --- #
# Need to call get_treelite explicitly because we need the correct
# ${TREELITE_LIBS} definition for RF.
#
# And because cuml Cython code needs the headers to satisfy calls like
# 'cdef extern from "treelite/c_api.h"'

# 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)
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()

include(${CUML_CPP_SRC}/cmake/thirdparty/get_treelite.cmake)
set(CUML_EXCLUDE_TREELITE_FROM_ALL ON)

# --- libcuml --- #
find_package(cuml "${RAPIDS_VERSION}" REQUIRED)
include(${CUML_CPP_SRC}/cmake/thirdparty/get_treelite.cmake)

set(cuml_sg_libraries cuml::${CUML_CPP_TARGET})
set(cuml_mg_libraries cuml::${CUML_CPP_TARGET})
# --- libcuml --- #
find_package(cuml "${RAPIDS_VERSION}" REQUIRED)

if(NOT SINGLEGPU)
list(APPEND cuml_mg_libraries cumlprims_mg::cumlprims_mg)
endif()
set(cuml_sg_libraries cuml::${CUML_CPP_TARGET})
set(cuml_mg_libraries cuml::${CUML_CPP_TARGET})

list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=1")
if(NOT SINGLEGPU)
list(APPEND cuml_mg_libraries cumlprims_mg::cumlprims_mg)
endif()

################################################################################
Expand All @@ -124,12 +89,6 @@ endif()
include("${CUML_CPP_SRC}/cmake/modules/ConfigureAlgorithms.cmake")
include(cmake/ConfigureCythonAlgorithms.cmake)

if(CUML_CPU)
# libcuml requires metrics built if HDSCAN is built, which is not the case
# for cuml-cpu
unset(metrics_algo)
endif()

message(VERBOSE "CUML_PY: Building cuML with algorithms: '${CUML_ALGORITHMS}'.")

include(rapids-cython-core)
Expand Down
Loading
Loading