diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e36b3e2ede4..07c00b3e13c 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -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 diff --git a/ci/build_wheel_cudf.sh b/ci/build_wheel_cudf.sh index 0f373547660..9d2f97e4261 100755 --- a/ci/build_wheel_cudf.sh +++ b/ci/build_wheel_cudf.sh @@ -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/* diff --git a/ci/build_wheel_libcudf.sh b/ci/build_wheel_libcudf.sh index ca2ecb24a75..06be943fd93 100755 --- a/ci/build_wheel_libcudf.sh +++ b/ci/build_wheel_libcudf.sh @@ -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/* diff --git a/ci/build_wheel_pylibcudf.sh b/ci/build_wheel_pylibcudf.sh index 9091f59d57b..e32c32d4262 100755 --- a/ci/build_wheel_pylibcudf.sh +++ b/ci/build_wheel_pylibcudf.sh @@ -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/* diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index 190533abc51..09eb9949f1d 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -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 @@ -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 diff --git a/conda/environments/all_cuda-128_arch-x86_64.yaml b/conda/environments/all_cuda-128_arch-x86_64.yaml index e719fd51573..56cef28ac61 100644 --- a/conda/environments/all_cuda-128_arch-x86_64.yaml +++ b/conda/environments/all_cuda-128_arch-x86_64.yaml @@ -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 @@ -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 diff --git a/conda/recipes/libcudf/conda_build_config.yaml b/conda/recipes/libcudf/conda_build_config.yaml index 181064465ef..1da96ebc072 100644 --- a/conda/recipes/libcudf/conda_build_config.yaml +++ b/conda/recipes/libcudf/conda_build_config.yaml @@ -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" diff --git a/conda/recipes/libcudf/meta.yaml b/conda/recipes/libcudf/meta.yaml index 55a1d9cbe72..f7bd7280f0f 100644 --- a/conda/recipes/libcudf/meta.yaml +++ b/conda/recipes/libcudf/meta.yaml @@ -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: @@ -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 diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 354560998c5..56b97f6ce00 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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) @@ -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 @@ -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 @@ -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 $ cudf_logger - PRIVATE $ - cuco::cuco - ZLIB::ZLIB - nvcomp::nvcomp - kvikio::kvikio - $ - nanoarrow - rmm::rmm_logger_impl - cudf_logger_impl + PUBLIC CCCL::CCCL rapids_logger::rapids_logger rmm::rmm $ + PRIVATE $ cuco::cuco ZLIB::ZLIB nvcomp::nvcomp + kvikio::kvikio $ nanoarrow ) # Add Conda library, and include paths if specified @@ -1108,7 +1100,7 @@ if(CUDF_BUILD_STREAMS_TEST_UTIL) ${_tgt} PRIVATE "$:${CUDF_CXX_FLAGS}>>" ) target_include_directories(${_tgt} PRIVATE "$") - 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() diff --git a/cpp/cmake/thirdparty/get_fmt.cmake b/cpp/cmake/thirdparty/get_fmt.cmake deleted file mode 100644 index 083dd1d0631..00000000000 --- a/cpp/cmake/thirdparty/get_fmt.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# ============================================================================= -# 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 cudf-exports BUILD_EXPORT_SET cudf-exports) -endfunction() - -find_and_configure_fmt() diff --git a/cpp/include/cudf/logger.hpp b/cpp/include/cudf/logger.hpp new file mode 100644 index 00000000000..fd9a0509496 --- /dev/null +++ b/cpp/include/cudf/logger.hpp @@ -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 +#include + +#include + +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 diff --git a/cpp/src/utilities/logger.cpp b/cpp/src/utilities/logger.cpp new file mode 100644 index 00000000000..7340f2ec1a7 --- /dev/null +++ b/cpp/src/utilities/logger.cpp @@ -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 +#include + +#include + +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(filename, true); + } + return std::make_shared(); +} + +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 diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index e031597ed18..117cd620679 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -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 diff --git a/cpp/tests/utilities_tests/logger_tests.cpp b/cpp/tests/utilities_tests/logger_tests.cpp deleted file mode 100644 index b5d20325b75..00000000000 --- a/cpp/tests/utilities_tests/logger_tests.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2023-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 - -#include - -#include - -class LoggerTest : public cudf::test::BaseFixture { - std::ostringstream oss; - cudf::level_enum prev_level; - - public: - LoggerTest() : prev_level{cudf::default_logger().level()} - { - cudf::default_logger().sinks().push_back(std::make_shared(oss)); - cudf::default_logger().set_pattern("%v"); - } - ~LoggerTest() override - { - cudf::default_logger().set_pattern("[%6t][%H:%M:%S:%f][%-6l] %v"); - cudf::default_logger().set_level(prev_level); - cudf::default_logger().sinks().pop_back(); - } - - void clear_sink() { oss.str(""); } - std::string sink_content() { return oss.str(); } -}; - -TEST_F(LoggerTest, Basic) -{ - cudf::default_logger().critical("crit msg"); - ASSERT_EQ(this->sink_content(), "crit msg\n"); -} - -TEST_F(LoggerTest, DefaultLevel) -{ - cudf::default_logger().trace("trace"); - cudf::default_logger().debug("debug"); - cudf::default_logger().info("info"); - cudf::default_logger().warn("warn"); - cudf::default_logger().error("error"); - cudf::default_logger().critical("critical"); - ASSERT_EQ(this->sink_content(), "warn\nerror\ncritical\n"); -} - -TEST_F(LoggerTest, CustomLevel) -{ - cudf::default_logger().set_level(cudf::level_enum::warn); - cudf::default_logger().info("info"); - cudf::default_logger().warn("warn"); - ASSERT_EQ(this->sink_content(), "warn\n"); - - this->clear_sink(); - - cudf::default_logger().set_level(cudf::level_enum::debug); - cudf::default_logger().trace("trace"); - cudf::default_logger().debug("debug"); - ASSERT_EQ(this->sink_content(), "debug\n"); -} diff --git a/dependencies.yaml b/dependencies.yaml index b1378fae6d7..db3ce1e535d 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -24,6 +24,7 @@ files: - depends_on_libkvikio - depends_on_librmm - depends_on_nvcomp + - depends_on_rapids_logger - depends_on_rmm - develop - docs @@ -177,6 +178,7 @@ files: - build_cpp - depends_on_libkvikio - depends_on_librmm + - depends_on_rapids_logger py_run_libcudf: output: pyproject pyproject_dir: python/libcudf @@ -184,7 +186,9 @@ files: table: project includes: - depends_on_libkvikio + - depends_on_librmm - depends_on_nvcomp + - depends_on_rapids_logger py_build_pylibcudf: output: pyproject pyproject_dir: python/pylibcudf @@ -424,7 +428,6 @@ dependencies: common: - output_types: conda packages: - - fmt>=11.0.2,<12 - flatbuffers==24.3.25 - librdkafka>=2.5.0,<2.6.0a0 depends_on_nvcomp: @@ -1141,6 +1144,15 @@ dependencies: - matrix: packages: - *rmm_unsuffixed + depends_on_rapids_logger: + common: + - output_types: [conda, requirements, pyproject] + packages: + - rapids-logger==0.1.*,>=0.0.0a0 + - output_types: requirements + packages: + # pip recognizes the index as a global option for the requirements.txt file + - --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple test_python_pandas_cudf: common: - output_types: [requirements, pyproject] diff --git a/python/libcudf/libcudf/load.py b/python/libcudf/libcudf/load.py index c3ff5534e87..4198fcbe385 100644 --- a/python/libcudf/libcudf/load.py +++ b/python/libcudf/libcudf/load.py @@ -1,4 +1,4 @@ -# Copyright (c) 2024, NVIDIA CORPORATION. +# Copyright (c) 2024-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. @@ -47,9 +47,14 @@ def _load_wheel_installation(soname: str): def load_library(): """Dynamically load libcudf.so and its dependencies""" try: - # libkvikio must be loaded before libcudf because libcudf references its symbols + # librmm and libkvikio must be loaded before libcudf because libcudf references + # them. import libkvikio + import librmm + import rapids_logger + rapids_logger.load_library() + librmm.load_library() libkvikio.load_library() except ModuleNotFoundError: # libcudf's runtime dependency on libkvikio may be satisfied by a natively diff --git a/python/libcudf/pyproject.toml b/python/libcudf/pyproject.toml index d64765dcd42..a4e655ebbca 100644 --- a/python/libcudf/pyproject.toml +++ b/python/libcudf/pyproject.toml @@ -39,7 +39,9 @@ classifiers = [ ] dependencies = [ "libkvikio==25.4.*,>=0.0.0a0", + "librmm==25.4.*,>=0.0.0a0", "nvidia-nvcomp==4.1.0.6", + "rapids-logger==0.1.*,>=0.0.0a0", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project.urls] @@ -81,4 +83,5 @@ requires = [ "libkvikio==25.4.*,>=0.0.0a0", "librmm==25.4.*,>=0.0.0a0", "ninja", + "rapids-logger==0.1.*,>=0.0.0a0", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.