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

Only install thrust when using a non 'system' version #9206

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions cpp/cmake/thirdparty/get_thrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ function(find_and_configure_thrust VERSION)
set(cpm_thrust_disconnect_update "")
endif()

# We currently require cuDF to always build with a custom
# version of thrust. This is needed so that build times of
# of cudf are kept reasonable, without this CI builds
# of cudf will be killed as some source file can take
# over 45 minutes to build
#
set(CPM_DOWNLOAD_ALL TRUE)
rapids_cpm_find(
Thrust ${VERSION}
BUILD_EXPORT_SET cudf-exports
Expand All @@ -40,26 +47,28 @@ function(find_and_configure_thrust VERSION)
thrust_create_target(cudf::Thrust FROM_OPTIONS)
endif()

include(GNUInstallDirs)
install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.inl")
install(DIRECTORY "${Thrust_SOURCE_DIR}/dependencies/cub/cub"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/dependencies/"
FILES_MATCHING
PATTERN "*.cuh")
if(Thrust_SOURCE_DIR) # only install thrust when we have an in-source version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive me for being ignorant, but shouldn't all this stuff be encapsulated in Thrust's cmake target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since cudf patches Thrust and therefore it isn't identical to the upstream version we wanted to ensure that won't be used by other projects accidentally. To do this we install Thrust inside of cudfs include directory.

Once we upstream the cudf patches of Thrust we can remove all of this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know Thrust has some machinery for injecting a custom namespace to ensure our custom thrust doesn't conflict with other versions. Do you think that's relevant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Namespacing would solve an issue if downstream consumers of cudf need to also bring in a non-patched version of Thrust into a library calling cudf. I/we should sync with the thrust team, it might be best for cudf to always namespace our thrust inclusion going forward.

I would prefer to not use this PR to hash out the larger cudf/thrust issue as this resolves our currently broken CI pipelines.

include(GNUInstallDirs)
install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.inl")
install(DIRECTORY "${Thrust_SOURCE_DIR}/dependencies/cub/cub"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/dependencies/"
FILES_MATCHING
PATTERN "*.cuh")

install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust/cmake"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/thrust/")
install(DIRECTORY "${Thrust_SOURCE_DIR}/dependencies/cub/cub/cmake"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/dependencies/cub/")
install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust/cmake"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/thrust/")
install(DIRECTORY "${Thrust_SOURCE_DIR}/dependencies/cub/cub/cmake"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcudf/Thrust/dependencies/cub/")


# Store where CMake can find our custom Thrust install
include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(INSTALL Thrust [=[${CMAKE_CURRENT_LIST_DIR}/../../../include/libcudf/Thrust/]=] cudf-exports)
# Store where CMake can find our custom Thrust install
include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(INSTALL Thrust [=[${CMAKE_CURRENT_LIST_DIR}/../../../include/libcudf/Thrust/]=] cudf-exports)
endif()
endfunction()

set(CUDF_MIN_VERSION_Thrust 1.12.0)
Expand Down