Skip to content

Commit

Permalink
Require libcudf and libcudf_kafka when building cudf_kafka Python pac…
Browse files Browse the repository at this point in the history
…kage (which disallows wheel builds, but we aren't shipping wheels anyway).
  • Loading branch information
bdice committed Nov 13, 2023
1 parent d46f283 commit 27841c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 126 deletions.
9 changes: 2 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ if [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_CUDF_CPP"* ]]; then
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DFIND_CUDF_CPP=ON"
fi

# Append `-DFIND_CUDF_KAFKA_CPP=ON` to EXTRA_CMAKE_ARGS unless a user specified the option.
if buildAll || hasArg cudf_kafka && [[ "${EXTRA_CMAKE_ARGS}" != *"DFIND_CUDF_KAFKA_CPP"* ]]; then
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DFIND_CUDF_KAFKA_CPP=ON"
fi


# If clean given, run it prior to any other steps
if hasArg clean; then
Expand All @@ -262,7 +257,7 @@ fi
################################################################################
# Configure, build, and install libcudf

if buildAll || hasArg libcudf || hasArg cudf || hasArg cudf_kafka || hasArg cudfjar; then
if buildAll || hasArg libcudf || hasArg cudf || hasArg cudfjar; then
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
CUDF_CMAKE_CUDA_ARCHITECTURES="${CUDF_CMAKE_CUDA_ARCHITECTURES:-NATIVE}"
if [[ "$CUDF_CMAKE_CUDA_ARCHITECTURES" == "NATIVE" ]]; then
Expand Down Expand Up @@ -374,7 +369,7 @@ fi
# build cudf_kafka Python package
if hasArg cudf_kafka; then
cd ${REPODIR}/python/cudf_kafka
SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} -DCMAKE_CUDA_ARCHITECTURES=${CUDF_CMAKE_CUDA_ARCHITECTURES} ${EXTRA_CMAKE_ARGS}" \
SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBCUDF_BUILD_DIR} ${EXTRA_CMAKE_ARGS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL:-1}" \
python -m pip install --no-build-isolation --no-deps .
fi
Expand Down
50 changes: 2 additions & 48 deletions python/cudf_kafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR)
set(cudf_kafka_version 23.12.00)

include(../../fetch_rapids.cmake)
include(rapids-cuda)
rapids_cuda_init_architectures(cudf-kafka-python)

project(
cudf-kafka-python
Expand All @@ -27,59 +25,15 @@ 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 CUDA
C CXX
)

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

option(CUDF_KAFKA_BUILD_WHEELS "Whether this build is generating a Python wheel." OFF)

# If the user requested it we attempt to find cudf_kafka.
if(FIND_CUDF_KAFKA_CPP)
find_package(cudf_kafka ${cudf_kafka_version} REQUIRED)
endif()

if(NOT cudf_kafka_FOUND)
set(BUILD_TESTS OFF)
set(BUILD_BENCHMARKS OFF)
set(_exclude_from_all "")
if(CUDF_KAFKA_BUILD_WHEELS)

# Statically link cudart if building wheels
set(CUDA_STATIC_RUNTIME ON)
set(CUDF_KAFKA_USE_CUDF_STATIC ON)
set(CUDF_KAFKA_EXCLUDE_CUDF_FROM_ALL ON)

# Always build wheels against the pyarrow libarrow.
set(USE_LIBARROW_FROM_PYARROW ON)

# Need to set this so all the nvcomp targets are global, not only nvcomp::nvcomp
# https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_PACKAGE_TARGETS_GLOBAL.html#variable:CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON)

# Don't install the cudf_kafka C++ targets into wheels
set(_exclude_from_all EXCLUDE_FROM_ALL)
endif()

add_subdirectory(../../cpp/libcudf_kafka cudf_kafka-cpp ${_exclude_from_all})

set(cython_lib_dir cudf_kafka)

if(CUDF_KAFKA_BUILD_WHEELS)
include(cmake/Modules/WheelHelpers.cmake)
get_target_property(_nvcomp_link_libs nvcomp::nvcomp INTERFACE_LINK_LIBRARIES)
# Ensure all the shared objects we need at runtime are in the wheel
add_target_libs_to_wheel(
LIB_DIR ${cython_lib_dir} TARGETS arrow_shared nvcomp::nvcomp ${_nvcomp_link_libs}
)
endif()

# Since there are multiple subpackages of cudf_kafka._lib that require access to libcudf_kafka, we
# place the library in the cudf_kafka directory as a single source of truth and modify the other
# rpaths appropriately.
install(TARGETS cudf_kafka DESTINATION ${cython_lib_dir})
message(FATAL_ERROR "cudf_kafka package not found. cudf_kafka C++ is required to build this Python package.")
endif()

include(rapids-cython)
Expand Down
71 changes: 0 additions & 71 deletions python/cudf_kafka/cudf_kafka/cmake/Modules/WheelHelpers.cmake

This file was deleted.

0 comments on commit 27841c7

Please sign in to comment.