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

Merge latest skbuild dev branch changes #5

Merged
merged 9 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 8 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ if (( ${CLEAN} == 1 )); then
cd ${REPODIR}
fi

# Before

################################################################################
# Configure for building all C++ targets
Expand Down Expand Up @@ -283,11 +282,17 @@ fi

# Build and (optionally) install the cuml Python package
if completeBuild || hasArg cuml || hasArg pydocs; then
# Append `-DFIND_CUML_CPP=ON` to CUML_EXTRA_CMAKE_ARGS unless a user specified the option.
if [[ "${CUML_EXTRA_CMAKE_ARGS}" != *"DFIND_CUML_CPP"* ]]; then
CUML_EXTRA_CMAKE_ARGS="${CUML_EXTRA_CMAKE_ARGS} -DFIND_CUML_CPP=ON"
fi

cd ${REPODIR}/python
if [[ ${INSTALL_TARGET} != "" ]]; then
python setup.py build_ext -j${PARALLEL_LEVEL:-1} ${CUML_EXTRA_PYTHON_ARGS} --library-dir=${LIBCUML_BUILD_DIR} install --single-version-externally-managed --record=record.txt
# python setup.py build_ext -j${PARALLEL_LEVEL:-1} ${CUML_EXTRA_PYTHON_ARGS} --library-dir=${LIBCUML_BUILD_DIR} install --single-version-externally-managed --record=record.txt
python setup.py build_ext -v --inplace -- ${CUML_EXTRA_CMAKE_ARGS} -- -j${PARALLEL_LEVEL:-1} install
else
python setup.py build_ext -j${PARALLEL_LEVEL:-1} ${CUML_EXTRA_PYTHON_ARGS} --library-dir=${LIBCUML_BUILD_DIR}
python setup.py build_ext -v --inplace -- ${CUML_EXTRA_CMAKE_ARGS} -- -j${PARALLEL_LEVEL:-1}
fi

if hasArg pydocs; then
Expand Down
69 changes: 23 additions & 46 deletions python/cuml/CMakeLists.txt → python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ include(rapids-cmake)
include(rapids-cpm)
include(rapids-find)

set(cuml_version 22.08.00)
set(CUML_VERSION 22.08.00)

project(
cuml-python
VERSION ${cuml_version}
VERSION ${CUML_VERSION}
LANGUAGES # TODO: Building Python extension modules via the python_extension_module requires the C
# 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
Expand All @@ -36,18 +36,20 @@ project(
################################################################################
# - User Options --------------------------------------------------------------
option(FIND_CUML_CPP "Search for existing CUML C++ installations before defaulting to local files" OFF)
option(SINGLEGPU "Disable all mnmg components and comms libraries" OFF)

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_CPP_TARGET "cuml++")

################################################################################
# - Process User Options ------------------------------------------------------
rapids_cpm_init()
include(../../cpp/cmake/thirdparty/get_treelite.cmake)


# If the user requested it, we attempt to find cuml.
if(FIND_CUML_CPP)
rapids_cpm_init()
include(rapids-cuda)
rapids_cuda_init_architectures(CUML)
enable_language(CUDA)
Expand All @@ -57,48 +59,23 @@ if(FIND_CUML_CPP)
# rapids_cuda_init_architectures relies on `project` including.

include("${CMAKE_PROJECT_cuml-python_INCLUDE}")
set(RAFT_VERSION "22.08")
set(RAFT_FORK "rapidsai")
set(RAFT_PINNED_TAG "branch-${RAFT_VERSION}")

function(find_and_configure_raft)
set(oneValueArgs VERSION FORK PINNED_TAG COMPILE_LIBRARIES)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN} )

#-----------------------------------------------------
# Invoke CPM find_package()
#-----------------------------------------------------

string(APPEND RAFT_COMPONENTS "distance")
string(APPEND RAFT_COMPONENTS " nn")

rapids_cpm_find(raft ${PKG_VERSION}
GLOBAL_TARGETS raft::raft
BUILD_EXPORT_SET projname-exports
INSTALL_EXPORT_SET projname-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git
GIT_TAG ${PKG_PINNED_TAG}
SOURCE_SUBDIR cpp
FIND_PACKAGE_ARGUMENTS "COMPONENTS ${RAFT_COMPONENTS}"
OPTIONS
"BUILD_TESTS OFF"
"BUILD_BENCH OFF"
"RAFT_COMPILE_LIBRARIES ${PKG_COMPILE_LIBRARIES}"
)

endfunction()

# Change pinned tag here to test a commit in CI
# To use a different RAFT locally, set the CMake variable
# CPM_raft_SOURCE=/path/to/local/raft
find_and_configure_raft(VERSION ${RAFT_VERSION}.00
FORK ${RAFT_FORK}
PINNED_TAG ${RAFT_PINNED_TAG}
COMPILE_LIBRARIES NO
)
find_package(cuml ${cuml_version} REQUIRED)
include(../cpp/cmake/thirdparty/get_treelite.cmake)
rapids_cpm_init()
include(rapids-cuda)
rapids_cuda_init_architectures(CUML)
enable_language(CUDA)

include("${CMAKE_PROJECT_cuml-python_INCLUDE}")
include(../cpp/cmake/thirdparty/get_treelite.cmake)

set(CUML_VERSION_MAJOR "22")
set(CUML_VERSION_MINOR "08")
set(CUML_USE_RAFT_NN ON)
set(CUML_USE_RAFT_DIST ON)

include(../cpp/cmake/thirdparty/get_raft.cmake)

find_package(cuml ${CUML_VERSION} REQUIRED)
else()
set(cuml_FOUND OFF)
endif()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
set(cython_sources
agglomerative.pyx
dbscan.pyx
dbscan_mg.pyx
hdbscan.pyx
kmeans.pyx
kmeans_mg.pyx
)

if(NOT SINGLEGPU)
list(APPEND cython_sources
dbscan_mg.pyx
kmeans_mg.pyx
)
endif()

set(linked_libraries cuml::${CUML_CPP_TARGET})
rapids_cython_create_modules(
CXX
Expand All @@ -37,10 +42,14 @@ find_package(Python REQUIRED COMPONENTS Development NumPy)
set(targets_using_numpy
agglomerative
dbscan
dbscan_mg
hdbscan
kmeans
kmeans_mg)
kmeans)
if(NOT SINGLEGPU)
list(APPEND targets_using_numpy
dbscan_mg
kmeans_mg
)
endif()
foreach(target IN LISTS targets_using_numpy)
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}")
endforeach()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/cpp")
endforeach()

target_include_directories(pointer_utils PRIVATE "../../../../cpp/src/")
target_include_directories(pointer_utils PRIVATE "../../../cpp/src/")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@

# todo: disable _mg for singlegpu
set(cython_sources
base_mg.pyx
pca.pyx
pca_mg.pyx
tsvd.pyx
tsvd_mg.pyx
)

if(NOT SINGLEGPU)
list(APPEND cython_sources
base_mg.pyx
pca_mg.pyx
tsvd_mg.pyx
)
endif()

set(linked_libraries cuml::${CUML_CPP_TARGET})
rapids_cython_create_modules(
CXX
Expand All @@ -35,10 +40,14 @@ rapids_cython_create_modules(
find_package(Python REQUIRED COMPONENTS Development NumPy)
set(targets_using_numpy
pca
pca_mg
tsvd
tsvd_mg
)
if(NOT SINGLEGPU)
list(APPEND targets_using_numpy
pca_mg
tsvd_mg
)
endif()
foreach(target IN LISTS targets_using_numpy)
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}")
endforeach()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@
# =============================================================================


# todo: disable _mg for singlegpu
set(cython_sources
base.pyx
base_mg.pyx
elastic_net.pyx
linear_regression.pyx
linear_regression_mg.pyx
logistic_regression.pyx
mbsgd_classifier.pyx
mbsgd_regressor.pyx
ridge.pyx
ridge_mg.pyx
)

if(NOT SINGLEGPU)
list(APPEND cython_sources
base_mg.pyx
linear_regression_mg.pyx
ridge_mg.pyx
)
endif()

set(linked_libraries cuml::${CUML_CPP_TARGET})
rapids_cython_create_modules(
CXX
Expand All @@ -40,16 +44,20 @@ rapids_cython_create_modules(
find_package(Python REQUIRED COMPONENTS Development NumPy)
set(targets_using_numpy
linear_base
linear_base_mg
linear_elastic_net
linear_linear_regression
linear_linear_regression_mg
linear_logistic_regression
linear_mbsgd_classifier
linear_mbsgd_regressor
linear_ridge
linear_ridge_mg
)
if(NOT SINGLEGPU)
list(APPEND targets_using_numpy
linear_base_mg
linear_linear_regression_mg
linear_ridge_mg
)
endif()
foreach(target IN LISTS targets_using_numpy)
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}")
endforeach()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
set(cython_sources
ann.pyx
kneighbors_classifier.pyx
kneighbors_classifier_mg.pyx
kneighbors_regressor.pyx
kneighbors_regressor_mg.pyx
nearest_neighbors.pyx
nearest_neighbors_mg.pyx
)

if(NOT SINGLEGPU)
list(APPEND cython_sources
kneighbors_classifier_mg.pyx
kneighbors_regressor_mg.pyx
nearest_neighbors_mg.pyx
)
endif()


set(linked_libraries cuml::${CUML_CPP_TARGET})
rapids_cython_create_modules(
CXX
Expand All @@ -38,12 +44,17 @@ find_package(Python REQUIRED COMPONENTS Development NumPy)
set(targets_using_numpy
ann
kneighbors_classifier
kneighbors_classifier_mg
kneighbors_regressor
kneighbors_regressor_mg
nearest_neighbors
nearest_neighbors_mg
)
if(NOT SINGLEGPU)
list(APPEND targets_using_numpy
kneighbors_classifier_mg
kneighbors_regressor_mg
nearest_neighbors_mg
)
endif()

foreach(target IN LISTS targets_using_numpy)
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}")
endforeach()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading