1515#include < rapidsmpf/bootstrap/bootstrap.hpp>
1616#include < rapidsmpf/bootstrap/utils.hpp>
1717#include < rapidsmpf/communicator/communicator.hpp>
18+ #include < rapidsmpf/communicator/logger.hpp>
1819#include < rapidsmpf/error.hpp>
1920#include < rapidsmpf/nvtx.hpp>
2021#include < rapidsmpf/shuffler/shuffler.hpp>
@@ -276,6 +277,7 @@ int main(int argc, char** argv)
276277
277278 // Initialize configuration options from environment variables.
278279 rapidsmpf::config::Options options{rapidsmpf::config::get_environment_variables ()};
280+ auto log = rapidsmpf::Logger::from_options (options);
279281 auto progress_thread = std::make_shared<rapidsmpf::ProgressThread>();
280282
281283 std::shared_ptr<rapidsmpf::Communicator> comm;
@@ -288,7 +290,7 @@ int main(int argc, char** argv)
288290 return 1 ;
289291 }
290292 rapidsmpf::mpi::init (&argc, &argv);
291- comm = std::make_shared<rapidsmpf::MPI >(MPI_COMM_WORLD , options, progress_thread );
293+ comm = std::make_shared<rapidsmpf::MPI >(MPI_COMM_WORLD , progress_thread, log );
292294#else
293295 std::cerr << " Error: MPI communicator is not available in this build." << std::endl;
294296 return 1 ;
@@ -298,11 +300,11 @@ int main(int argc, char** argv)
298300 if (use_bootstrap) {
299301 // Launched with rrun - use bootstrap backend
300302 comm = rapidsmpf::bootstrap::create_ucxx_comm (
301- progress_thread, rapidsmpf::bootstrap::BackendType::AUTO , options);
303+ progress_thread, rapidsmpf::bootstrap::BackendType::AUTO , options, log );
302304 } else {
303305#ifdef CUDF_STREAMING_HAVE_MPI
304306 // Launched with mpirun - use MPI bootstrap
305- comm = rapidsmpf::ucxx::init_using_mpi (MPI_COMM_WORLD , options, progress_thread);
307+ comm = rapidsmpf::ucxx::init_using_mpi (MPI_COMM_WORLD , options, progress_thread, log );
306308#else
307309 std::cerr << " Error: UCXX without MPI support requires bootstrap mode." << std::endl;
308310 return 1 ;
@@ -344,7 +346,6 @@ int main(int argc, char** argv)
344346 auto & stat_enabled_mr = br->device_mr_adaptor ();
345347 rmm::mr::set_current_device_resource (stat_enabled_mr);
346348
347- auto & log = *comm->logger ();
348349 rmm::cuda_stream_view stream = cudf::get_default_stream ();
349350
350351 // Print benchmark/hardware info.
@@ -361,7 +362,7 @@ int main(int argc, char** argv)
361362 ss << " PCI Bus ID: " << pci_bus_id.substr (0 , pci_bus_id.find (' \0 ' )) << " \n " ;
362363 ss << " Total Memory: " << rapidsmpf::format_nbytes (properties.totalGlobalMem , 0 ) << " \n " ;
363364 ss << " Comm: " << *comm << " \n " ;
364- log. print (ss.str ());
365+ log-> print (ss.str ());
365366 }
366367
367368 auto ctx = std::make_shared<rapidsmpf::streaming::Context>(options, comm->logger (), br);
@@ -378,7 +379,7 @@ int main(int argc, char** argv)
378379 << " /s | global throughput: " << rapidsmpf::format_nbytes (args.total_nbytes / elapsed)
379380 << " /s" ;
380381 if (i < args.num_warmups ) { ss << " (warmup run)" ; }
381- log. print (ss.str ());
382+ log-> print (ss.str ());
382383 if (i >= args.num_warmups ) { elapsed_vec.push_back (elapsed); }
383384 }
384385
@@ -417,18 +418,18 @@ int main(int argc, char** argv)
417418 << rapidsmpf::format_nbytes (record.total () / static_cast <std::int64_t >(total_num_runs))
418419 << " (avg)" ;
419420 }
420- log. print (ss.str ());
421+ log-> print (ss.str ());
421422 }
422423
423424 auto statistics = ctx->statistics ();
424425 if (args.enable_memory_profiler ) {
425- log. print (statistics->report ({
426+ log-> print (statistics->report ({
426427 .mr = stat_enabled_mr,
427428 .pinned_mr = pinned_mr,
428429 .header = " Statistics (of the last run):" ,
429430 }));
430431 } else {
431- log. print (statistics->report ({.header = " Statistics (of the last run):" }));
432+ log-> print (statistics->report ({.header = " Statistics (of the last run):" }));
432433 }
433434
434435#ifdef CUDF_STREAMING_HAVE_MPI
0 commit comments