diff --git a/cpp/benchmarks/common/cudf_datagen/utils.hpp b/cpp/benchmarks/common/cudf_datagen/utils.hpp index 10e467a991f..202ef653fc0 100644 --- a/cpp/benchmarks/common/cudf_datagen/utils.hpp +++ b/cpp/benchmarks/common/cudf_datagen/utils.hpp @@ -79,6 +79,22 @@ #include #include +class rmm_logger { + public: + rmm_logger() + : existing_mr(rmm::mr::get_current_device_resource()), + logging_mr(rmm::mr::make_logging_adaptor(existing_mr)) + { + rmm::mr::set_current_device_resource(&logging_mr); + } + + ~rmm_logger() { rmm::mr::set_current_device_resource(existing_mr); } + + private: + rmm::mr::device_memory_resource* existing_mr; + rmm::mr::loggin_resource_adaptor logging_mr; +}; + class memory_stats_logger { public: memory_stats_logger() @@ -96,7 +112,6 @@ class memory_stats_logger { } private: - // TODO change to resource_ref once set_current_device_resource supports it rmm::mr::device_memory_resource* existing_mr; rmm::mr::statistics_resource_adaptor statistics_mr; };