Skip to content

Commit

Permalink
Update to spdlog>=1.11.0, fmt>=9.1.0. (#1177)
Browse files Browse the repository at this point in the history
Updates to `spdlog>=1.11.0` and `fmt>=9.1.0`. Also resolves some issues with spdlog in the librmm conda packages. Thanks @robertmaynard for helping advise me on this PR.

**We need to test this downstream before merging.** Perhaps with cuML or some other library.

Authors:
  - Bradley Dice (https://github.com/bdice)
  - Keith Kraus (https://github.com/kkraus14)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Mark Harris (https://github.com/harrism)
  - Keith Kraus (https://github.com/kkraus14)
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #1177
  • Loading branch information
bdice authored Feb 13, 2023
1 parent 332f8bc commit db92493
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 25 deletions.
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")

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
22 changes: 22 additions & 0 deletions cmake/thirdparty/get_fmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# =============================================================================
# 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 BUILD_EXPORT_SET rmm-exports)
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.
- 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 }}
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 {
};
1 change: 0 additions & 1 deletion include/rmm/mr/device/arena_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <cuda_runtime_api.h>

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

#include <cstddef>
#include <map>
Expand Down
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")

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

0 comments on commit db92493

Please sign in to comment.