-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable builds with scikit-build (#10919)
This PR changes the Python build system for cudf to use scikit-build and leverage CMake under the hood. This PR depends on rapidsai/rapids-cmake#198. Once that PR is merged, I can update the pull of rapids-cmake into the cudf Python CMake build. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Robert Maynard (https://github.com/robertmaynard) - AJ Schmidt (https://github.com/ajschmidt8) - Ashwin Srinath (https://github.com/shwina) URL: #10919
- Loading branch information
Showing
19 changed files
with
348 additions
and
132 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 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2018-2019, NVIDIA CORPORATION. | ||
# Copyright (c) 2018-2022, NVIDIA CORPORATION. | ||
|
||
# This assumes the script is executed from the root of the repo directory | ||
./build.sh cudf | ||
./build.sh cudf --cmake-args=\"-DFIND_CUDF_CPP=ON\" |
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 |
---|---|---|
|
@@ -6,3 +6,9 @@ cxx_compiler_version: | |
|
||
sysroot_version: | ||
- "2.17" | ||
|
||
cmake_version: | ||
- ">=3.20.1,!=3.23.0" | ||
|
||
cuda_compiler: | ||
- nvcc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# ============================================================================= | ||
# 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(cudf_version 22.08.00) | ||
|
||
include(../../fetch_rapids.cmake) | ||
|
||
project( | ||
cudf-python | ||
VERSION ${cudf_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_CUDF_CPP "Search for existing CUDF C++ installations before defaulting to local files" | ||
OFF | ||
) | ||
|
||
# If the user requested it we attempt to find CUDF. | ||
if(FIND_CUDF_CPP) | ||
find_package(cudf ${cudf_version} REQUIRED) | ||
else() | ||
set(cudf_FOUND OFF) | ||
endif() | ||
|
||
if(NOT cudf_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(cudf-python) | ||
enable_language(CUDA) | ||
# Since cudf only enables CUDA optionally we need to manually include the file that | ||
# rapids_cuda_init_architectures relies on `project` including. | ||
include("${CMAKE_PROJECT_cudf-python_INCLUDE}") | ||
|
||
set(BUILD_TESTS OFF) | ||
set(BUILD_BENCHMARKS OFF) | ||
add_subdirectory(../../cpp cudf-cpp) | ||
|
||
# Since there are multiple subpackages of cudf._lib that require access to libcudf, we place the | ||
# library in the _lib/cpp directory as a single source of truth and modify the other rpaths | ||
# appropriately. | ||
install(TARGETS cudf DESTINATION cudf/_lib/cpp) | ||
endif() | ||
|
||
include(rapids-cython) | ||
rapids_cython_init() | ||
|
||
add_subdirectory(cudf/_lib) |
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,85 @@ | ||
# ============================================================================= | ||
# 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 | ||
aggregation.pyx | ||
avro.pyx | ||
binaryop.pyx | ||
column.pyx | ||
concat.pyx | ||
copying.pyx | ||
csv.pyx | ||
datetime.pyx | ||
expressions.pyx | ||
filling.pyx | ||
gpuarrow.pyx | ||
groupby.pyx | ||
hash.pyx | ||
interop.pyx | ||
join.pyx | ||
json.pyx | ||
labeling.pyx | ||
lists.pyx | ||
merge.pyx | ||
null_mask.pyx | ||
orc.pyx | ||
parquet.pyx | ||
partitioning.pyx | ||
quantiles.pyx | ||
reduce.pyx | ||
replace.pyx | ||
reshape.pyx | ||
rolling.pyx | ||
round.pyx | ||
scalar.pyx | ||
search.pyx | ||
sort.pyx | ||
stream_compaction.pyx | ||
string_casting.pyx | ||
text.pyx | ||
transform.pyx | ||
transpose.pyx | ||
types.pyx | ||
unary.pyx | ||
utils.pyx | ||
) | ||
set(linked_libraries cudf::cudf) | ||
rapids_cython_create_modules( | ||
CXX | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" | ||
) | ||
|
||
# TODO: Finding NumPy requires finding Development as well. Once this is fixed in CMake (no date | ||
# yet) we can remove the extra component spec. | ||
find_package(Python REQUIRED COMPONENTS Development NumPy) | ||
set(targets_using_numpy gpuarrow interop avro csv orc json parquet) | ||
foreach(target IN LISTS targets_using_numpy) | ||
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}") | ||
endforeach() | ||
|
||
# PyArrow relies on the C++ Arrow library already being installed, so we can just find the C++ | ||
# library directly and link to the same one. We rely on libcudf's exports to provide the | ||
# arrow_shared_lib and arrow_cuda_shared_lib libraries. That just leaves us to find the ArrowPython | ||
# library on our own. | ||
find_library(arrow_python_shared_library arrow_python REQUIRED) | ||
target_link_libraries(gpuarrow ${arrow_python_shared_library}) | ||
|
||
foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) | ||
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/cpp") | ||
endforeach() | ||
|
||
add_subdirectory(io) | ||
add_subdirectory(nvtext) | ||
add_subdirectory(strings) |
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,30 @@ | ||
# ============================================================================= | ||
# 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 datasource.pyx utils.pyx) | ||
set(linked_libraries cudf::cudf) | ||
rapids_cython_create_modules( | ||
CXX | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" MODULE_PREFIX io_ | ||
) | ||
|
||
set(targets_using_numpy io_datasource io_utils) | ||
foreach(target IN LISTS targets_using_numpy) | ||
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}") | ||
endforeach() | ||
|
||
foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) | ||
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../cpp") | ||
endforeach() |
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,27 @@ | ||
# ============================================================================= | ||
# 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 edit_distance.pyx generate_ngrams.pyx ngrams_tokenize.pyx normalize.pyx | ||
replace.pyx stemmer.pyx subword_tokenize.pyx tokenize.pyx | ||
) | ||
set(linked_libraries cudf::cudf) | ||
rapids_cython_create_modules( | ||
CXX | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" MODULE_PREFIX nvtext_ | ||
) | ||
|
||
foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) | ||
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../cpp") | ||
endforeach() |
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,49 @@ | ||
# ============================================================================= | ||
# 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 | ||
attributes.pyx | ||
capitalize.pyx | ||
case.pyx | ||
char_types.pyx | ||
combine.pyx | ||
contains.pyx | ||
extract.pyx | ||
find.pyx | ||
find_multiple.pyx | ||
findall.pyx | ||
json.pyx | ||
padding.pyx | ||
repeat.pyx | ||
replace.pyx | ||
replace_re.pyx | ||
strip.pyx | ||
substring.pyx | ||
translate.pyx | ||
wrap.pyx | ||
) | ||
|
||
set(linked_libraries cudf::cudf) | ||
rapids_cython_create_modules( | ||
CXX | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" MODULE_PREFIX strings_ | ||
) | ||
|
||
foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) | ||
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../cpp") | ||
endforeach() | ||
|
||
add_subdirectory(convert) | ||
add_subdirectory(split) |
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,28 @@ | ||
# ============================================================================= | ||
# 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 convert_fixed_point.pyx convert_floats.pyx convert_integers.pyx | ||
convert_lists.pyx convert_urls.pyx | ||
) | ||
|
||
set(linked_libraries cudf::cudf) | ||
rapids_cython_create_modules( | ||
CXX | ||
SOURCE_FILES "${cython_sources}" | ||
LINKED_LIBRARIES "${linked_libraries}" MODULE_PREFIX strings_ | ||
) | ||
|
||
foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) | ||
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../../cpp") | ||
endforeach() |
Oops, something went wrong.