From a225ce57dc050f05b75a6efa373eccd5e0bdbd00 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 28 May 2021 12:25:56 -0400 Subject: [PATCH 1/9] RMM now leverages rapids-cmake to reduce CMake boilerplate rapids-cmake provides all the functionality of RMM existing CMake modules. This allow RAPIDS to deploy build-system fixes quickly and across all projects. --- CMakeLists.txt | 161 +++++++++++++---------------- benchmarks/CMakeLists.txt | 10 -- cmake/Modules/CPM.cmake | 21 ---- cmake/Modules/EvalGPUArchs.cmake | 66 ------------ cmake/Modules/RMM_thirdparty.cmake | 33 ------ cmake/Modules/SetGPUArchs.cmake | 55 ---------- cmake/Modules/Version.cmake | 21 ---- cmake/install/FindThrust.cmake | 67 ------------ cmake/rmm-config.cmake.in | 31 ------ cmake/thirdparty/get_gbench.cmake | 33 ++++++ cmake/thirdparty/get_gtest.cmake | 43 ++++++++ cmake/thirdparty/get_spdlog.cmake | 38 +++++++ cmake/thirdparty/get_thrust.cmake | 33 ++++++ cmake/version_config.hpp.in | 20 ---- tests/CMakeLists.txt | 22 ---- 15 files changed, 217 insertions(+), 437 deletions(-) delete mode 100644 cmake/Modules/CPM.cmake delete mode 100644 cmake/Modules/EvalGPUArchs.cmake delete mode 100644 cmake/Modules/RMM_thirdparty.cmake delete mode 100644 cmake/Modules/SetGPUArchs.cmake delete mode 100644 cmake/Modules/Version.cmake delete mode 100644 cmake/install/FindThrust.cmake delete mode 100644 cmake/rmm-config.cmake.in create mode 100644 cmake/thirdparty/get_gbench.cmake create mode 100644 cmake/thirdparty/get_gtest.cmake create mode 100644 cmake/thirdparty/get_spdlog.cmake create mode 100644 cmake/thirdparty/get_thrust.cmake delete mode 100644 cmake/version_config.hpp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e8f47f5a..1380784f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,61 +11,56 @@ # or implied. See the License for the specific language governing permissions and limitations under # the License. # ============================================================================= -cmake_minimum_required(VERSION 3.18...3.18 FATAL_ERROR) - -# If `CMAKE_CUDA_ARCHITECTURES` is not defined, build for all supported architectures. If -# `CMAKE_CUDA_ARCHITECTURES` is set to an empty string (""), build for only the current -# architecture. If `CMAKE_CUDA_ARCHITECTURES` is specified by the user, use user setting. - -# This needs to be run before enabling the CUDA language due to the default initialization behavior -# of `CMAKE_CUDA_ARCHITECTURES`, https://gitlab.kitware.com/cmake/cmake/-/issues/21302 -if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES OR CMAKE_CUDA_ARCHITECTURES STREQUAL "ALL") - set(RMM_BUILD_FOR_ALL_ARCHS TRUE) -elseif(CMAKE_CUDA_ARCHITECTURES STREQUAL "") - set(RMM_BUILD_FOR_DETECTED_ARCHS TRUE) -endif() + +cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR) + +include(FetchContent) +FetchContent_Declare( + rapids-cmake + GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git + GIT_TAG origin/branch-21.08 + ) +FetchContent_MakeAvailable(rapids-cmake) +include(rapids-cmake) +include(rapids-cpm) +include(rapids-export) +include(rapids-find) project( RMM VERSION 21.08.00 LANGUAGES CXX) -include(cmake/Modules/CPM.cmake) -include(cmake/Modules/RMM_thirdparty.cmake) -include(cmake/Modules/Version.cmake) - # Write the version header -write_version() - -# build type +rapids_cmake_write_version_file(include/rmm/version_config.hpp) # Set a default build type if none was specified -set(DEFAULT_BUILD_TYPE "Release") - -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "RMM: Setting build type to '${DEFAULT_BUILD_TYPE}' since none specified.") - set(CMAKE_BUILD_TYPE - "${DEFAULT_BUILD_TYPE}" - CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" - "RelWithDebInfo") -endif() +rapids_cmake_build_type(Release) # build options - option(BUILD_TESTS "Configure CMake to build tests" ON) option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) +set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" + "CRITICAL" "OFF") + +# Set logging level. Must go before including gtests and benchmarks. +# Set the possible values of build type for cmake-gui +message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") # cudart can be statically linked or dynamically linked the python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF) # find packages we depend on - -find_package(CUDAToolkit REQUIRED) +rapids_find_package(CUDAToolkit REQUIRED + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports + ) +rapids_cpm_init() +include(cmake/thirdparty/get_spdlog.cmake) +include(cmake/thirdparty/get_thrust.cmake) # library targets - add_library(rmm INTERFACE) add_library(rmm::rmm ALIAS rmm) @@ -84,87 +79,71 @@ target_link_libraries(rmm INTERFACE spdlog::spdlog_header_only) target_link_libraries(rmm INTERFACE dl) target_compile_features(rmm INTERFACE cxx_std_17 $) -# Set logging level. Must go before including gtests and benchmarks. - -set(RMM_LOGGING_LEVEL - "INFO" - CACHE STRING "Choose the logging level.") -# Set the possible values of build type for cmake-gui -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" - "CRITICAL" "OFF") -message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") if((BUILD_TESTS OR BUILD_BENCHMARKS) AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - # Auto-detect available GPU compute architectures - include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake) - # Enable the CUDA language after setting CMAKE_CUDA_ARCHITECTURES + include(rapids-cuda) + rapids_cuda_init_architectures(RMM) enable_language(CUDA) + + # Since RMM only enables CUDA optionally we need to manually + # include the file that rapids_cuda_init_architectures relies on `project` calling + include("${CMAKE_PROJECT_RMM_INCLUDE}") message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") endif() # optionally build tests - if(BUILD_TESTS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - enable_testing() + include(cmake/thirdparty/get_gtest.cmake) + include(CTest) # calls enable_testing() + add_subdirectory(tests) endif() -# add google benchmark - +# optionally build benchmarks if(BUILD_BENCHMARKS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(cmake/thirdparty/get_gbench.cmake) add_subdirectory(benchmarks) endif() -# install targets - -include(GNUInstallDirs) -set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/rmm) - -install(TARGETS rmm EXPORT rmm-targets) -install(DIRECTORY include/rmm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# install export targets +install(TARGETS rmm EXPORT rmm-exports) +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${RMM_BINARY_DIR}/include/rmm/version_config.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rmm) -include(CMakePackageConfigHelpers) -configure_package_config_file(cmake/rmm-config.cmake.in ${RMM_BINARY_DIR}/cmake/rmm-config.cmake - INSTALL_DESTINATION ${INSTALL_CONFIGDIR}) +set(doc_string +[=[ +Provide targets for RMM: RAPIDS Memory Manager. -write_basic_package_version_file(${RMM_BINARY_DIR}/cmake/rmm-config-version.cmake - COMPATIBILITY SameMinorVersion) +The goal of the [RMM](https://github.com/rapidsai/rmm) is to provide: -install( - EXPORT rmm-targets - FILE rmm-targets.cmake - NAMESPACE rmm:: - DESTINATION ${INSTALL_CONFIGDIR}) - -install( - FILES ${RMM_BINARY_DIR}/cmake/rmm-config.cmake ${RMM_BINARY_DIR}/cmake/rmm-config-version.cmake - ${RMM_SOURCE_DIR}/cmake/install/FindThrust.cmake DESTINATION ${INSTALL_CONFIGDIR}) - -# build export targets - -set(RMM_BUILD_DIR_EXPORT_SETTINGS - "list(PREPEND CMAKE_MODULE_PATH \"${RMM_SOURCE_DIR}/cmake/install/\")") + A common interface that allows customizing device and host memory allocation + A collection of implementations of the interface + A collection of data structures that use the interface for memory allocation +]=]) -configure_package_config_file(cmake/rmm-config.cmake.in ${RMM_BINARY_DIR}/rmm-config.cmake - INSTALL_DESTINATION ${RMM_BINARY_DIR}) +set(code_string +[=[ +thrust_create_target(rmm::Thrust FROM_OPTIONS) +]=]) -write_basic_package_version_file(${RMM_BINARY_DIR}/rmm-config-version.cmake - COMPATIBILITY SameMinorVersion) + rapids_export(INSTALL rmm + EXPORT_SET rmm-exports + GLOBAL_TARGETS rmm + NAMESPACE rmm:: + DOCUMENTATION doc_string + FINAL_CODE_BLOCK code_string) -export( - TARGETS rmm - FILE ${RMM_BINARY_DIR}/rmm-targets.cmake - NAMESPACE rmm::) +# build export targets +rapids_export(BUILD rmm + EXPORT_SET rmm-exports + GLOBAL_TARGETS rmm + NAMESPACE rmm:: + DOCUMENTATION doc_string + FINAL_CODE_BLOCK code_string + ) -if(RMM_EXPORT_SPDLOG) - export( - APPEND - TARGETS spdlog_header_only - FILE ${RMM_BINARY_DIR}/rmm-targets.cmake) -endif() # make documentation diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index c2f862fcb..0c181a0f7 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -12,17 +12,7 @@ # the License. # ============================================================================= -# Fetch Google Benchmark - -CPMFindPackage( - NAME benchmark - GITHUB_REPOSITORY google/benchmark - VERSION 1.5.2 - GIT_SHALLOW TRUE - OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_INSTALL OFF") - # Build options - option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) diff --git a/cmake/Modules/CPM.cmake b/cmake/Modules/CPM.cmake deleted file mode 100644 index 5cee9d614..000000000 --- a/cmake/Modules/CPM.cmake +++ /dev/null @@ -1,21 +0,0 @@ -set(CPM_DOWNLOAD_VERSION 7644c3a40fc7889f8dee53ce21e85dc390b883dc) # v0.32.1 - -if(CPM_SOURCE_CACHE) - # Expand relative path. This is important if the provided path contains a tilde (~) - get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) - set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -elseif(DEFINED ENV{CPM_SOURCE_CACHE}) - set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -else() - set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") -endif() - -if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) - message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") - file( - DOWNLOAD - https://raw.githubusercontent.com/cpm-cmake/CPM.cmake/${CPM_DOWNLOAD_VERSION}/cmake/CPM.cmake - ${CPM_DOWNLOAD_LOCATION}) -endif() - -include(${CPM_DOWNLOAD_LOCATION}) diff --git a/cmake/Modules/EvalGPUArchs.cmake b/cmake/Modules/EvalGPUArchs.cmake deleted file mode 100644 index 2fae79c1c..000000000 --- a/cmake/Modules/EvalGPUArchs.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2019-2021, 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License -# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -# or implied. See the License for the specific language governing permissions and limitations under -# the License. - -# Unset this first in case it's set to -set(CMAKE_CUDA_ARCHITECTURES OFF) - -# Enable CUDA so we can invoke nvcc -enable_language(CUDA) - -# Function uses the CUDA runtime API to query the compute capability of the device, so if a user -# doesn't pass any architecture options to CMake we only build the current architecture -function(evaluate_gpu_archs gpu_archs) - set(eval_file ${PROJECT_BINARY_DIR}/eval_gpu_archs.cu) - set(eval_exe ${PROJECT_BINARY_DIR}/eval_gpu_archs) - set(error_file ${PROJECT_BINARY_DIR}/eval_gpu_archs.stderr.log) - file( - WRITE ${eval_file} - " -#include -#include -#include -using namespace std; -int main(int argc, char** argv) { - set archs; - int nDevices; - if((cudaGetDeviceCount(&nDevices) == cudaSuccess) && (nDevices > 0)) { - for(int dev=0;dev= 1.9.10 included configs. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables: -# ~~~ -# ``Thrust_FOUND`` system has Thrust -# ``Thrust_INCLUDE_DIRS`` the Thrust include directories -# ~~~ - -include(FindPackageHandleStandardArgs) - -# try to find Thrust via installed config first -find_package(Thrust QUIET CONFIG) -if(Thrust_FOUND) - find_package_handle_standard_args(Thrust CONFIG_MODE) - return() -endif() - -cmake_minimum_required(VERSION 3.17..3.18 FATAL_ERROR) - -find_dependency(CUDAToolkit) - -find_path( - Thrust_INCLUDE_DIR - NAMES thrust/version.h - HINTS ${CUDAToolkit_INCLUDE_DIRS}) - -file(READ ${Thrust_INCLUDE_DIR}/thrust/version.h _version_header) -string(REGEX MATCH "#define THRUST_VERSION ([0-9]*)" _match "${_version_header}") -math(EXPR major "${CMAKE_MATCH_1} / 100000") -math(EXPR minor "(${CMAKE_MATCH_1} / 100) % 1000") -math(EXPR subminor "${CMAKE_MATCH_1} % 100") -set(Thrust_VERSION "${major}.${minor}.${subminor}") - -find_package_handle_standard_args( - Thrust - REQUIRED_VARS Thrust_INCLUDE_DIR - VERSION_VAR Thrust_VERSION) - -if(Thrust_FOUND) - set(Thrust_INCLUDE_DIRS "${Thrust_INCLUDE_DIR}") - # Create wrapper function to handle situation where we can't use a regular IMPORTED INTERFACE - # target since that'll use -isystem, leading to the wrong search order with nvcc - function(thrust_create_target tgt) - if(NOT TARGET ${tgt}) - if(NOT TARGET thrust_internal) - add_library(thrust_internal INTERFACE) - set_target_properties(thrust_internal PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${Thrust_INCLUDE_DIRS}") - endif() - add_library(${tgt} ALIAS thrust_internal) - endif() - endfunction() -endif() diff --git a/cmake/rmm-config.cmake.in b/cmake/rmm-config.cmake.in deleted file mode 100644 index dcfa61bc0..000000000 --- a/cmake/rmm-config.cmake.in +++ /dev/null @@ -1,31 +0,0 @@ -@PACKAGE_INIT@ - -cmake_minimum_required(VERSION 3.17) - -@RMM_BUILD_DIR_EXPORT_SETTINGS@ - -# make the bundled find modules in this directory available -list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") - -include(CMakeFindDependencyMacro) - -include("${CMAKE_CURRENT_LIST_DIR}/rmm-targets.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/rmm-config-version.cmake") - -find_dependency(CUDAToolkit) - -if(NOT TARGET rmm::spdlog_header_only) - find_dependency(spdlog @RMM_MIN_VERSION_spdlog@) -endif() - -find_dependency(Thrust @RMM_MIN_VERSION_Thrust@) -thrust_create_target(rmm::Thrust FROM_OPTIONS) - -list(POP_FRONT CMAKE_MODULE_PATH) - -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) diff --git a/cmake/thirdparty/get_gbench.cmake b/cmake/thirdparty/get_gbench.cmake new file mode 100644 index 000000000..10b28cf6e --- /dev/null +++ b/cmake/thirdparty/get_gbench.cmake @@ -0,0 +1,33 @@ +#============================================================================= +# Copyright (c) 2021, 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +function(find_and_configure_gbench VERSION) + + if(TARGET benchmark::benchmark) + return() + endif() + + rapids_cpm_find(benchmark ${VERSION} + CPM_ARGS + GITHUB_REPOSITORY google/benchmark + VERSION ${VERSION} + GIT_SHALLOW TRUE + OPTIONS "BENCHMARK_ENABLE_TESTING OFF" + "BENCHMARK_ENABLE_INSTALL OFF") + +endfunction() + +find_and_configure_gbench(1.5.2) diff --git a/cmake/thirdparty/get_gtest.cmake b/cmake/thirdparty/get_gtest.cmake new file mode 100644 index 000000000..724927290 --- /dev/null +++ b/cmake/thirdparty/get_gtest.cmake @@ -0,0 +1,43 @@ +#============================================================================= +# Copyright (c) 2021, 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +function(find_and_configure_gtest VERSION) + + if(TARGET GTest::gtest) + return() + endif() + + rapids_cpm_find(GTest ${VERSION} + GLOBAL_TARGETS gmock gmock_main gtest gtest_main GTest::gmock GTest::gtest GTest::gtest_main + CPM_ARGS + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-${VERSION} + GIT_SHALLOW TRUE + OPTIONS "INSTALL_GTEST OFF" + # googletest >= 1.10.0 provides a cmake config file -- use it if it exists + FIND_PACKAGE_ARGUMENTS "CONFIG" + ) + + if(NOT TARGET GTest::gtest) + add_library(GTest::gmock ALIAS gmock) + add_library(GTest::gmock_main ALIAS gmock_main) + add_library(GTest::gtest ALIAS gtest) + add_library(GTest::gtest_main ALIAS gtest_main) + endif() + +endfunction() + +find_and_configure_gtest(1.10.0) diff --git a/cmake/thirdparty/get_spdlog.cmake b/cmake/thirdparty/get_spdlog.cmake new file mode 100644 index 000000000..f2fe516bc --- /dev/null +++ b/cmake/thirdparty/get_spdlog.cmake @@ -0,0 +1,38 @@ +#============================================================================= +# Copyright (c) 2021, 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +function(find_and_configure_spdlog VERSION) + + if(TARGET spdlog::spdlog_header_only) + return() + endif() + + rapids_cpm_find(spdlog ${VERSION} + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v${VERSION} + GIT_SHALLOW TRUE + OPTIONS "SPDLOG_INSTALL TRUE" + ) + # spdlog + if(spdlog_ADDED) + install(TARGETS spdlog_header_only EXPORT rmm-exports) + endif() +endfunction() + +find_and_configure_spdlog(1.8.5) diff --git a/cmake/thirdparty/get_thrust.cmake b/cmake/thirdparty/get_thrust.cmake new file mode 100644 index 000000000..7412fded9 --- /dev/null +++ b/cmake/thirdparty/get_thrust.cmake @@ -0,0 +1,33 @@ +#============================================================================= +# Copyright (c) 2021, 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +function(find_and_configure_thrust VERSION) + + rapids_cpm_find(Thrust ${VERSION} + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/NVIDIA/thrust.git + GIT_TAG ${VERSION} + GIT_SHALLOW TRUE + OPTIONS "THRUST_INSTALL TRUE" + ) + + thrust_create_target(rmm::Thrust FROM_OPTIONS) + +endfunction() + +find_and_configure_thrust(1.12.0) diff --git a/cmake/version_config.hpp.in b/cmake/version_config.hpp.in deleted file mode 100644 index 98c324bf9..000000000 --- a/cmake/version_config.hpp.in +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021, 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#define RMM_VERSION_MAJOR @RMM_VERSION_MAJOR_CPP_HEADER@ -#define RMM_VERSION_MINOR @RMM_VERSION_MINOR_CPP_HEADER@ -#define RMM_VERSION_PATCH @RMM_VERSION_PATCH_CPP_HEADER@ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f4f993be6..3ac50e458 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,29 +12,7 @@ # the License. # ============================================================================= -include(CTest) - -# Fetch GTest - -CPMFindPackage( - NAME GTest - GITHUB_REPOSITORY google/googletest - GIT_TAG release-1.10.0 - VERSION 1.10.0 - GIT_SHALLOW TRUE - OPTIONS "INSTALL_GTEST OFF" - # googletest >= 1.10.0 provides a cmake config file -- use it if it exists - FIND_PACKAGE_ARGUMENTS "CONFIG") - -if(GTest_ADDED) - add_library(GTest::gtest ALIAS gtest) - add_library(GTest::gmock ALIAS gmock) - add_library(GTest::gtest_main ALIAS gtest_main) - add_library(GTest::gmock_main ALIAS gmock_main) -endif() - # Build options - option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # compiler function From 1cea9ce30e4284330f23058bdd0e3f08bd0fcfae Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 9 Jun 2021 13:19:59 -0400 Subject: [PATCH 2/9] RMM cmake-format checks are now aware of rapids_cmake commands --- ci/checks/style.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 754c6ccfc..0bb5316b4 100644 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -43,9 +43,14 @@ CMAKE_FORMAT_RETVAL=0 CMAKE_LINTS=() CMAKE_LINT_RETVAL=0 +CURRENT_TAG=$(git tag --merged HEAD | grep -xE '^v.*' | sort --version-sort | tail -n 1 | tr -d 'v') +CURRENT_MAJOR=$(echo $CURRENT_TAG | awk '{split($0, a, "."); print a[1]}') +CURRENT_MINOR=$(echo $CURRENT_TAG | awk '{split($0, a, "."); print a[2]}') +CURRENT_SHORT_TAG=${CURRENT_MAJOR}.${CURRENT_MINOR} +gpuci_retry curl -s https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${CURRENT_SHORT_TAG}/cmake-format-rapids-cmake.json -o cmake/rapids-cmake.json for cmake_file in "${CMAKE_FILES[@]}"; do - cmake-format --in-place --config-files cmake/config.json -- ${cmake_file} + cmake-format --in-place --config-files cmake/config.json cmake/rapids-cmake.json -- ${cmake_file} TMP_CMAKE_FORMAT=`git diff --color --exit-code -- ${cmake_file}` TMP_CMAKE_FORMAT_RETVAL=$? if [ "$TMP_CMAKE_FORMAT_RETVAL" != "0" ]; then @@ -53,7 +58,7 @@ for cmake_file in "${CMAKE_FILES[@]}"; do CMAKE_FORMATS+=("$TMP_CMAKE_FORMAT") fi - TMP_CMAKE_LINT=`cmake-lint --config-files cmake/config.json -- ${cmake_file}` + TMP_CMAKE_LINT=`cmake-lint --config-files cmake/config.json cmake/rapids-cmake.json -- ${cmake_file}` TMP_CMAKE_LINT_RETVAL=$? if [ "$TMP_CMAKE_LINT_RETVAL" != "0" ]; then CMAKE_LINT_RETVAL=1 From 5bb05a87f66a176cd4d7344e9c09941227f7bfd8 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 11:01:24 -0400 Subject: [PATCH 3/9] Update CMake code to pass format and lint checks --- CMakeLists.txt | 39 ++++---- cmake/rapids-cmake.json | 154 ++++++++++++++++++++++++++++++ cmake/thirdparty/get_gbench.cmake | 39 ++++---- cmake/thirdparty/get_gtest.cmake | 58 +++++------ cmake/thirdparty/get_spdlog.cmake | 53 +++++----- cmake/thirdparty/get_thrust.cmake | 41 ++++---- 6 files changed, 266 insertions(+), 118 deletions(-) create mode 100644 cmake/rapids-cmake.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 1380784f8..b8df74e30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,7 @@ include(FetchContent) FetchContent_Declare( rapids-cmake GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git - GIT_TAG origin/branch-21.08 - ) + GIT_TAG origin/branch-21.08) FetchContent_MakeAvailable(rapids-cmake) include(rapids-cmake) include(rapids-cpm) @@ -40,22 +39,24 @@ rapids_cmake_build_type(Release) # build options option(BUILD_TESTS "Configure CMake to build tests" ON) option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) -set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") +set(RMM_LOGGING_LEVEL + "INFO" + CACHE STRING "Choose the logging level.") set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") -# Set logging level. Must go before including gtests and benchmarks. -# Set the possible values of build type for cmake-gui +# Set logging level. Must go before including gtests and benchmarks. Set the possible values of +# build type for cmake-gui message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'") # cudart can be statically linked or dynamically linked the python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF) # find packages we depend on -rapids_find_package(CUDAToolkit REQUIRED - BUILD_EXPORT_SET rmm-exports - INSTALL_EXPORT_SET rmm-exports - ) +rapids_find_package( + CUDAToolkit REQUIRED + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports) rapids_cpm_init() include(cmake/thirdparty/get_spdlog.cmake) include(cmake/thirdparty/get_thrust.cmake) @@ -79,14 +80,13 @@ target_link_libraries(rmm INTERFACE spdlog::spdlog_header_only) target_link_libraries(rmm INTERFACE dl) target_compile_features(rmm INTERFACE cxx_std_17 $) - if((BUILD_TESTS OR BUILD_BENCHMARKS) AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) include(rapids-cuda) rapids_cuda_init_architectures(RMM) enable_language(CUDA) - # Since RMM only enables CUDA optionally we need to manually - # include the file that rapids_cuda_init_architectures relies on `project` calling + # Since RMM only enables CUDA optionally we need to manually include the file that + # rapids_cuda_init_architectures relies on `project` calling include("${CMAKE_PROJECT_RMM_INCLUDE}") message(STATUS "RMM: Building benchmarks with GPU Architectures: ${CMAKE_CUDA_ARCHITECTURES}") endif() @@ -105,7 +105,6 @@ if(BUILD_BENCHMARKS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) add_subdirectory(benchmarks) endif() - # install export targets install(TARGETS rmm EXPORT rmm-exports) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) @@ -113,7 +112,7 @@ install(FILES ${RMM_BINARY_DIR}/include/rmm/version_config.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rmm) set(doc_string -[=[ + [=[ Provide targets for RMM: RAPIDS Memory Manager. The goal of the [RMM](https://github.com/rapidsai/rmm) is to provide: @@ -124,11 +123,12 @@ The goal of the [RMM](https://github.com/rapidsai/rmm) is to provide: ]=]) set(code_string -[=[ + [=[ thrust_create_target(rmm::Thrust FROM_OPTIONS) ]=]) - rapids_export(INSTALL rmm +rapids_export( + INSTALL rmm EXPORT_SET rmm-exports GLOBAL_TARGETS rmm NAMESPACE rmm:: @@ -136,14 +136,13 @@ thrust_create_target(rmm::Thrust FROM_OPTIONS) FINAL_CODE_BLOCK code_string) # build export targets -rapids_export(BUILD rmm +rapids_export( + BUILD rmm EXPORT_SET rmm-exports GLOBAL_TARGETS rmm NAMESPACE rmm:: DOCUMENTATION doc_string - FINAL_CODE_BLOCK code_string - ) - + FINAL_CODE_BLOCK code_string) # make documentation diff --git a/cmake/rapids-cmake.json b/cmake/rapids-cmake.json new file mode 100644 index 000000000..8f200a194 --- /dev/null +++ b/cmake/rapids-cmake.json @@ -0,0 +1,154 @@ +{ + "parse": { + "additional_commands": { + + "rapids_cmake_build_type": { + "pargs": { + "nargs": 1 + } + }, + "rapids_cmake_make_global": { + "pargs": { + "nargs": 1 + } + }, + "rapids_cmake_parse_version": { + "pargs": { + "nargs": 3 + } + }, + "rapids_cmake_support_conda_env": { + "pargs": { + "nargs": 1 + } + }, + "rapids_cmake_write_version_file": { + "pargs": { + "nargs": 1 + } + }, + + "rapids_cpm_find": { + "pargs": { + "nargs": "2+" + }, + "kwargs": { + "BUILD_EXPORT_SET": 1, + "INSTALL_EXPORT_SET": 1, + "GLOBAL_TARGETS": "+", + "CPM_ARGS": "+", + "GIT_REPOSITORY": "1", + "GIT_TAG": "1", + "GIT_SHALLOW": "1", + "OPTIONS": "+" + } + }, + "rapids_cpm_init": { + "pargs": { + "nargs": 0 + } + }, + + "rapids_cuda_init_architectures": { + "pargs": { + "nargs": 1 + } + }, + "rapids_cuda_init_runtime": { + "pargs": { + "nargs": 2 + } + }, + "rapids_cuda_set_architectures": { + "pargs": { + "nargs": 1 + } + }, + + "rapids_export_cpm": { + "pargs": { + "nargs": "3+", + "flags": ["INSTALL", "BUILD"] + }, + "kwargs": { + "GLOBAL_TARGETS": "+", + "CPM_ARGS": "+" + } + }, + "rapids_export": { + "pargs": { + "nargs": "2+", + "flags": ["INSTALL", "BUILD"] + }, + "kwargs": { + "EXPORT_SET": 1, + "NAMESPACE": 1, + "DOCUMENTATION": 1, + "FINAL_CODE_BLOCK": 1, + "GLOBAL_TARGETS": "+", + "LANGUAGES": "+" + } + }, + "rapids_export_find_package_file": { + "pargs": { + "nargs": 3, + "flags": ["INSTALL", "BUILD"] + } + }, + "rapids_export_package": { + "pargs": { + "nargs": "1+" + }, + "kwargs": { + "GLOBAL_TARGETS": "+", + "INSTALL": 2, + "BUILD": 2 + } + }, + "rapids_export_write_dependencies": { + "pargs": { + "nargs": 3, + "flags": ["INSTALL", "BUILD"] + } + }, + "rapids_export_write_language": { + "pargs": { + "nargs": 3, + "flags": ["INSTALL", "BUILD"] + } + }, + + "rapids_find_generate_module": { + "pargs": { + "nargs": "1+", + "flags": [ + "NO_CONFIG" + ] + }, + "kwargs": { + "VERSION": 1, + "BUILD_EXPORT_SET": 1, + "INSTALL_EXPORT_SET": 1, + "HEADER_NAMES": "+", + "LIBRARY_NAMES": "+", + "INCLUDE_SUFFIXES": "+" + } + }, + "rapids_find_package": { + "pargs": { + "nargs": "1+", + "flags": [ + "REQUIRED" + ] + }, + "kwargs": { + "BUILD_EXPORT_SET": 1, + "INSTALL_EXPORT_SET": 1, + "GLOBAL_TARGETS": "+", + "FIND_ARGS": "+" + } + } + + } + } +} diff --git a/cmake/thirdparty/get_gbench.cmake b/cmake/thirdparty/get_gbench.cmake index 10b28cf6e..16286edf6 100644 --- a/cmake/thirdparty/get_gbench.cmake +++ b/cmake/thirdparty/get_gbench.cmake @@ -1,32 +1,29 @@ -#============================================================================= +# ============================================================================= # Copyright (c) 2021, 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 +# 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 # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= +# Use CPM to find or clone gbench function(find_and_configure_gbench VERSION) - if(TARGET benchmark::benchmark) - return() - endif() + if(TARGET benchmark::benchmark) + return() + endif() - rapids_cpm_find(benchmark ${VERSION} - CPM_ARGS - GITHUB_REPOSITORY google/benchmark - VERSION ${VERSION} - GIT_SHALLOW TRUE - OPTIONS "BENCHMARK_ENABLE_TESTING OFF" - "BENCHMARK_ENABLE_INSTALL OFF") + rapids_cpm_find( + benchmark ${VERSION} + CPM_ARGS GITHUB_REPOSITORY google/benchmark VERSION ${VERSION} + GIT_SHALLOW TRUE + OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_INSTALL OFF") endfunction() diff --git a/cmake/thirdparty/get_gtest.cmake b/cmake/thirdparty/get_gtest.cmake index 724927290..0b9287734 100644 --- a/cmake/thirdparty/get_gtest.cmake +++ b/cmake/thirdparty/get_gtest.cmake @@ -1,42 +1,42 @@ -#============================================================================= +# ============================================================================= # Copyright (c) 2021, 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 +# 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 # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= +# Use CPM to find or clone gtest function(find_and_configure_gtest VERSION) - if(TARGET GTest::gtest) - return() - endif() + if(TARGET GTest::gtest) + return() + endif() - rapids_cpm_find(GTest ${VERSION} - GLOBAL_TARGETS gmock gmock_main gtest gtest_main GTest::gmock GTest::gtest GTest::gtest_main - CPM_ARGS - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-${VERSION} - GIT_SHALLOW TRUE - OPTIONS "INSTALL_GTEST OFF" + rapids_cpm_find( + GTest ${VERSION} + GLOBAL_TARGETS gmock gmock_main gtest gtest_main GTest::gmock GTest::gtest GTest::gtest_main + CPM_ARGS + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-${VERSION} + GIT_SHALLOW TRUE + OPTIONS "INSTALL_GTEST OFF" # googletest >= 1.10.0 provides a cmake config file -- use it if it exists - FIND_PACKAGE_ARGUMENTS "CONFIG" - ) + FIND_PACKAGE_ARGUMENTS + "CONFIG") - if(NOT TARGET GTest::gtest) - add_library(GTest::gmock ALIAS gmock) - add_library(GTest::gmock_main ALIAS gmock_main) - add_library(GTest::gtest ALIAS gtest) - add_library(GTest::gtest_main ALIAS gtest_main) - endif() + if(NOT TARGET GTest::gtest) + add_library(GTest::gmock ALIAS gmock) + add_library(GTest::gmock_main ALIAS gmock_main) + add_library(GTest::gtest ALIAS gtest) + add_library(GTest::gtest_main ALIAS gtest_main) + endif() endfunction() diff --git a/cmake/thirdparty/get_spdlog.cmake b/cmake/thirdparty/get_spdlog.cmake index f2fe516bc..954512b06 100644 --- a/cmake/thirdparty/get_spdlog.cmake +++ b/cmake/thirdparty/get_spdlog.cmake @@ -1,38 +1,37 @@ -#============================================================================= +# ============================================================================= # Copyright (c) 2021, 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 +# 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 # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= +# Use CPM to find or clone speedlog function(find_and_configure_spdlog VERSION) - if(TARGET spdlog::spdlog_header_only) - return() - endif() + if(TARGET spdlog::spdlog_header_only) + return() + endif() - rapids_cpm_find(spdlog ${VERSION} - BUILD_EXPORT_SET rmm-exports - INSTALL_EXPORT_SET rmm-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/gabime/spdlog.git - GIT_TAG v${VERSION} - GIT_SHALLOW TRUE - OPTIONS "SPDLOG_INSTALL TRUE" - ) - # spdlog - if(spdlog_ADDED) - install(TARGETS spdlog_header_only EXPORT rmm-exports) - endif() + rapids_cpm_find( + spdlog ${VERSION} + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v${VERSION} + GIT_SHALLOW TRUE + OPTIONS "SPDLOG_INSTALL TRUE") + # spdlog + if(spdlog_ADDED) + install(TARGETS spdlog_header_only EXPORT rmm-exports) + endif() endfunction() find_and_configure_spdlog(1.8.5) diff --git a/cmake/thirdparty/get_thrust.cmake b/cmake/thirdparty/get_thrust.cmake index 7412fded9..19013c2b8 100644 --- a/cmake/thirdparty/get_thrust.cmake +++ b/cmake/thirdparty/get_thrust.cmake @@ -1,32 +1,31 @@ -#============================================================================= +# ============================================================================= # Copyright (c) 2021, 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 +# 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 # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# ============================================================================= +# Use CPM to find or clone thrust function(find_and_configure_thrust VERSION) - rapids_cpm_find(Thrust ${VERSION} - BUILD_EXPORT_SET rmm-exports - INSTALL_EXPORT_SET rmm-exports - CPM_ARGS - GIT_REPOSITORY https://github.com/NVIDIA/thrust.git - GIT_TAG ${VERSION} - GIT_SHALLOW TRUE - OPTIONS "THRUST_INSTALL TRUE" - ) + rapids_cpm_find( + Thrust ${VERSION} + BUILD_EXPORT_SET rmm-exports + INSTALL_EXPORT_SET rmm-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/NVIDIA/thrust.git + GIT_TAG ${VERSION} + GIT_SHALLOW TRUE + OPTIONS "THRUST_INSTALL TRUE") - thrust_create_target(rmm::Thrust FROM_OPTIONS) + thrust_create_target(rmm::Thrust FROM_OPTIONS) endfunction() From 9053885dea384877fdf2cecd84737ea1e9235462 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 12:46:31 -0400 Subject: [PATCH 4/9] Update CMake minimum required in conda recipes --- conda/environments/rmm_dev_cuda10.1.yml | 2 +- conda/environments/rmm_dev_cuda10.2.yml | 2 +- conda/environments/rmm_dev_cuda11.0.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conda/environments/rmm_dev_cuda10.1.yml b/conda/environments/rmm_dev_cuda10.1.yml index 455fa7239..dc5dccc0f 100644 --- a/conda/environments/rmm_dev_cuda10.1.yml +++ b/conda/environments/rmm_dev_cuda10.1.yml @@ -5,7 +5,7 @@ channels: dependencies: - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 - black=19.10 diff --git a/conda/environments/rmm_dev_cuda10.2.yml b/conda/environments/rmm_dev_cuda10.2.yml index 916892680..ff647d024 100644 --- a/conda/environments/rmm_dev_cuda10.2.yml +++ b/conda/environments/rmm_dev_cuda10.2.yml @@ -5,7 +5,7 @@ channels: dependencies: - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 - black=19.10 diff --git a/conda/environments/rmm_dev_cuda11.0.yml b/conda/environments/rmm_dev_cuda11.0.yml index f3e174d5d..0d2dfaf92 100644 --- a/conda/environments/rmm_dev_cuda11.0.yml +++ b/conda/environments/rmm_dev_cuda11.0.yml @@ -5,7 +5,7 @@ channels: dependencies: - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 - black=19.10 From 1de7a323ed7c4d7b362e7162a8b68a52c954ee9a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 12:46:31 -0400 Subject: [PATCH 5/9] Update CMake minimum required in conda recipes --- conda/recipes/librmm/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/librmm/meta.yaml b/conda/recipes/librmm/meta.yaml index ad93cdad4..80ed6a354 100644 --- a/conda/recipes/librmm/meta.yaml +++ b/conda/recipes/librmm/meta.yaml @@ -30,7 +30,7 @@ build: requirements: build: - - cmake >=3.18 + - cmake >=3.20.1 host: - cudatoolkit {{ cuda_version }}.* run: From 1ff68a35f3d17ac529c29dd1347373fdc4b5bf7b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 12:49:37 -0400 Subject: [PATCH 6/9] Update README with new minimum required CMake version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 586529711..fef2fe4e6 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Compiler requirements: * `gcc` version 9.3+ * `nvcc` version 11.0+ -* `cmake` version 3.18+ +* `cmake` version 3.20.1+ CUDA/GPU requirements: From 1d255624d4b5493f88f96862473d4b79bea4d2e7 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 13:08:15 -0400 Subject: [PATCH 7/9] Correct install rules to not attempt to change the 'include' directory permissions --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8df74e30..c8b569152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,9 +107,9 @@ endif() # install export targets install(TARGETS rmm EXPORT rmm-exports) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY include/rmm/ DESTINATION include/rmm) install(FILES ${RMM_BINARY_DIR}/include/rmm/version_config.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rmm) + DESTINATION include/rmm) set(doc_string [=[ From ca7f32795f4212f3102e1605b403da3dc794e71b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 10 Jun 2021 13:12:43 -0400 Subject: [PATCH 8/9] More style updates required by cmake-lint --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b569152..b24fec846 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,8 +108,7 @@ endif() # install export targets install(TARGETS rmm EXPORT rmm-exports) install(DIRECTORY include/rmm/ DESTINATION include/rmm) -install(FILES ${RMM_BINARY_DIR}/include/rmm/version_config.hpp - DESTINATION include/rmm) +install(FILES ${RMM_BINARY_DIR}/include/rmm/version_config.hpp DESTINATION include/rmm) set(doc_string [=[ From 59ac16c55fb03e945024b0a0e11fae2e76349b4b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 15 Jun 2021 08:50:26 -0400 Subject: [PATCH 9/9] remove unneeded rapids-cmake.json file The file should always be downloaded by CI to get the latest API changes. --- cmake/rapids-cmake.json | 154 ---------------------------------------- 1 file changed, 154 deletions(-) delete mode 100644 cmake/rapids-cmake.json diff --git a/cmake/rapids-cmake.json b/cmake/rapids-cmake.json deleted file mode 100644 index 8f200a194..000000000 --- a/cmake/rapids-cmake.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "parse": { - "additional_commands": { - - "rapids_cmake_build_type": { - "pargs": { - "nargs": 1 - } - }, - "rapids_cmake_make_global": { - "pargs": { - "nargs": 1 - } - }, - "rapids_cmake_parse_version": { - "pargs": { - "nargs": 3 - } - }, - "rapids_cmake_support_conda_env": { - "pargs": { - "nargs": 1 - } - }, - "rapids_cmake_write_version_file": { - "pargs": { - "nargs": 1 - } - }, - - "rapids_cpm_find": { - "pargs": { - "nargs": "2+" - }, - "kwargs": { - "BUILD_EXPORT_SET": 1, - "INSTALL_EXPORT_SET": 1, - "GLOBAL_TARGETS": "+", - "CPM_ARGS": "+", - "GIT_REPOSITORY": "1", - "GIT_TAG": "1", - "GIT_SHALLOW": "1", - "OPTIONS": "+" - } - }, - "rapids_cpm_init": { - "pargs": { - "nargs": 0 - } - }, - - "rapids_cuda_init_architectures": { - "pargs": { - "nargs": 1 - } - }, - "rapids_cuda_init_runtime": { - "pargs": { - "nargs": 2 - } - }, - "rapids_cuda_set_architectures": { - "pargs": { - "nargs": 1 - } - }, - - "rapids_export_cpm": { - "pargs": { - "nargs": "3+", - "flags": ["INSTALL", "BUILD"] - }, - "kwargs": { - "GLOBAL_TARGETS": "+", - "CPM_ARGS": "+" - } - }, - "rapids_export": { - "pargs": { - "nargs": "2+", - "flags": ["INSTALL", "BUILD"] - }, - "kwargs": { - "EXPORT_SET": 1, - "NAMESPACE": 1, - "DOCUMENTATION": 1, - "FINAL_CODE_BLOCK": 1, - "GLOBAL_TARGETS": "+", - "LANGUAGES": "+" - } - }, - "rapids_export_find_package_file": { - "pargs": { - "nargs": 3, - "flags": ["INSTALL", "BUILD"] - } - }, - "rapids_export_package": { - "pargs": { - "nargs": "1+" - }, - "kwargs": { - "GLOBAL_TARGETS": "+", - "INSTALL": 2, - "BUILD": 2 - } - }, - "rapids_export_write_dependencies": { - "pargs": { - "nargs": 3, - "flags": ["INSTALL", "BUILD"] - } - }, - "rapids_export_write_language": { - "pargs": { - "nargs": 3, - "flags": ["INSTALL", "BUILD"] - } - }, - - "rapids_find_generate_module": { - "pargs": { - "nargs": "1+", - "flags": [ - "NO_CONFIG" - ] - }, - "kwargs": { - "VERSION": 1, - "BUILD_EXPORT_SET": 1, - "INSTALL_EXPORT_SET": 1, - "HEADER_NAMES": "+", - "LIBRARY_NAMES": "+", - "INCLUDE_SUFFIXES": "+" - } - }, - "rapids_find_package": { - "pargs": { - "nargs": "1+", - "flags": [ - "REQUIRED" - ] - }, - "kwargs": { - "BUILD_EXPORT_SET": 1, - "INSTALL_EXPORT_SET": 1, - "GLOBAL_TARGETS": "+", - "FIND_ARGS": "+" - } - } - - } - } -}