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

Enable cuml-cpu nightly #5585

Merged
merged 27 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
14ff3e2
FEA apply necessary changes to enable nightly builds
dantegd Sep 19, 2023
4fa5681
FIX multiple small fixes
dantegd Sep 19, 2023
2840e1c
FIX few more fixes
dantegd Sep 19, 2023
62b2a8f
FIX forgot NN in initial set
dantegd Sep 19, 2023
56728d5
FIX multuple style fixes
dantegd Sep 21, 2023
8a4406f
FIX more style fixes
dantegd Sep 21, 2023
fa5077a
FIX import fixes
dantegd Sep 22, 2023
fe92560
FIX import in tsvd
dantegd Sep 22, 2023
b2c42f6
FIX missing parameter from bad merge
dantegd Sep 22, 2023
1da95ca
FIX typo
dantegd Sep 22, 2023
d575a2d
FIX lr cimports and missing device changes
dantegd Sep 25, 2023
4007663
FIX cython extension
dantegd Sep 25, 2023
cdff65f
FIX copyright
dantegd Sep 25, 2023
ed3eb98
FIX Multiple minor fixes
dantegd Sep 26, 2023
2acd3f9
Merge branch 'branch-23.10' into fea-enable-cumlcpu-nightly
dantegd Sep 26, 2023
b766c97
FIX forgot to commit internal changes
dantegd Sep 26, 2023
4990d8a
FIX copyright
dantegd Sep 26, 2023
4a7fe11
FIX cython lint style fixes
dantegd Sep 26, 2023
b2efeba
FIX cython fix from merge conflict
dantegd Sep 26, 2023
32ff897
FIX wrong cmake conditional by accident
dantegd Sep 26, 2023
62baaf4
FIX Cmake verbosity
dantegd Sep 26, 2023
8aebe03
FIX typo in targets was causing conda build error
dantegd Sep 26, 2023
3e814a1
FIX missing log regression mg from merge conflict
dantegd Sep 27, 2023
3f645a6
FIX typo
dantegd Sep 27, 2023
db61f17
Remove accidentally commited local changes
dantegd Sep 27, 2023
1272ab4
FIX actual typo fix
dantegd Sep 27, 2023
97b6044
FIX temprary skip
dantegd Sep 27, 2023
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
9 changes: 8 additions & 1 deletion 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 cpp-mgtests prims bench prims-bench cppdocs pydocs"
VALIDTARGETS="clean libcuml cuml cuml-cpu 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,6 +27,7 @@ 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 @@ -294,3 +295,9 @@ if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs
make html
fi
fi

if hasArg cuml-cpu; then
SKBUILD_CONFIGURE_OPTIONS="-DCUML_CPU=ON -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
python -m pip install --no-build-isolation --no-deps -v ${REPODIR}/python
fi
9 changes: 9 additions & 0 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ rapids-conda-retry mambabuild \
--channel "${CPP_CHANNEL}" \
conda/recipes/cuml

# Build cuml-cpu only in CUDA 11 jobs since it only depends on python
# version
RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
if [[ ${RAPIDS_CUDA_MAJOR} == "11" ]]; then
rapids-conda-retry mambabuild \
--no-test \
conda/recipes/cuml-cpu
fi

rapids-upload-conda-to-s3 python
5 changes: 5 additions & 0 deletions conda/recipes/cuml-cpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2023, NVIDIA CORPORATION.

# This assumes the script is executed from the root of the repo directory
./build.sh cuml-cpu -v
11 changes: 11 additions & 0 deletions conda/recipes/cuml-cpu/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 11

cxx_compiler_version:
- 11

cmake_version:
- ">=3.26.4"

sysroot_version:
- "=2.17"
50 changes: 50 additions & 0 deletions conda/recipes/cuml-cpu/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

# Usage:
# conda build . -c conda-forge -c numba -c rapidsai -c pytorch
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

package:
name: cuml-cpu
version: {{ version }}

source:
git_url: ../../..

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- VERSION_SUFFIX

requirements:
build:
- cmake {{ cmake_version }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
- ninja
host:
- python x.x
- setuptools
- scikit-build>=0.13.1
- cython>=3.0.0
run:
- python x.x
- numpy
- scikit-learn=1.2
- hdbscan<=0.8.30
- umap-learn=0.5.3
- nvtx

tests: # [linux64]
imports: # [linux64]
- cuml-cpu # [linux64]

about:
home: http://rapids.ai/
license: Apache-2.0
# license_file: LICENSE
summary: cuML-CPU library
124 changes: 80 additions & 44 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ include(../fetch_rapids.cmake)

set(CUML_VERSION 23.10.00)

# We always need CUDA for cuML because the raft dependency brings in a
# header-only cuco dependency that enables CUDA unconditionally.
include(rapids-cuda)
rapids_cuda_init_architectures(cuml-python)
option(CUML_CPU "Build only cuML CPU Python components." OFF)
set(language_list "C;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()

project(
cuml-python
Expand All @@ -30,14 +36,12 @@ project(
# language to be enabled here. The test project that is built in scikit-build to verify
# various linking options for the python library is hardcoded to build with C, so until
# that is fixed we need to keep C.
C CXX CUDA
${language_list}
)

################################################################################
# - User Options --------------------------------------------------------------
option(CUML_UNIVERSAL "Build all cuML Python components." ON)
option(CUML_CPU "Build only cuML CPU Python components." OFF)
option(CUML_GPU "Build only cuML GPU Python components. Not supported yet, defaulting to CUML_UNIVERSAL" OFF)
option(FIND_CUML_CPP "Search for existing CUML C++ installations before defaulting to local files" OFF)
option(CUML_BUILD_WHEELS "Whether this build is generating a Python wheel." OFF)
option(SINGLEGPU "Disable all mnmg components and comms libraries" OFF)
Expand All @@ -47,11 +51,11 @@ set(CUML_RAFT_CLONE_ON_PIN 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: Searching for existing CUML C++ installations before defaulting to local files: ${FIND_CUML_CPP}")
message(VERBOSE "CUML_PY: Disabling all mnmg components and comms libraries: ${SINGLEGPU}")

set(CUML_ALGORITHMS "ALL" CACHE STRING "Experimental: Choose which algorithms are built into libcuml++.so. Can specify individual algorithms or groups in a semicolon-separated list.")
message(VERBOSE "CUML_PY: Building cuML with algorithms: '${CUML_ALGORITHMS}'.")
set(CUML_ALGORITHMS "ALL" CACHE STRING "Choose which algorithms are built cuML. Can specify individual algorithms or groups in a semicolon-separated list.")

set(CUML_CPP_TARGET "cuml++")
set(CUML_CPP_SRC "../cpp")
Expand Down Expand Up @@ -80,48 +84,68 @@ else()
set(CUML_PYTHON_TREELITE_TARGET treelite::treelite)
endif()

if(NOT cuml_FOUND)
set(BUILD_CUML_TESTS OFF)
set(BUILD_PRIMS_TESTS OFF)
set(BUILD_CUML_C_LIBRARY OFF)
set(BUILD_CUML_EXAMPLES OFF)
set(BUILD_CUML_BENCH OFF)
set(BUILD_CUML_PRIMS_BENCH OFF)
set(CUML_EXPORT_TREELITE_LINKAGE ON)

set(_exclude_from_all "")
if(CUML_BUILD_WHEELS)
# Statically link dependencies if building wheels
set(CUDA_STATIC_RUNTIME ON)
set(CUML_USE_RAFT_STATIC ON)
set(CUML_USE_FAISS_STATIC ON)
set(CUML_USE_TREELITE_STATIC ON)
set(CUML_USE_CUMLPRIMS_MG_STATIC ON)
# Don't install the static libs into wheels
set(CUML_EXCLUDE_RAFT_FROM_ALL ON)
set(RAFT_EXCLUDE_FAISS_FROM_ALL ON)
set(CUML_EXCLUDE_TREELITE_FROM_ALL ON)
set(CUML_EXCLUDE_CUMLPRIMS_MG_FROM_ALL ON)

# Don't install the cuML C++ targets into wheels
set(_exclude_from_all EXCLUDE_FROM_ALL)
if(NOT ${CUML_CPU})
if(NOT cuml_FOUND)
set(BUILD_CUML_TESTS OFF)
set(BUILD_PRIMS_TESTS OFF)
set(BUILD_CUML_C_LIBRARY OFF)
set(BUILD_CUML_EXAMPLES OFF)
set(BUILD_CUML_BENCH OFF)
set(BUILD_CUML_PRIMS_BENCH OFF)
set(CUML_EXPORT_TREELITE_LINKAGE ON)

set(_exclude_from_all "")
if(CUML_BUILD_WHEELS)
# Statically link dependencies if building wheels
set(CUDA_STATIC_RUNTIME ON)
set(CUML_USE_RAFT_STATIC ON)
set(CUML_USE_FAISS_STATIC ON)
set(CUML_USE_TREELITE_STATIC ON)
set(CUML_USE_CUMLPRIMS_MG_STATIC ON)
# Don't install the static libs into wheels
set(CUML_EXCLUDE_RAFT_FROM_ALL ON)
set(RAFT_EXCLUDE_FAISS_FROM_ALL ON)
set(CUML_EXCLUDE_TREELITE_FROM_ALL ON)
set(CUML_EXCLUDE_CUMLPRIMS_MG_FROM_ALL ON)

# Don't install the cuML C++ targets into wheels
set(_exclude_from_all EXCLUDE_FROM_ALL)
endif()

add_subdirectory(../cpp cuml-cpp ${_exclude_from_all})

set(cython_lib_dir cuml)
install(TARGETS ${CUML_CPP_TARGET} DESTINATION ${cython_lib_dir})
endif()

add_subdirectory(../cpp cuml-cpp ${_exclude_from_all})

set(cython_lib_dir cuml)
install(TARGETS ${CUML_CPP_TARGET} DESTINATION ${cython_lib_dir})
endif()

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

set(CUML_ALGORITHMS "linearregression")
endif()
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")

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

list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=0")
else()
set(cuml_sg_libraries cuml::${CUML_CPP_TARGET})
set(cuml_mg_libraries cuml::${CUML_CPP_TARGET})

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")
endif()

if(NOT SINGLEGPU)
include("${CUML_CPP_SRC}/cmake/thirdparty/get_cumlprims_mg.cmake")
Expand All @@ -131,9 +155,21 @@ if(NOT SINGLEGPU)
)
endif()

rapids_cython_init()
################################################################################
# - Build Cython artifacts -----------------------------------------------------

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(cmake/ConfigureAlgorithmsHelpers.cmake)
rapids_cython_init()

add_subdirectory(cuml/common)
add_subdirectory(cuml/internals)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@


function(add_module_gpu_default FILENAME)
set (extra_args ${ARGN})
list(LENGTH extra_args extra_count)
if (${extra_count} GREATER 0 OR
${CUML_UNIVERSAL} OR
${CUML_GPU})
list(APPEND cython_sources
${FILENAME})
set (cython_sources ${cython_sources} PARENT_SCOPE)
endif()
endfunction()


function(add_module_universal_default FILENAME)
set (extra_args ${ARGN})
list(LENGTH extra_args extra_count)
if (${extra_count} GREATER 0 OR
Expand Down
Loading