Skip to content

Commit

Permalink
Use new rapids-logger library (#17899)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vyasr authored Feb 11, 2025
1 parent 2d0c85c commit 1a891e6
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 121 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ jobs:
with:
build_type: pull-request
run_script: "ci/cpp_linters.sh"
node_type: "cpu16"
conda-cpp-checks:
needs: conda-cpp-build
secrets: inherit
Expand Down
1 change: 1 addition & 0 deletions ci/build_wheel_cudf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ python -m auditwheel repair \
--exclude libcudf.so \
--exclude libnvcomp.so \
--exclude libkvikio.so \
--exclude librapids_logger.so \
-w ${package_dir}/final_dist \
${package_dir}/dist/*

Expand Down
1 change: 1 addition & 0 deletions ci/build_wheel_libcudf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mkdir -p ${package_dir}/final_dist
python -m auditwheel repair \
--exclude libnvcomp.so.4 \
--exclude libkvikio.so \
--exclude librapids_logger.so \
-w ${package_dir}/final_dist \
${package_dir}/dist/*

Expand Down
1 change: 1 addition & 0 deletions ci/build_wheel_pylibcudf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ python -m auditwheel repair \
--exclude libcudf.so \
--exclude libnvcomp.so \
--exclude libkvikio.so \
--exclude librapids_logger.so \
-w ${package_dir}/final_dist \
${package_dir}/dist/*

Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ dependencies:
- doxygen=1.9.1
- fastavro>=0.22.9
- flatbuffers==24.3.25
- fmt>=11.0.2,<12
- fsspec>=0.6.0
- gcc_linux-64=11.*
- hypothesis
Expand Down Expand Up @@ -83,6 +82,7 @@ dependencies:
- python>=3.10,<3.13
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==25.4.*,>=0.0.0a0
- rapids-logger==0.1.*,>=0.0.0a0
- rich
- rmm==25.4.*,>=0.0.0a0
- s3fs>=2022.3.0
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-128_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dependencies:
- doxygen=1.9.1
- fastavro>=0.22.9
- flatbuffers==24.3.25
- fmt>=11.0.2,<12
- fsspec>=0.6.0
- gcc_linux-64=13.*
- hypothesis
Expand Down Expand Up @@ -82,6 +81,7 @@ dependencies:
- pytorch>=2.4.0
- rapids-build-backend>=0.3.0,<0.4.0.dev0
- rapids-dask-dependency==25.4.*,>=0.0.0a0
- rapids-logger==0.1.*,>=0.0.0a0
- rich
- rmm==25.4.*,>=0.0.0a0
- s3fs>=2022.3.0
Expand Down
3 changes: 0 additions & 3 deletions conda/recipes/libcudf/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ dlpack_version:
librdkafka_version:
- ">=2.5.0,<2.6.0a0"

fmt_version:
- ">=11.0.2,<12"

flatbuffers_version:
- "=24.3.25"

Expand Down
3 changes: 2 additions & 1 deletion conda/recipes/libcudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ requirements:
- nvcomp {{ nvcomp_version }}
- dlpack {{ dlpack_version }}
- librdkafka {{ librdkafka_version }}
- fmt {{ fmt_version }}
- flatbuffers {{ flatbuffers_version }}
- rapids-logger =0.1
- zlib {{ zlib_version }}

outputs:
Expand Down Expand Up @@ -99,6 +99,7 @@ outputs:
- librmm ={{ minor_version }}
- libkvikio ={{ minor_version }}
- dlpack {{ dlpack_version }}
- rapids-logger =0.1
test:
commands:
- test -f $PREFIX/lib/libcudf.so
Expand Down
22 changes: 7 additions & 15 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ endif()
rapids_cpm_init()

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

# find jitify
include(cmake/thirdparty/get_jitify.cmake)
Expand All @@ -302,8 +302,6 @@ endif()
include(cmake/Modules/JitifyPreprocessKernels.cmake)
# find KvikIO
include(cmake/thirdparty/get_kvikio.cmake)
# find fmt
include(cmake/thirdparty/get_fmt.cmake)
# find nanoarrow
include(cmake/thirdparty/get_nanoarrow.cmake)
# find thread_pool
Expand Down Expand Up @@ -779,6 +777,7 @@ add_library(
src/utilities/default_stream.cpp
src/utilities/host_memory.cpp
src/utilities/linked_column.cpp
src/utilities/logger.cpp
src/utilities/prefetch.cpp
src/utilities/stacktrace.cpp
src/utilities/stream_pool.cpp
Expand Down Expand Up @@ -943,16 +942,9 @@ add_dependencies(cudf jitify_preprocess_run)
# Specify the target module library dependencies
target_link_libraries(
cudf
PUBLIC CCCL::CCCL rmm::rmm rmm::rmm_logger $<BUILD_LOCAL_INTERFACE:BS::thread_pool> cudf_logger
PRIVATE $<BUILD_LOCAL_INTERFACE:nvtx3::nvtx3-cpp>
cuco::cuco
ZLIB::ZLIB
nvcomp::nvcomp
kvikio::kvikio
$<TARGET_NAME_IF_EXISTS:CUDA::cuFile${_cufile_suffix}>
nanoarrow
rmm::rmm_logger_impl
cudf_logger_impl
PUBLIC CCCL::CCCL rapids_logger::rapids_logger rmm::rmm $<BUILD_LOCAL_INTERFACE:BS::thread_pool>
PRIVATE $<BUILD_LOCAL_INTERFACE:nvtx3::nvtx3-cpp> cuco::cuco ZLIB::ZLIB nvcomp::nvcomp
kvikio::kvikio $<TARGET_NAME_IF_EXISTS:CUDA::cuFile${_cufile_suffix}> nanoarrow
)

# Add Conda library, and include paths if specified
Expand Down Expand Up @@ -1108,7 +1100,7 @@ if(CUDF_BUILD_STREAMS_TEST_UTIL)
${_tgt} PRIVATE "$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${CUDF_CXX_FLAGS}>>"
)
target_include_directories(${_tgt} PRIVATE "$<BUILD_INTERFACE:${CUDF_SOURCE_DIR}/include>")
target_link_libraries(${_tgt} PUBLIC CUDA::cudart rmm::rmm rmm::rmm_logger rmm::rmm_logger_impl)
target_link_libraries(${_tgt} PUBLIC CUDA::cudart rmm::rmm)
if(CUDF_BUILD_STACKTRACE_DEBUG)
target_link_libraries(${_tgt} PRIVATE cudf_backtrace)
endif()
Expand Down
22 changes: 0 additions & 22 deletions cpp/cmake/thirdparty/get_fmt.cmake

This file was deleted.

50 changes: 50 additions & 0 deletions cpp/include/cudf/logger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2025, 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

#include <cudf/logger_macros.hpp>
#include <cudf/utilities/export.hpp>

#include <rapids_logger/logger.hpp>

namespace CUDF_EXPORT cudf {

/**
* @brief Returns the default sink for the global logger.
*
* If the environment variable `CUDF_DEBUG_LOG_FILE` is defined, the default sink is a sink to that
* file. Otherwise, the default is to dump to stderr.
*
* @return sink_ptr The sink to use
*/
rapids_logger::sink_ptr default_logger_sink();

/**
* @brief Returns the default log pattern for the global logger.
*
* @return std::string The default log pattern.
*/
std::string default_logger_pattern();

/**
* @brief Get the default logger.
*
* @return logger& The default logger
*/
rapids_logger::logger& default_logger();

} // namespace CUDF_EXPORT cudf
46 changes: 46 additions & 0 deletions cpp/src/utilities/logger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2025, 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.
*/

#include <cudf/logger.hpp>
#include <cudf/utilities/export.hpp>

#include <rapids_logger/logger.hpp>

namespace CUDF_EXPORT cudf {

rapids_logger::sink_ptr default_logger_sink()
{
auto* filename = std::getenv("CUDF_DEBUG_LOG_FILE");
if (filename != nullptr) {
return std::make_shared<rapids_logger::basic_file_sink_mt>(filename, true);
}
return std::make_shared<rapids_logger::stderr_sink_mt>();
}

std::string default_logger_pattern() { return "[%6t][%H:%M:%S:%f][%-6l] %v"; }

rapids_logger::logger& default_logger()
{
static rapids_logger::logger logger_ = [] {
rapids_logger::logger logger_{"CUDF", {default_logger_sink()}};
logger_.set_pattern(default_logger_pattern());
logger_.set_level(rapids_logger::level_enum::warn);
return logger_;
}();
return logger_;
}

} // namespace CUDF_EXPORT cudf
1 change: 0 additions & 1 deletion cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ ConfigureTest(
utilities_tests/default_stream_tests.cpp
utilities_tests/io_utilities_tests.cpp
utilities_tests/lists_column_wrapper_tests.cpp
utilities_tests/logger_tests.cpp
utilities_tests/pinned_memory_tests.cpp
utilities_tests/type_check_tests.cpp
utilities_tests/type_list_tests.cpp
Expand Down
74 changes: 0 additions & 74 deletions cpp/tests/utilities_tests/logger_tests.cpp

This file was deleted.

Loading

0 comments on commit 1a891e6

Please sign in to comment.