diff --git a/.gitignore b/.gitignore index aee3d072de2..df266677373 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ parts/ sdist/ var/ wheels/ +_skbuild/ *.egg-info/ .installed.cfg *.egg @@ -162,4 +163,4 @@ dask-worker-space/ # Sphinx docs & build artifacts docs/cudf/source/api_docs/generated/* -docs/cudf/source/api_docs/api/* \ No newline at end of file +docs/cudf/source/api_docs/api/* diff --git a/build.sh b/build.sh index 6a43674c642..29dd63d4548 100755 --- a/build.sh +++ b/build.sh @@ -324,10 +324,9 @@ fi if buildAll || hasArg cudf; then cd ${REPODIR}/python/cudf + python setup.py build_ext --inplace -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} ${CMAKE_ARGS} -- -j${PARALLEL_LEVEL:-1} if [[ ${INSTALL_TARGET} != "" ]]; then - PARALLEL_LEVEL=${PARALLEL_LEVEL} python setup.py build_ext -j${PARALLEL_LEVEL} install --single-version-externally-managed --record=record.txt - else - PARALLEL_LEVEL=${PARALLEL_LEVEL} python setup.py build_ext --inplace -j${PARALLEL_LEVEL} --library-dir=${LIBCUDF_BUILD_DIR} + python setup.py install --single-version-externally-managed --record=record.txt -- -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} ${CMAKE_ARGS} -- -j${PARALLEL_LEVEL:-1} fi fi diff --git a/ci/gpu/build.sh b/ci/gpu/build.sh index 79678fe7203..cbf5016c785 100755 --- a/ci/gpu/build.sh +++ b/ci/gpu/build.sh @@ -127,7 +127,7 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then ################################################################################ gpuci_logger "Build from source" - "$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests --ptds + "$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests --ptds --cmake-args=\"-DFIND_CUDF_CPP=ON\" ################################################################################ # TEST - Run GoogleTest diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index f07d7984cd1..24fd5b025e6 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -34,6 +34,9 @@ function sed_runner() { # cpp update sed_runner 's/'"VERSION ${CURRENT_SHORT_TAG}.*"'/'"VERSION ${NEXT_FULL_TAG}"'/g' cpp/CMakeLists.txt +# Python update +sed_runner 's/'"cudf_version .*)"'/'"cudf_version ${NEXT_FULL_TAG})"'/g' python/cudf/CMakeLists.txt + # cpp libcudf_kafka update sed_runner 's/'"VERSION ${CURRENT_SHORT_TAG}.*"'/'"VERSION ${NEXT_FULL_TAG}"'/g' cpp/libcudf_kafka/CMakeLists.txt diff --git a/conda/environments/cudf_dev_cuda11.5.yml b/conda/environments/cudf_dev_cuda11.5.yml index 92c1345ac0c..372be6799d4 100644 --- a/conda/environments/cudf_dev_cuda11.5.yml +++ b/conda/environments/cudf_dev_cuda11.5.yml @@ -16,6 +16,7 @@ dependencies: - rmm=22.08.* - cmake>=3.20.1,!=3.23.0 - cmake_setuptools>=0.1.3 + - scikit-build>=0.13.1 - python>=3.7,<3.9 - numba>=0.54 - numpy diff --git a/conda/recipes/cudf/build.sh b/conda/recipes/cudf/build.sh index 9cc4e1f9ac4..216a566a121 100644 --- a/conda/recipes/cudf/build.sh +++ b/conda/recipes/cudf/build.sh @@ -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\" diff --git a/conda/recipes/cudf/conda_build_config.yaml b/conda/recipes/cudf/conda_build_config.yaml index c049d21fd91..d9c3f21448f 100644 --- a/conda/recipes/cudf/conda_build_config.yaml +++ b/conda/recipes/cudf/conda_build_config.yaml @@ -6,3 +6,9 @@ cxx_compiler_version: sysroot_version: - "2.17" + +cmake_version: + - ">=3.20.1,!=3.23.0" + +cuda_compiler: + - nvcc diff --git a/conda/recipes/cudf/meta.yaml b/conda/recipes/cudf/meta.yaml index b890c34f06a..84c24d691e0 100644 --- a/conda/recipes/cudf/meta.yaml +++ b/conda/recipes/cudf/meta.yaml @@ -25,13 +25,17 @@ build: requirements: build: + - cmake {{ cmake_version }} - {{ compiler('c') }} - {{ compiler('cxx') }} + - {{ compiler('cuda') }} {{ cuda_version }} - sysroot_{{ target_platform }} {{ sysroot_version }} host: - protobuf - python - cython >=0.29,<0.30 + - cmake>=3.20.1,!=3.23.0 + - scikit-build>=0.13.1 - setuptools - numba >=0.54 - dlpack>=0.5,<0.6.0a0 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ef611e275be..4ddfc0f0bb9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -752,7 +752,7 @@ install( ) install(DIRECTORY ${CUDF_SOURCE_DIR}/include/cudf ${CUDF_SOURCE_DIR}/include/cudf_test - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ${CUDF_SOURCE_DIR}/include/nvtext DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install( diff --git a/python/cudf/CMakeLists.txt b/python/cudf/CMakeLists.txt new file mode 100644 index 00000000000..927bdca22c5 --- /dev/null +++ b/python/cudf/CMakeLists.txt @@ -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) diff --git a/python/cudf/cudf/_lib/CMakeLists.txt b/python/cudf/cudf/_lib/CMakeLists.txt new file mode 100644 index 00000000000..e806decbf12 --- /dev/null +++ b/python/cudf/cudf/_lib/CMakeLists.txt @@ -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) diff --git a/python/cudf/cudf/_lib/io/CMakeLists.txt b/python/cudf/cudf/_lib/io/CMakeLists.txt new file mode 100644 index 00000000000..b12b085fc76 --- /dev/null +++ b/python/cudf/cudf/_lib/io/CMakeLists.txt @@ -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() diff --git a/python/cudf/cudf/_lib/nvtext/CMakeLists.txt b/python/cudf/cudf/_lib/nvtext/CMakeLists.txt new file mode 100644 index 00000000000..d96999a077e --- /dev/null +++ b/python/cudf/cudf/_lib/nvtext/CMakeLists.txt @@ -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() diff --git a/python/cudf/cudf/_lib/strings/CMakeLists.txt b/python/cudf/cudf/_lib/strings/CMakeLists.txt new file mode 100644 index 00000000000..8ed5c5e03c1 --- /dev/null +++ b/python/cudf/cudf/_lib/strings/CMakeLists.txt @@ -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) diff --git a/python/cudf/cudf/_lib/strings/convert/CMakeLists.txt b/python/cudf/cudf/_lib/strings/convert/CMakeLists.txt new file mode 100644 index 00000000000..ea2e3943b5a --- /dev/null +++ b/python/cudf/cudf/_lib/strings/convert/CMakeLists.txt @@ -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() diff --git a/python/cudf/cudf/_lib/strings/split/CMakeLists.txt b/python/cudf/cudf/_lib/strings/split/CMakeLists.txt new file mode 100644 index 00000000000..2d23c0d21cb --- /dev/null +++ b/python/cudf/cudf/_lib/strings/split/CMakeLists.txt @@ -0,0 +1,26 @@ +# ============================================================================= +# 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 partition.pyx split.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() diff --git a/python/cudf/cudf/core/join/join.py b/python/cudf/cudf/core/join/join.py index 97f28656d1d..0bf43969b72 100644 --- a/python/cudf/cudf/core/join/join.py +++ b/python/cudf/cudf/core/join/join.py @@ -1,7 +1,7 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. from __future__ import annotations -from typing import TYPE_CHECKING, Any, Callable, List, cast +from typing import TYPE_CHECKING, Any, ClassVar, List, cast import cudf from cudf import _lib as libcudf @@ -29,7 +29,7 @@ class Merge: # join key. The `joiner` returns a tuple of two Columns # representing the rows to gather from the left- and right- side # tables respectively. - _joiner: Callable = libcudf.join.join + _joiner: ClassVar[staticmethod] = staticmethod(libcudf.join.join) def __init__( self, @@ -445,7 +445,7 @@ def _validate_merge_params( class MergeSemi(Merge): - _joiner: Callable = libcudf.join.semi_join + _joiner: ClassVar[staticmethod] = staticmethod(libcudf.join.semi_join) def _merge_results(self, lhs: Frame, rhs: Frame): # semi-join result includes only lhs columns diff --git a/python/cudf/pyproject.toml b/python/cudf/pyproject.toml index 630efd5b9ec..7eaa5ae2f8d 100644 --- a/python/cudf/pyproject.toml +++ b/python/cudf/pyproject.toml @@ -1,4 +1,4 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2022, NVIDIA CORPORATION. [build-system] @@ -6,6 +6,9 @@ requires = [ "wheel", "setuptools", "cython>=0.29,<0.30", + "scikit-build>=0.13.1", + "cmake>=3.20.1,!=3.23.0", + "ninja", ] [tool.black] diff --git a/python/cudf/setup.py b/python/cudf/setup.py index 4a5a0d2186f..6c791b5688b 100644 --- a/python/cudf/setup.py +++ b/python/cudf/setup.py @@ -5,27 +5,11 @@ import shutil import subprocess import sys -import sysconfig - -# Must import in this order: -# setuptools -> Cython.Distutils.build_ext -> setuptools.command.build_ext -# Otherwise, setuptools.command.build_ext ends up inheriting from -# Cython.Distutils.old_build_ext which we do not want -import setuptools - -try: - from Cython.Distutils.build_ext import new_build_ext as _build_ext -except ImportError: - from setuptools.command.build_ext import build_ext as _build_ext - from distutils.spawn import find_executable -from distutils.sysconfig import get_python_lib -import numpy as np -import pyarrow as pa -import setuptools.command.build_ext -from setuptools import find_packages, setup -from setuptools.extension import Extension +from setuptools import find_packages +from skbuild import setup +from skbuild.command.build_ext import build_ext import versioneer @@ -57,8 +41,6 @@ ] } -cython_files = ["cudf/**/*.pyx"] - def get_cuda_version_from_header(cuda_include_dir, delimeter=""): @@ -96,67 +78,12 @@ def get_cuda_version_from_header(cuda_include_dir, delimeter=""): raise OSError(f"Invalid CUDA_HOME: directory does not exist: {CUDA_HOME}") cuda_include_dir = os.path.join(CUDA_HOME, "include") -cuda_lib_dir = os.path.join(CUDA_HOME, "lib64") install_requires.append( "cupy-cuda" + get_cuda_version_from_header(cuda_include_dir) ) -CUDF_HOME = os.environ.get( - "CUDF_HOME", - os.path.abspath( - os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../") - ), -) -CUDF_ROOT = os.environ.get( - "CUDF_ROOT", - os.path.abspath( - os.path.join( - os.path.dirname(os.path.abspath(__file__)), "../../cpp/build/" - ) - ), -) - - -class build_ext_and_proto_no_debug(_build_ext): - def build_extensions(self): - def remove_flags(compiler, *flags): - for flag in flags: - try: - compiler.compiler_so = list( - filter((flag).__ne__, compiler.compiler_so) - ) - except Exception: - pass - - # Full optimization - self.compiler.compiler_so.append("-O3") - # Silence '-Wunknown-pragmas' warning - self.compiler.compiler_so.append("-Wno-unknown-pragmas") - # No debug symbols, full optimization, no '-Wstrict-prototypes' warning - remove_flags( - self.compiler, "-g", "-G", "-O1", "-O2", "-Wstrict-prototypes" - ) - super().build_extensions() - - def finalize_options(self): - if self.distribution.ext_modules: - # Delay import this to allow for Cython-less installs - from Cython.Build.Dependencies import cythonize - - nthreads = getattr(self, "parallel", None) # -j option in Py3.5+ - nthreads = int(nthreads) if nthreads else None - self.distribution.ext_modules = cythonize( - self.distribution.ext_modules, - nthreads=nthreads, - force=self.force, - gdb_debug=False, - compiler_directives=dict( - profile=False, language_level=3, embedsignature=True - ), - ) - # Skip calling super() and jump straight to setuptools - setuptools.command.build_ext.build_ext.finalize_options(self) +class build_ext_and_proto(build_ext): def run(self): # Get protoc protoc = None @@ -193,45 +120,11 @@ def run(self): src.write(new_src_content) # Run original Cython build_ext command - _build_ext.run(self) + super().run() -extensions = [ - Extension( - "*", - sources=cython_files, - include_dirs=[ - os.path.abspath(os.path.join(CUDF_HOME, "cpp/include/cudf")), - os.path.abspath(os.path.join(CUDF_HOME, "cpp/include")), - os.path.abspath(os.path.join(CUDF_ROOT, "include")), - os.path.join(CUDF_ROOT, "_deps/libcudacxx-src/include"), - os.path.join(CUDF_ROOT, "_deps/dlpack-src/include"), - os.path.join( - os.path.dirname(sysconfig.get_path("include")), - "rapids/libcudacxx", - ), - os.path.dirname(sysconfig.get_path("include")), - np.get_include(), - pa.get_include(), - cuda_include_dir, - ], - library_dirs=( - pa.get_library_dirs() - + [ - get_python_lib(), - os.path.join(os.sys.prefix, "lib"), - cuda_lib_dir, - ] - ), - libraries=["cudart", "cudf"] + pa.get_libraries() + ["arrow_cuda"], - language="c++", - extra_compile_args=["-std=c++17"], - ) -] - cmdclass = versioneer.get_cmdclass() -cmdclass["build_ext"] = build_ext_and_proto_no_debug - +cmdclass["build_ext"] = build_ext_and_proto setup( name="cudf", @@ -249,14 +142,10 @@ def run(self): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", ], - # Include the separately-compiled shared library - setup_requires=["cython", "protobuf"], - ext_modules=extensions, packages=find_packages(include=["cudf", "cudf.*"]), - package_data=dict.fromkeys( - find_packages(include=["cudf._lib*"]), - ["*.pxd"], - ), + package_data={ + key: ["*.pxd"] for key in find_packages(include=["cudf._lib*"]) + }, cmdclass=cmdclass, install_requires=install_requires, extras_require=extras_require,