-
Notifications
You must be signed in to change notification settings - Fork 200
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
[REVIEW] install cmake config file with RMM #580
Merged
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
eca2d0a
cmake: use GNUInstallDirs
germasch df94e2a
cmake: create and install cmake package configuration
germasch 6f009b4
changelog
germasch 7f62db5
Merge branch 'branch-0.16' into pr/cmake-install
germasch 521ef15
cmake: provide the `rmm::rmm` alias when used via add_subdirectory()
germasch 7d7a77e
Use RMM_BINARY_DIR
germasch 216af8c
cmake: add docs
germasch 99a97a1
Merge branch 'branch-0.16' into pr/cmake-install
germasch 3df4ebb
Apply suggestions from code review
germasch e029feb
cmake: add dependency on Thrust to installed config
germasch cd86dbf
cmake: work around case where Thrust >= 1.10.0 cannot be found
germasch f034295
cmake: mv rmm-config.cmake.in into cmake/ subdir
germasch e15b3ab
cmake: add FindThrust.cmake find module
germasch 511c56b
cmake: fix Thrust version parsing
germasch badd972
cmake: prefer config mode for Thrust, but try module mode next
germasch 4a31162
cmake: use variables to set minimum thirdpart versions
germasch c63ec67
cmake: remove `USE_NVTX` option
germasch ffff675
cmake: copy full license into FindThrust.cmake
germasch c8cec44
cmake: let's do our own custom FindThrust.cmake
germasch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
##============================================================================ | ||
## Copyright (c) Kitware, Inc. | ||
## All rights reserved. | ||
## See LICENSE.txt for details. | ||
## This software is distributed WITHOUT ANY WARRANTY; without even | ||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
## PURPOSE. See the above copyright notice for more information. | ||
## | ||
## Copyright 2014 Sandia Corporation. | ||
## Copyright 2014 UT-Battelle, LLC. | ||
## Copyright 2014 Los Alamos National Security. | ||
## | ||
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
## the U.S. Government retains certain rights in this software. | ||
## | ||
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National | ||
## Laboratory (LANL), the U.S. Government retains certain rights in | ||
## this software. | ||
##============================================================================ | ||
|
||
# | ||
# FindThrust | ||
# | ||
# This module finds the Thrust header files and extrats their version. It | ||
# sets the following variables. | ||
# | ||
# THRUST_INCLUDE_DIR - Include directory for thrust header files. (All header | ||
# files will actually be in the thrust subdirectory.) | ||
# THRUST_VERSION - Version of thrust in the form "major.minor.patch". | ||
# | ||
|
||
find_path( THRUST_INCLUDE_DIR | ||
HINTS | ||
/usr/include/cuda | ||
/usr/local/include | ||
/usr/local/cuda/include | ||
${CUDA_INCLUDE_DIRS} | ||
${CUDA_TOOLKIT_ROOT_DIR} | ||
${CUDA_SDK_ROOT_DIR} | ||
NAMES thrust/version.h | ||
DOC "Thrust headers" | ||
) | ||
if( THRUST_INCLUDE_DIR ) | ||
list( REMOVE_DUPLICATES THRUST_INCLUDE_DIR ) | ||
endif( THRUST_INCLUDE_DIR ) | ||
|
||
# Find thrust version | ||
if (THRUST_INCLUDE_DIR) | ||
file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h | ||
version | ||
REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)" | ||
) | ||
string( REGEX REPLACE | ||
"#define THRUST_VERSION[ \t]+" | ||
"" | ||
version | ||
"${version}" | ||
) | ||
|
||
math(EXPR major "${version} / 100000") | ||
math(EXPR minor "(${version} / 100) % 1000") | ||
math(EXPR version "${version} % 100") | ||
set( THRUST_VERSION "${major}.${minor}.${version}") | ||
set( THRUST_MAJOR_VERSION "${major}") | ||
set( THRUST_MINOR_VERSION "${minor}") | ||
endif() | ||
|
||
# Check for required components | ||
include( FindPackageHandleStandardArgs ) | ||
find_package_handle_standard_args( Thrust | ||
REQUIRED_VARS THRUST_INCLUDE_DIR | ||
VERSION_VAR THRUST_VERSION | ||
) | ||
|
||
set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR}) | ||
mark_as_advanced(THRUST_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
@PACKAGE_INIT@ | ||
|
||
cmake_minimum_required(VERSION 3.17) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(CUDAToolkit) | ||
find_dependency(spdlog @RMM_MIN_VERSION_spdlog@) | ||
|
||
# Try to find newer Thrust via config first | ||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) | ||
set(_save_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) | ||
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}") | ||
|
||
find_dependency(Thrust @RMM_MIN_VERSION_Thrust@) | ||
|
||
set(CMAKE_MODULE_PATH ${_save_CMAKE_MODULE_PATH}) | ||
|
||
if (Thrust_CONFIG) | ||
# we can use the new way of creating a target | ||
thrust_create_target(rmm::Thrust FROM_OPTIONS) | ||
else() | ||
# otherwise we have to do it ourselves | ||
if (NOT TARGET Thrust) | ||
add_library(Thrust INTERFACE) | ||
set_target_properties(Thrust PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${THRUST_INCLUDE_DIR}") | ||
endif() | ||
add_library(rmm::Thrust ALIAS Thrust) | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/rmm-targets.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/rmm-config-version.cmake") | ||
|
||
check_required_components(rmm) | ||
|
||
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the license for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a good point. I guess it's this: https://gitlab.kitware.com/vtk/vtk-m/-/blob/783867eeb05e0a6538f9c520af02c3615651b4ed/LICENSE.txt. It does say
So it seems pretty permissive, but IANAL.
I can write a custom one from scratch if this causes issues. Chances are it would look very similar, though, since really, the only thing that is not boilerplate in there is the version parsing, and that comes from Nvidia.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the BSD 3-clause license plus extra non-exclusive licenses from US govt labs and extra copyrights. That is one of the licenses we can easily use. We still have a process we need to follow to add a new piece of software. I will check if RAPIDS already has done this for CMake code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we have approval, but before we can merge we need the complete license for this file included (ideally in this file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so I copied in the full text from the LICENSE.txt above.