-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build pyraft with scikit-build (#644)
This PR changes the pyraft build system to use scikit-build and CMake. It depends on the changes in #633 and should be merged after that PR. This PR is largely complete, except that I am not yet sure exactly which libraries/headers are entirely necessary for the build. This version builds locally for me, but not all tests pass since I don't have nccl. However, I am a bit surprised to see the build succeeding without me even searching for UCX (perhaps this is because it's already on my system include path) so I need to figure out what do with UCX, NCCL, and the various CUDA math libraries (cusparse, cublas, etc). Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Sevag Hanssian (https://github.com/sevagh) - Ray Douglass (https://github.com/raydouglass) - Corey J. Nolet (https://github.com/cjnolet) URL: #644
- Loading branch information
Showing
13 changed files
with
182 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# ============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# ============================================================================= | ||
|
||
cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR) | ||
|
||
set(pyraft_version 22.06.00) | ||
|
||
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-22.06/RAPIDS.cmake | ||
${CMAKE_BINARY_DIR}/RAPIDS.cmake) | ||
include(${CMAKE_BINARY_DIR}/RAPIDS.cmake) | ||
|
||
project( | ||
raft-python | ||
VERSION ${pyraft_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 | ||
# that is fixed we need to keep C. | ||
C | ||
CXX) | ||
|
||
option(FIND_RAFT_CPP "Search for existing RAFT C++ installations before defaulting to local files" | ||
OFF) | ||
|
||
# If the user requested it we attempt to find RAFT. | ||
if(FIND_RAFT_CPP) | ||
find_package(raft ${pyraft_version} REQUIRED) | ||
else() | ||
set(raft_FOUND OFF) | ||
endif() | ||
|
||
if(NOT raft_FOUND) | ||
# TODO: This will not be necessary once we upgrade to CMake 3.22, which will | ||
# pull in the required languages for the C++ project even if this project | ||
# does not require those languges. | ||
include(rapids-cuda) | ||
rapids_cuda_init_architectures(pylibraft) | ||
enable_language(CUDA) | ||
# Since pylibraft only enables CUDA optionally we need to manually include the file that | ||
# rapids_cuda_init_architectures relies on `project` including. | ||
include("${CMAKE_PROJECT_pylibraft_INCLUDE}") | ||
|
||
set(BUILD_TESTS OFF) | ||
set(BUILD_BENCHMARKS OFF) | ||
set(RAFT_COMPILE_LIBRARIES OFF) | ||
set(RAFT_COMPILE_DIST_LIBRARY OFF) | ||
set(RAFT_COMPILE_NN_LIBRARY OFF) | ||
add_subdirectory(../../cpp raft-cpp) | ||
endif() | ||
|
||
include(rapids-cython) | ||
rapids_cython_init() | ||
|
||
# TODO: Figure out which of ucx, nccl, cusolver, cusparse, and cublas I need to add as include directories or linked libraries for which components | ||
add_subdirectory(raft/common) | ||
add_subdirectory(raft/dask/common) | ||
add_subdirectory(raft/include_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
[build-system] | ||
|
||
requires = [ | ||
"wheel", | ||
"setuptools", | ||
"cython>=0.29,<0.30", | ||
"scikit-build>=0.13.1", | ||
"cmake>=3.20.1,!=3.23.0", | ||
"ninja", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# ============================================================================= | ||
|
||
set(cython_sources cuda.pyx handle.pyx interruptible.pyx) | ||
set(linked_libraries raft::raft) | ||
rapids_cython_create_modules( | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" | ||
CXX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# ============================================================================= | ||
|
||
include(${raft-python_SOURCE_DIR}/cmake/thirdparty/get_nccl.cmake) | ||
find_package(ucx REQUIRED) | ||
|
||
set(cython_sources comms_utils.pyx nccl.pyx) | ||
set(linked_libraries raft::raft NCCL::NCCL ucx::ucp) | ||
rapids_cython_create_modules( | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" | ||
CXX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ============================================================================= | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# ============================================================================= | ||
|
||
set(cython_sources raft_include_test.pyx) | ||
set(linked_libraries raft::raft) | ||
rapids_cython_create_modules( | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" | ||
CXX) |
Oops, something went wrong.