Skip to content

Commit

Permalink
Ensure dlpack include is provided to cudf interop lib (#12139)
Browse files Browse the repository at this point in the history
As brought up in #12081 it is possible to have python build failures due to no include paths to dlpack being provided. This fixes the issue by ensure that the DLPACK_INCLUDE_DIR is propagated down to the interop target.

We don't run into this issue with conda, since the dlpack headers are inside the conda include dir which is already being provided to the compiler.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #12139
  • Loading branch information
robertmaynard authored Nov 17, 2022
1 parent 2f2685f commit db0d045
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/cmake/thirdparty/get_dlpack.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
# Copyright (c) 2020-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
Expand All @@ -15,6 +15,7 @@
# This function finds dlpack and sets any additional necessary environment variables.
function(find_and_configure_dlpack VERSION)

include(${rapids-cmake-dir}/find/generate_module.cmake)
rapids_find_generate_module(DLPACK HEADER_NAMES dlpack.h)

rapids_cpm_find(
Expand Down
6 changes: 6 additions & 0 deletions python/cudf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ if(FIND_CUDF_CPP)
endif()

find_package(cudf ${cudf_version} REQUIRED)

# an installed version of libcudf doesn't provide the dlpack headers so we need to download dlpack
# for the interop.pyx
include(rapids-cpm)
rapids_cpm_init()
include(../../cpp/cmake/thirdparty/get_dlpack.cmake)
else()
set(cudf_FOUND OFF)
endif()
Expand Down
5 changes: 5 additions & 0 deletions python/cudf/cudf/_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ foreach(target IN LISTS targets_using_numpy)
target_include_directories(${target} PRIVATE "${Python_NumPy_INCLUDE_DIRS}")
endforeach()

set(targets_using_dlpack interop)
foreach(target IN LISTS targets_using_dlpack)
target_include_directories(${target} PRIVATE "${DLPACK_INCLUDE_DIR}")
endforeach()

add_subdirectory(io)
add_subdirectory(nvtext)
add_subdirectory(strings)

0 comments on commit db0d045

Please sign in to comment.