Hoisting Logger from communicator - #1081
Conversation
Signed-off-by: niranda perera <niranda.perera@gmail.com>
|
For context, the motivation for placing the logger on the communicator itself was to allow each communicator to implement its own logging behavior. For example, a communicator could collect logs on a specific machine. We have not implemented this yet, and maybe we never will, but moving the logger out of the communicator would make that harder. |
I agree with Niranda's stance here, it's likely we never will implement that. Most cases we care about will fall into one of two categories:
IMO, decoupling |
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
madsbk
left a comment
There was a problem hiding this comment.
Alright, I am onboard, but I really don't like the rank=-1 / set_rank API. Is there any way we can avoid that?
If not, I think we should drop rank entirely and introduce a name instead.
I agree with Mads. Let's drop rank as the default for the logger and instead make |
Sure, I agree with both of you @madsbk @pentschev. Let me push the changes |
Signed-off-by: niranda perera <niranda.perera@gmail.com>
|
|
||
| public: | ||
| UCXX::Logger* logger{nullptr}; ///< UCXX logger | ||
| std::shared_ptr<Logger> logger; ///< UCXX logger (may be null before the |
There was a problem hiding this comment.
I think we can avoid the null logger now? Either create a default logger or have the ctor create one from the options?
…-out-from-communicator Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
…aperera/rapidsmpf into pull-logger-out-from-communicator
|
/merge |
Depends on rapidsai/rapidsmpf#1081 Adds new API changes to cudf polars and cudf streaming Authors: - Niranda Perera (https://github.com/nirandaperera) Approvers: - Mads R. B. Kristensen (https://github.com/madsbk) URL: #22972
This is a prerequisite to introduce a runtime environment for rapidsmpf. Historically, logger resided in the Communicator, because there were some ideas about distributed log collection. But it is unlikely that we will take that route in the future.
This PR hoists the logger from communicator to a separate header.
Changes
Loggeris now a standalone class inrapidsmpf/communicator/logger.hpp:Communicator, promoted to namespace scope asrapidsmpf::Logger.std::int32_tfor rank instead ofRank, sologger.hppdoesn't depend oncommunicator.hpp(clean one-way dependency:communicator.hppincludeslogger.hpp).Logger(config::Options)(rank defaults to-1).Logger::set_rank(std::int32_t)— thread-safe, may be called any number of times. Lets a communicator install the logger first and assign rank after bootstrap.Communicators take a
std::shared_ptr<Logger>externally:Single,MPI, andUCXXconstructors now require the caller to provide the logger.logger->set_rank(...)once the local rank is known.UCXX, the logger is stored inSharedResourcesso callbacks observed during bootstrap can log immediately.config::Optionsremoved where it was only feeding the logger:Single::Single(progress_thread, logger)MPI::MPI(comm, progress_thread, logger)UCXX::UCXX(initialized_rank, progress_thread, logger)(theoptions_member is gone)Factory functions also take an external logger:
ucxx::init_using_mpi(mpi_comm, options, progress_thread, logger)bootstrap::create_ucxx_comm(progress_thread, type, options, logger)No behavior change for users
The Python wrappers still accept
Optionsand construct thecpp_Loggerinternally, so the Python API is unchanged.