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

Use new rapids-cython component of rapids-cmake to simplify builds #1031

Merged
merged 14 commits into from
May 11, 2022
1 change: 1 addition & 0 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function sed_runner() {
sed_runner 's/'" VERSION .*"'/'" VERSION ${NEXT_FULL_TAG}"'/g' CMakeLists.txt
sed_runner 's/'"rmm_version .*)"'/'"rmm_version ${NEXT_FULL_TAG})"'/g' python/CMakeLists.txt
sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' CMakeLists.txt
sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' python/CMakeLists.txt

sed_runner 's/'"PROJECT_NUMBER = .*"'/'"PROJECT_NUMBER = ${NEXT_SHORT_TAG}"'/g' doxygen/Doxyfile

Expand Down
37 changes: 14 additions & 23 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR)

set(rmm_version 22.06.00)

set(CYTHON_FLAGS
"--directive binding=True,embedsignature=True,always_allow_keywords=True"
CACHE STRING "The directives for Cython compilation.")
file(DOWNLOAD https://github.com/raw/rapidsai/rapids-cmake/branch-22.06/RAPIDS.cmake
vyasr marked this conversation as resolved.
Show resolved Hide resolved
${CMAKE_BINARY_DIR}/RAPIDS.cmake)
include(${CMAKE_BINARY_DIR}/RAPIDS.cmake)

project(
rmm-python
Expand All @@ -27,38 +27,29 @@ 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
# TODO: The C++ RMM CMake configuration targets cuda_std_17 features, which prior to
# CMake 3.22 will also pull in the corresponding required languages even if this project
# does not actually require those languages. As a result, we need to include CUDA here.
# We can remove CUDA once we upgrade the minimum required CMake version to 3.22.
CUDA)
C CXX)

option(FIND_RMM_CPP "Search for existing RMM C++ installations before defaulting to local files"
OFF)

find_package(PythonExtensions REQUIRED)
find_package(Cython REQUIRED)

# Ignore unused variable warning.
set(ignored_variable "${SKBUILD}")

# If the user requested it we attempt to find RMM. TODO: Should we allow the user to specify a path
# instead of just searching? This version assumes that the installation has been appropriately
# configured for CMake discovery.
# If the user requested it we attempt to find RMM.
if(FIND_RMM_CPP)
find_package(RMM ${rmm_version})
find_package(rmm ${rmm_version})
else()
set(RMM_FOUND OFF)
set(rmm_FOUND OFF)
endif()

if(NOT RMM_FOUND)
if(NOT rmm_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.
enable_language(CUDA)
set(BUILD_TESTS OFF)
set(BUILD_BENCHMARKS OFF)
add_subdirectory(../ rmm-cpp)
endif()

add_subdirectory(cmake)
include(rapids-cython)
rapids_cython_init()
vyasr marked this conversation as resolved.
Show resolved Hide resolved

add_subdirectory(rmm/_cuda)
add_subdirectory(rmm/_lib)
16 changes: 0 additions & 16 deletions python/cmake/CMakeLists.txt

This file was deleted.

48 changes: 0 additions & 48 deletions python/cmake/rmm_python_helpers.cmake

This file was deleted.

48 changes: 0 additions & 48 deletions python/cmake/skbuild_patches.cmake

This file was deleted.

8 changes: 4 additions & 4 deletions python/rmm/_cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# the License.
# =============================================================================

# Set the list of Cython files to build
set(cython_modules stream)
set(cython_sources stream.pyx)
set(linked_libraries rmm::rmm)

# Build all of the Cython targets
add_cython_modules("${cython_modules}")
rapids_cython_create_modules(SOURCE_FILES "${cython_sources}" LINKED_LIBRARIES "${linked_libraries}"
CXX)
7 changes: 4 additions & 3 deletions python/rmm/_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# the License.
# =============================================================================

# Set the list of Cython files to build
set(cython_modules device_buffer lib memory_resource cuda_stream)
set(cython_sources device_buffer.pyx lib.pyx memory_resource.pyx cuda_stream.pyx)
set(linked_libraries rmm::rmm)

# Build all of the Cython targets
add_cython_modules("${cython_modules}")
rapids_cython_create_modules(SOURCE_FILES "${cython_sources}" LINKED_LIBRARIES "${linked_libraries}"
CXX)
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
)
},
cmdclass=versioneer.get_cmdclass(),
install_requires=["numba", "cython", "cuda-python"],
install_requires=["numba", "cuda-python"],
zip_safe=False,
)