Skip to content

Commit 1a891e6

Browse files
authored
Use new rapids-logger library (#17899)
Contributes to rapidsai/build-planning#104. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Matthew Murray (https://github.com/Matt711) - Gil Forsyth (https://github.com/gforsyth) - Bradley Dice (https://github.com/bdice) - James Lamb (https://github.com/jameslamb) URL: #17899
1 parent 2d0c85c commit 1a891e6

File tree

17 files changed

+134
-121
lines changed

17 files changed

+134
-121
lines changed

.github/workflows/pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
with:
143143
build_type: pull-request
144144
run_script: "ci/cpp_linters.sh"
145+
node_type: "cpu16"
145146
conda-cpp-checks:
146147
needs: conda-cpp-build
147148
secrets: inherit

ci/build_wheel_cudf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ python -m auditwheel repair \
2424
--exclude libcudf.so \
2525
--exclude libnvcomp.so \
2626
--exclude libkvikio.so \
27+
--exclude librapids_logger.so \
2728
-w ${package_dir}/final_dist \
2829
${package_dir}/dist/*
2930

ci/build_wheel_libcudf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ mkdir -p ${package_dir}/final_dist
3434
python -m auditwheel repair \
3535
--exclude libnvcomp.so.4 \
3636
--exclude libkvikio.so \
37+
--exclude librapids_logger.so \
3738
-w ${package_dir}/final_dist \
3839
${package_dir}/dist/*
3940

ci/build_wheel_pylibcudf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ python -m auditwheel repair \
2222
--exclude libcudf.so \
2323
--exclude libnvcomp.so \
2424
--exclude libkvikio.so \
25+
--exclude librapids_logger.so \
2526
-w ${package_dir}/final_dist \
2627
${package_dir}/dist/*
2728

conda/environments/all_cuda-118_arch-x86_64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ dependencies:
3131
- doxygen=1.9.1
3232
- fastavro>=0.22.9
3333
- flatbuffers==24.3.25
34-
- fmt>=11.0.2,<12
3534
- fsspec>=0.6.0
3635
- gcc_linux-64=11.*
3736
- hypothesis
@@ -83,6 +82,7 @@ dependencies:
8382
- python>=3.10,<3.13
8483
- rapids-build-backend>=0.3.0,<0.4.0.dev0
8584
- rapids-dask-dependency==25.4.*,>=0.0.0a0
85+
- rapids-logger==0.1.*,>=0.0.0a0
8686
- rich
8787
- rmm==25.4.*,>=0.0.0a0
8888
- s3fs>=2022.3.0

conda/environments/all_cuda-128_arch-x86_64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ dependencies:
3232
- doxygen=1.9.1
3333
- fastavro>=0.22.9
3434
- flatbuffers==24.3.25
35-
- fmt>=11.0.2,<12
3635
- fsspec>=0.6.0
3736
- gcc_linux-64=13.*
3837
- hypothesis
@@ -82,6 +81,7 @@ dependencies:
8281
- pytorch>=2.4.0
8382
- rapids-build-backend>=0.3.0,<0.4.0.dev0
8483
- rapids-dask-dependency==25.4.*,>=0.0.0a0
84+
- rapids-logger==0.1.*,>=0.0.0a0
8585
- rich
8686
- rmm==25.4.*,>=0.0.0a0
8787
- s3fs>=2022.3.0

conda/recipes/libcudf/conda_build_config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ dlpack_version:
2525
librdkafka_version:
2626
- ">=2.5.0,<2.6.0a0"
2727

28-
fmt_version:
29-
- ">=11.0.2,<12"
30-
3128
flatbuffers_version:
3229
- "=24.3.25"
3330

conda/recipes/libcudf/meta.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ requirements:
6666
- nvcomp {{ nvcomp_version }}
6767
- dlpack {{ dlpack_version }}
6868
- librdkafka {{ librdkafka_version }}
69-
- fmt {{ fmt_version }}
7069
- flatbuffers {{ flatbuffers_version }}
70+
- rapids-logger =0.1
7171
- zlib {{ zlib_version }}
7272

7373
outputs:
@@ -99,6 +99,7 @@ outputs:
9999
- librmm ={{ minor_version }}
100100
- libkvikio ={{ minor_version }}
101101
- dlpack {{ dlpack_version }}
102+
- rapids-logger =0.1
102103
test:
103104
commands:
104105
- test -f $PREFIX/lib/libcudf.so

cpp/CMakeLists.txt

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ endif()
275275
rapids_cpm_init()
276276

277277
include(${rapids-cmake-dir}/cpm/rapids_logger.cmake)
278-
rapids_cpm_rapids_logger()
279-
rapids_make_logger(cudf EXPORT_SET cudf-exports LOGGER_DEFAULT_LEVEL WARN)
278+
rapids_cpm_rapids_logger(BUILD_EXPORT_SET cudf-exports INSTALL_EXPORT_SET cudf-exports)
279+
create_logger_macros(CUDF "cudf::default_logger()" include/cudf)
280280

281281
# find jitify
282282
include(cmake/thirdparty/get_jitify.cmake)
@@ -302,8 +302,6 @@ endif()
302302
include(cmake/Modules/JitifyPreprocessKernels.cmake)
303303
# find KvikIO
304304
include(cmake/thirdparty/get_kvikio.cmake)
305-
# find fmt
306-
include(cmake/thirdparty/get_fmt.cmake)
307305
# find nanoarrow
308306
include(cmake/thirdparty/get_nanoarrow.cmake)
309307
# find thread_pool
@@ -779,6 +777,7 @@ add_library(
779777
src/utilities/default_stream.cpp
780778
src/utilities/host_memory.cpp
781779
src/utilities/linked_column.cpp
780+
src/utilities/logger.cpp
782781
src/utilities/prefetch.cpp
783782
src/utilities/stacktrace.cpp
784783
src/utilities/stream_pool.cpp
@@ -943,16 +942,9 @@ add_dependencies(cudf jitify_preprocess_run)
943942
# Specify the target module library dependencies
944943
target_link_libraries(
945944
cudf
946-
PUBLIC CCCL::CCCL rmm::rmm rmm::rmm_logger $<BUILD_LOCAL_INTERFACE:BS::thread_pool> cudf_logger
947-
PRIVATE $<BUILD_LOCAL_INTERFACE:nvtx3::nvtx3-cpp>
948-
cuco::cuco
949-
ZLIB::ZLIB
950-
nvcomp::nvcomp
951-
kvikio::kvikio
952-
$<TARGET_NAME_IF_EXISTS:CUDA::cuFile${_cufile_suffix}>
953-
nanoarrow
954-
rmm::rmm_logger_impl
955-
cudf_logger_impl
945+
PUBLIC CCCL::CCCL rapids_logger::rapids_logger rmm::rmm $<BUILD_LOCAL_INTERFACE:BS::thread_pool>
946+
PRIVATE $<BUILD_LOCAL_INTERFACE:nvtx3::nvtx3-cpp> cuco::cuco ZLIB::ZLIB nvcomp::nvcomp
947+
kvikio::kvikio $<TARGET_NAME_IF_EXISTS:CUDA::cuFile${_cufile_suffix}> nanoarrow
956948
)
957949

958950
# Add Conda library, and include paths if specified
@@ -1108,7 +1100,7 @@ if(CUDF_BUILD_STREAMS_TEST_UTIL)
11081100
${_tgt} PRIVATE "$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${CUDF_CXX_FLAGS}>>"
11091101
)
11101102
target_include_directories(${_tgt} PRIVATE "$<BUILD_INTERFACE:${CUDF_SOURCE_DIR}/include>")
1111-
target_link_libraries(${_tgt} PUBLIC CUDA::cudart rmm::rmm rmm::rmm_logger rmm::rmm_logger_impl)
1103+
target_link_libraries(${_tgt} PUBLIC CUDA::cudart rmm::rmm)
11121104
if(CUDF_BUILD_STACKTRACE_DEBUG)
11131105
target_link_libraries(${_tgt} PRIVATE cudf_backtrace)
11141106
endif()

cpp/cmake/thirdparty/get_fmt.cmake

Lines changed: 0 additions & 22 deletions
This file was deleted.

cpp/include/cudf/logger.hpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2025, NVIDIA CORPORATION.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#pragma once
18+
19+
#include <cudf/logger_macros.hpp>
20+
#include <cudf/utilities/export.hpp>
21+
22+
#include <rapids_logger/logger.hpp>
23+
24+
namespace CUDF_EXPORT cudf {
25+
26+
/**
27+
* @brief Returns the default sink for the global logger.
28+
*
29+
* If the environment variable `CUDF_DEBUG_LOG_FILE` is defined, the default sink is a sink to that
30+
* file. Otherwise, the default is to dump to stderr.
31+
*
32+
* @return sink_ptr The sink to use
33+
*/
34+
rapids_logger::sink_ptr default_logger_sink();
35+
36+
/**
37+
* @brief Returns the default log pattern for the global logger.
38+
*
39+
* @return std::string The default log pattern.
40+
*/
41+
std::string default_logger_pattern();
42+
43+
/**
44+
* @brief Get the default logger.
45+
*
46+
* @return logger& The default logger
47+
*/
48+
rapids_logger::logger& default_logger();
49+
50+
} // namespace CUDF_EXPORT cudf

cpp/src/utilities/logger.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2025, NVIDIA CORPORATION.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <cudf/logger.hpp>
18+
#include <cudf/utilities/export.hpp>
19+
20+
#include <rapids_logger/logger.hpp>
21+
22+
namespace CUDF_EXPORT cudf {
23+
24+
rapids_logger::sink_ptr default_logger_sink()
25+
{
26+
auto* filename = std::getenv("CUDF_DEBUG_LOG_FILE");
27+
if (filename != nullptr) {
28+
return std::make_shared<rapids_logger::basic_file_sink_mt>(filename, true);
29+
}
30+
return std::make_shared<rapids_logger::stderr_sink_mt>();
31+
}
32+
33+
std::string default_logger_pattern() { return "[%6t][%H:%M:%S:%f][%-6l] %v"; }
34+
35+
rapids_logger::logger& default_logger()
36+
{
37+
static rapids_logger::logger logger_ = [] {
38+
rapids_logger::logger logger_{"CUDF", {default_logger_sink()}};
39+
logger_.set_pattern(default_logger_pattern());
40+
logger_.set_level(rapids_logger::level_enum::warn);
41+
return logger_;
42+
}();
43+
return logger_;
44+
}
45+
46+
} // namespace CUDF_EXPORT cudf

cpp/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ ConfigureTest(
405405
utilities_tests/default_stream_tests.cpp
406406
utilities_tests/io_utilities_tests.cpp
407407
utilities_tests/lists_column_wrapper_tests.cpp
408-
utilities_tests/logger_tests.cpp
409408
utilities_tests/pinned_memory_tests.cpp
410409
utilities_tests/type_check_tests.cpp
411410
utilities_tests/type_list_tests.cpp

cpp/tests/utilities_tests/logger_tests.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)