Skip to content

Commit

Permalink
Merge branch 'branch-24.08' into test-nvcomp-4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard authored Jul 19, 2024
2 parents 16b2224 + f09cc77 commit 2232d5a
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 102 deletions.
5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

#cmake code owners
**/CMakeLists.txt @rapidsai/rapids-cmake-codeowners
*.cmake @rapidsai/rapids-cmake-codeowners
/docs/ @rapidsai/rapids-cmake-codeowners
/example/ @rapidsai/rapids-cmake-codeowners
/rapids-cmake/ @rapidsai/rapids-cmake-codeowners
/testing/ @rapidsai/rapids-cmake-codeowners

#CI code owners
/.github/ @rapidsai/ci-codeowners
Expand Down
2 changes: 1 addition & 1 deletion ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ EXITCODE=0
trap "EXITCODE=1" ERR
set +e

ctest -j20 --schedule-random --output-on-failure --no-tests=error
ctest -j20 --schedule-random --repeat until-pass:3 --output-on-failure --no-tests=error

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
4 changes: 4 additions & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ dependencies:
cuda: "12.2"
packages:
- cuda-version=12.2
- matrix:
cuda: "12.5"
packages:
- cuda-version=12.5
cuda:
specific:
- output_types: conda
Expand Down
4 changes: 2 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ RAPIDS dependencies.

These allow projects to make sure they use the same version and flags for
dependencies as the rest of RAPIDS. The exact versions that each pre-configured
package uses :ref:`can be found here. <cpm_versions>`
package uses :ref:`can be found here <cpm_versions>`.

.. literalinclude:: /packages/packages.rst
.. include:: /packages/packages.rst

.. _`cython`:

Expand Down
2 changes: 1 addition & 1 deletion docs/cpm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rapids-cmake provides a collection of pre-defined packages to ensure that all co
the same version of dependencies. The exact versions that each pre-configured package uses
can be found at the bottom of the page.

.. literalinclude:: /packages/packages.rst
.. include:: /packages/packages.rst

rapids-cmake package override
#############################
Expand Down
2 changes: 0 additions & 2 deletions docs/packages/packages.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
:orphan:

.. toctree::
:titlesonly:

Expand Down
14 changes: 12 additions & 2 deletions rapids-cmake/cmake/support_conda_env.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,25 @@ rapids_cmake_support_conda_env

.. versionadded:: v21.06.00

Establish a target that holds the CONDA include and link directories.
Establish a target that holds the necessary compile and link information
to properly support building in CONDA envs.

.. code-block:: cmake

rapids_cmake_support_conda_env( <target_name> [MODIFY_PREFIX_PATH] )

Creates a global interface target called `target_name` that holds
the CONDA include and link directories, when executed.
the CONDA compile options, include directories, and link directories when executed.

.. versionadded:: v24.06.00

The include directories that `target_name` holds will be `-isystem` to match
the behavior of conda when it builds projects.

.. versionadded:: v24.08.00

The `target_name` target will add the required compile flags to ensure debug builds
are generated with `-O0` instead of the conda env default of `-O2`.

Also offers the ability to modify :cmake:variable:`CMAKE_PREFIX_PATH <cmake:variable:CMAKE_PREFIX_PATH>` to
include the following paths based on the current conda environment:
Expand Down Expand Up @@ -182,5 +187,10 @@ function(rapids_cmake_support_conda_env target)
modify_cmake_prefix_path(PATHS "$ENV{CONDA_PREFIX}")
endif()
endif()

# The conda env will have setup `CXXFLAGS`, etc to contain `-O2` which we need to override to
# get proper debug information for local variables, etc. Since `target_compile_options` values
# are appended after `CXXFLAGS` we know that this will properly override the conda `-O2`
target_compile_options(${target} INTERFACE "$<$<CONFIG:Debug>:-O0>")
endif()
endfunction()
6 changes: 3 additions & 3 deletions rapids-cmake/cpm/detail/download.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,8 +42,8 @@ function(rapids_cpm_download)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.download")

# When changing version verify no new variables needs to be propagated
set(CPM_DOWNLOAD_VERSION 0.38.5)
set(CPM_DOWNLOAD_MD5_HASH c98d14a13dfd1952e115979c095f6794)
set(CPM_DOWNLOAD_VERSION 0.40.0)
set(CPM_DOWNLOAD_MD5_HASH 6c9866a0aa0f804a36fe8c3866fb8a2c)

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
Expand Down
47 changes: 0 additions & 47 deletions rapids-cmake/cpm/patches/cccl/revert_pr_211.diff

This file was deleted.

11 changes: 2 additions & 9 deletions rapids-cmake/cpm/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@
"version": "2.5.0",
"git_shallow": false,
"git_url": "https://github.com/NVIDIA/cccl.git",
"git_tag": "e21d607157218540cd7c45461213fb96adf720b7",
"patches": [
{
"file": "cccl/revert_pr_211.diff",
"issue": "thrust::copy introduced a change in behavior that causes failures with cudaErrorInvalidValue.",
"fixed_in": ""
}
]
"git_tag": "e21d607157218540cd7c45461213fb96adf720b7"
},
"cuco": {
"version": "0.0.1",
"git_shallow": false,
"always_download": true,
"git_url": "https://github.com/NVIDIA/cuCollections.git",
"git_tag": "6923b3b1e526b3305de81f784fdca26736caf5ba"
"git_tag": "ee5c10456c7ad584c254152411ba3dc114537a6f"
},
"fmt": {
"version": "10.1.1",
Expand Down
6 changes: 3 additions & 3 deletions rapids-cmake/cuda/set_runtime.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,10 +62,10 @@ function(rapids_cuda_set_runtime target use_static value)
endif()

if(${value})
set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY STATIC)
set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY Static)
target_link_libraries(${target} ${mode} $<TARGET_NAME_IF_EXISTS:CUDA::cudart_static>)
else()
set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY SHARED)
set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
target_link_libraries(${target} ${mode} $<TARGET_NAME_IF_EXISTS:CUDA::cudart>)
endif()

Expand Down
63 changes: 43 additions & 20 deletions rapids-cmake/test/detail/generate_installed_CTestTestfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,27 @@ endfunction()
# =============================================================================
# ============== Parse Install Location Functions ====================
# =============================================================================
function(extract_install_info line)
# We have a problem where we want to split on spaces but only when it is between two UPPER CASE
# letters and not in quotes :( We can't use string(REPLACE " ") since that will split paths with
# spaces

# what we can do is split on quotes and make this in a list. At that point we can split all other
# entries again
string(REPLACE "\"" ";" line "${line}")
# item 1 is the install location item 2 is the filter if valid item 3+ are the lists of files
# being installed
list(GET line 2 type)
if(type MATCHES " TYPE EXECUTABLE " OR type MATCHES " TYPE SHARED_LIBRARY "
OR type MATCHES " TYPE STATIC_LIBRARY " OR type MATCHES " TYPE OBJECT_LIBRARY ")
list(GET line 1 install_loc)
list(GET line 3 build_loc)
cmake_path(GET build_loc FILENAME name)
set_property(GLOBAL PROPERTY ${name}_install ${install_loc})
set_property(GLOBAL PROPERTY ${name}_build ${build_loc})
function(extract_install_info)
# remove the trailing `)` so that it doesn't get parsed as part of the file name
string(REGEX REPLACE "\\)$" "" line "${ARGN}")

# Leverate separate_arguments to parse a space-separated string into a list of items We use
# `UNIX_COMMAND` as that means args are separated by unquoted whitespace ( single, and double
# supported).
separate_arguments(install_contents UNIX_COMMAND "${line}")

set(options "file(INSTALL")
set(one_value DESTINATION TYPE)
set(multi_value FILES)
cmake_parse_arguments(_RAPIDS_TEST "${options}" "${one_value}" "${multi_value}"
${install_contents})
if(_RAPIDS_TEST_TYPE STREQUAL "EXECUTABLE" OR _RAPIDS_TEST_TYPE STREQUAL "SHARED_LIBRARY"
OR _RAPIDS_TEST_TYPE STREQUAL "STATIC_LIBRARY" OR _RAPIDS_TEST_TYPE STREQUAL "OBJECT_LIBRARY")
foreach(build_loc IN LISTS _RAPIDS_TEST_FILES)
cmake_path(GET build_loc FILENAME name)
set_property(GLOBAL PROPERTY ${name}_install ${_RAPIDS_TEST_DESTINATION})
set_property(GLOBAL PROPERTY ${name}_build ${build_loc})
endforeach()
endif()
endfunction()

Expand All @@ -210,9 +213,29 @@ endfunction()
function(determine_install_location_of_all_targets)
file(GLOB_RECURSE install_rule_files "${_RAPIDS_PROJECT_DIR}/cmake_install.cmake")
foreach(file IN LISTS install_rule_files)
file(STRINGS "${file}" contents REGEX "INSTALL DESTINATION")
file(STRINGS "${file}" contents)

set(parsing_file_command FALSE)
set(file_command_contents)
foreach(line IN LISTS contents)
extract_install_info("${line}")
if(line MATCHES "INSTALL DESTINATION")
# We found the first line of `file(INSTALL`
set(parsing_file_command TRUE)
endif()

if(parsing_file_command)
# Continue to add the lines of `file(INSTALL` till we hit the closing `)` That allows us to
# support multiple line file commands
string(APPEND command_contents "${line}")
if(line MATCHES "\\)$")
# We have all the lines for this file command, now parse it
extract_install_info(${command_contents})

# Reset to empty state for next `file(INSTALL)` command
set(parsing_file_command FALSE)
unset(command_contents)
endif()
endif()
endforeach()
endforeach()
endfunction()
Expand Down
5 changes: 5 additions & 0 deletions testing/cmake/conda_env-build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if(NOT TARGET conda_env)
message(FATAL_ERROR "Expected target conda_env to exist")
endif()

get_target_property(compile_options conda_env INTERFACE_COMPILE_OPTIONS)
if( NOT "$<$<CONFIG:Debug>:-O0>" IN_LIST compile_options)
message(FATAL_ERROR "Expected $<$<CONFIG:Debug>>:-O0> to be in the compile options of `conda_env`")
endif()

get_target_property(include_dirs conda_env INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
if( NOT "$ENV{BUILD_PREFIX}/include" IN_LIST include_dirs)
message(FATAL_ERROR "Expected env{BUILD_PREFIX} to be in the include dirs of `conda_env`")
Expand Down
8 changes: 8 additions & 0 deletions testing/cmake/conda_env-prefix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ set(ENV{PREFIX} "/opt/local/prefix")
set(ENV{CONDA_PREFIX} "/opt/conda/prefix")

rapids_cmake_support_conda_env(conda_env)
if(NOT TARGET conda_env)
message(FATAL_ERROR "Expected target conda_env to exist")
endif()

get_target_property(compile_options conda_env INTERFACE_COMPILE_OPTIONS)
if( NOT "$<$<CONFIG:Debug>:-O0>" IN_LIST compile_options)
message(FATAL_ERROR "Expected $<$<CONFIG:Debug>>:-O0> to be in the compile options of `conda_env`")
endif()

get_target_property(include_dirs conda_env INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
if( "$ENV{BUILD_PREFIX}/include" IN_LIST include_dirs)
Expand Down
22 changes: 18 additions & 4 deletions testing/cpm/cpm_find-patch-command/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,33 @@ set(cccl_dir "${deps_dir}/cccl")
list(APPEND CMAKE_PREFIX_PATH "${cccl_dir}")

include(${rapids-cmake-dir}/cpm/init.cmake)
include(${rapids-cmake-dir}/cpm/cccl.cmake)
rapids_cpm_init()

include(${rapids-cmake-dir}/cpm/package_override.cmake)
rapids_cpm_package_override(${CMAKE_CURRENT_SOURCE_DIR}/override.json)

include(${rapids-cmake-dir}/cpm/cccl.cmake)
rapids_cpm_cccl()

if(NOT "${CCCL_ADDED}")
message(FATAL_ERROR "The found repo was used rather than downloading and patching a new version")
endif()

# Verify that the two files that we inserted into the CCCL source tree exist
# Which proves the patches in the override are properly applied
if(NOT EXISTS "${CCCL_SOURCE_DIR}/git_file_1.txt")
message(FATAL_ERROR "failed to apply CCCL first patch")
endif()

if(NOT EXISTS "${CCCL_SOURCE_DIR}/git_file_2.txt")
message(FATAL_ERROR "failed to apply CCCL second patch")
endif()

execute_process(
COMMAND ${GIT_EXECUTABLE} diff-files --quiet
RESULT_VARIABLE REPO_IS_DIRTY
COMMAND ${GIT_EXECUTABLE} diff --quiet ${tag}
RESULT_VARIABLE REPO_IS_PATCHED
WORKING_DIRECTORY "${CCCL_SOURCE_DIR}")

if(NOT ${REPO_IS_DIRTY})
if(NOT ${REPO_IS_PATCHED})
message(FATAL_ERROR "The repo was downloaded to ${CCCL_SOURCE_DIR} but not patched.")
endif()
18 changes: 18 additions & 0 deletions testing/cpm/cpm_find-patch-command/override.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"packages": {
"CCCL": {
"patches": [
{
"file": "${current_json_dir}/patches/0001-move-git-sha1.patch",
"issue": "Move git sha1",
"fixed_in": ""
},
{
"file": "${current_json_dir}/patches/0002-move-git-sha1-a-second-time.patch",
"issue": "Move git sha1 a second time",
"fixed_in": ""
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From deacd3fafd7fcfee954ae3044ae3ab60d36a9f3a Mon Sep 17 00:00:00 2001
From: Robert Maynard <[email protected]>
Date: Wed, 31 Jan 2024 15:00:47 -0500
Subject: [PATCH 1/2] Move GIT SHA1

---
git_file_1.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 git_file_1.txt

diff --git a/git_file_1.txt b/git_file_1.txt
new file mode 100644
index 00000000..b242c360
--- /dev/null
+++ b/git_file_1.txt
@@ -0,0 +1 @@
+added file
--
2.43.0
Loading

0 comments on commit 2232d5a

Please sign in to comment.