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

Update to spdlog>=1.11.0, fmt>=9.1.0. #1177

Merged
merged 20 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
# Copyright (c) 2018-2023, 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 @@ -14,6 +14,10 @@

cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)

# TODO(keith): REMOVE BEFORE MERGING
set(rapids-cmake-repo "kkraus14/rapids-cmake")
set(rapids-cmake-branch "spdlog_1.11_fmt")
bdice marked this conversation as resolved.
Show resolved Hide resolved

if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/RMM_RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.04/RAPIDS.cmake
${CMAKE_CURRENT_BINARY_DIR}/RMM_RAPIDS.cmake)
Expand Down Expand Up @@ -58,6 +62,7 @@ rapids_find_package(
BUILD_EXPORT_SET rmm-exports
INSTALL_EXPORT_SET rmm-exports)
rapids_cpm_init()
include(cmake/thirdparty/get_fmt.cmake)
include(cmake/thirdparty/get_spdlog.cmake)
include(cmake/thirdparty/get_thrust.cmake)

Expand All @@ -77,6 +82,7 @@ else()
endif()

target_link_libraries(rmm INTERFACE rmm::Thrust)
target_link_libraries(rmm INTERFACE fmt::fmt-header-only)
target_link_libraries(rmm INTERFACE spdlog::spdlog_header_only)
target_link_libraries(rmm INTERFACE dl)
target_compile_features(rmm INTERFACE cxx_std_17 $<BUILD_INTERFACE:cuda_std_17>)
Expand Down
33 changes: 33 additions & 0 deletions cmake/thirdparty/get_fmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# =============================================================================
# Copyright (c) 2023, 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.
# =============================================================================

# Use CPM to find or clone fmt
function(find_and_configure_fmt)

include(${rapids-cmake-dir}/cpm/fmt.cmake)
rapids_cpm_fmt(INSTALL_EXPORT_SET rmm-exports)
rapids_export_package(BUILD fmt rmm-exports)

if(fmt_ADDED)
rapids_export(
BUILD fmt
EXPORT_SET fmt
GLOBAL_TARGETS fmt fmt-header-only
NAMESPACE fmt::)
include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(BUILD fmt [=[${CMAKE_CURRENT_LIST_DIR}]=] rmm-exports)
endif()
endfunction()

find_and_configure_fmt()
4 changes: 2 additions & 2 deletions cmake/thirdparty/get_spdlog.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2021, NVIDIA CORPORATION.
# Copyright (c) 2021-2023, 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 @@ -16,7 +16,7 @@
function(find_and_configure_spdlog)

include(${rapids-cmake-dir}/cpm/spdlog.cmake)
rapids_cpm_spdlog(INSTALL_EXPORT_SET rmm-exports)
rapids_cpm_spdlog(FMT_OPTION "EXTERNAL_FMT_HO" INSTALL_EXPORT_SET rmm-exports)
rapids_export_package(BUILD spdlog rmm-exports)

if(spdlog_ADDED)
Expand Down
3 changes: 2 additions & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- cuda-python>=11.7.1,<12.0
- cudatoolkit=11.8
- cython>=0.29,<0.30
- fmt>=9.1.0,<10
- gcovr>=5.0
- ninja
- numba>=0.49
Expand All @@ -17,5 +18,5 @@ dependencies:
- pytest-cov
- python>=3.8,<3.11
- scikit-build>=0.13.1
- spdlog>=1.8.5,<1.9
- spdlog>=1.11.0,<1.12
name: all_cuda-118_arch-x86_64
5 changes: 4 additions & 1 deletion conda/recipes/librmm/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ cuda_compiler:
cmake_version:
- ">=3.23.1,!=3.25.0"

fmt_version:
- ">=9.1.0,<10"

gtest_version:
- "=1.10.0"

spdlog_version:
- ">=1.8.5,<1.9"
- ">=1.11.0,<1.12"

sysroot_version:
- "2.17"
10 changes: 9 additions & 1 deletion conda/recipes/librmm/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ requirements:
- {{ compiler('cuda') }} {{ cuda_version }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
host:
- cudatoolkit {{ cuda_version }}.*
- cudatoolkit ={{ cuda_version }}
# We require spdlog and fmt (which was devendored from spdlog
# conda-forge packages in 1.11.0) so that the spdlog headers are not
# pulled by CPM and installed as a part of the rmm packages. However,
# building against librmm still requires these headers. They are also
# added as a run requirement via the packages' run_exports.
Comment on lines +28 to +29
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kkraus14 Will these be added as a run requirement of both or neither of librmm and librmm-tests because of the run_exports? Should I manually re-specify them in librmm's run section?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm building the package locally now to check. I'm not quite sure the rules on output packages as it's kinda entirely undocumented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From looking at other recipes, I think we do need to specify them again as librmm run dependencies. Added in b7e8154.

Copy link
Member

Choose a reason for hiding this comment

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

From looking at other recipes, I think we do need to specify them again as librmm run dependencies. Added in b7e8154.

I can confirm this.

run_exports from the top-level package aren't propagated to output packages.

We noticed this behavior when we first consolidated the recipes back in the day.

- fmt {{ fmt_version }}
- spdlog {{ spdlog_version }}

build:
script_env:
Expand Down Expand Up @@ -54,6 +61,7 @@ outputs:
- cmake {{ cmake_version }}
run:
- cudatoolkit {{ cuda_spec }}
- fmt {{ fmt_version }}
- spdlog {{ spdlog_version }}
bdice marked this conversation as resolved.
Show resolved Hide resolved
test:
commands:
Expand Down
3 changes: 2 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ dependencies:
- scikit-build>=0.13.1
- output_types: conda
packages:
- spdlog>=1.8.5,<1.9
- fmt>=9.1.0,<10
- spdlog>=1.11.0,<1.12
checks:
common:
- output_types: [conda, requirements]
Expand Down
14 changes: 7 additions & 7 deletions include/rmm/logger.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, 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 All @@ -16,12 +16,8 @@

#pragma once

// If using GCC, temporary workaround for older libcudacxx defining _LIBCPP_VERSION
// undefine it before including spdlog, due to fmtlib checking if it is defined
// TODO: remove once libcudacxx is on Github and RAPIDS depends on it
#ifdef __GNUG__
#undef _LIBCPP_VERSION
#endif
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/spdlog.h>

Expand Down Expand Up @@ -115,3 +111,7 @@ inline spdlog::logger& logger()
#define RMM_LOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(&rmm::logger(), __VA_ARGS__)

} // namespace rmm

template <>
struct fmt::formatter<rmm::detail::bytes> : fmt::ostream_formatter {
};
4 changes: 2 additions & 2 deletions include/rmm/mr/device/detail/arena.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, 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 All @@ -24,8 +24,8 @@

#include <cuda_runtime_api.h>

#include <fmt/core.h>
#include <spdlog/common.h>
#include <spdlog/fmt/ostr.h>

#include <algorithm>
#include <cstddef>
Expand Down
6 changes: 4 additions & 2 deletions include/rmm/mr/device/detail/coalescing_free_list.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, 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 All @@ -16,14 +16,16 @@

#pragma once

#include <iterator>
#include <rmm/detail/error.hpp>
#include <rmm/mr/device/detail/free_list.hpp>

#include <fmt/core.h>

#include <algorithm>
#include <cassert>
#include <cstddef>
#include <iostream>
#include <iterator>
#include <list>

namespace rmm::mr::detail {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, 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 All @@ -20,6 +20,8 @@
#include <rmm/logger.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>

#include <fmt/core.h>

#include <cuda_runtime_api.h>

#include <cstddef>
Expand Down
3 changes: 2 additions & 1 deletion include/rmm/mr/device/logging_resource_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, 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 All @@ -19,6 +19,7 @@
#include <rmm/detail/error.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>

#include <fmt/core.h>
#include <spdlog/common.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/ostream_sink.h>
Expand Down
4 changes: 3 additions & 1 deletion include/rmm/mr/device/pool_memory_resource.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, 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 @@ -29,6 +29,8 @@
#include <thrust/iterator/transform_iterator.h>
#include <thrust/optional.h>

#include <fmt/core.h>

#include <cuda_runtime_api.h>

#include <algorithm>
Expand Down
4 changes: 3 additions & 1 deletion include/rmm/mr/device/tracking_resource_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, 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 All @@ -19,6 +19,8 @@
#include <rmm/detail/stack_trace.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>

#include <fmt/core.h>

#include <cstddef>
#include <map>
#include <mutex>
Expand Down
4 changes: 4 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)

set(rmm_version 23.04.00)

# TODO(keith): REMOVE BEFORE MERGING
set(rapids-cmake-repo "kkraus14/rapids-cmake")
set(rapids-cmake-branch "spdlog_1.11_fmt")
bdice marked this conversation as resolved.
Show resolved Hide resolved

file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.04/RAPIDS.cmake
${CMAKE_BINARY_DIR}/RAPIDS.cmake)
include(${CMAKE_BINARY_DIR}/RAPIDS.cmake)
Expand Down
4 changes: 2 additions & 2 deletions tests/mr/device/callback_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
* Copyright (c) 2022-2023, 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 All @@ -24,7 +24,7 @@

#include <cstddef>

#include <spdlog/fmt/ostr.h>
#include <fmt/core.h>

#include <gmock/gmock.h>
#include <gtest/gtest.h>
Expand Down