BlueBrain / CoreNeuron

Simulator optimized for large scale neural network simulations.
BSD 3-Clause "New" or "Revised" License
135 stars 38 forks source link

Introduce robust and scalable logging #316

Open ohm314 opened 4 years ago

ohm314 commented 4 years ago

The Problem

Currently logging in coreneuron is done through a variety of printfs, DEBUG ifdefs and a bit of MPI to print only on rank 0. This code is hard to maintain, messy, limiting and the output is ugly.

Considerations

Example:

auto root_logger = spdlog::basic_logger_mt("basic_logger", 0);        // rank 0 or MPI COMM SELF ?
auto all_logger = spdlog::basic_logger_mt("basic_logger", LOG_ALL);   // or MPI COMM WORLD?
spdlog::set_default_logger(root_logger);
for (int rank=0; rank<num_ranks; rank++) {
    if (rank == myrank) {
        log::debug(msg);
    }
    MPI_Barrier(comm);
}

(i.e. logger shouldn't worry about buffer caching and MPI synchronisations etc.)

Caveats

pramodk commented 4 years ago

This proposal look fine to me (some minor tweaks we can do later).

Note : MPI_Barrier based loop is needed for not mixing mpi messages but as you know that's not efficient as well. But we can discuss/decide later what to do about that.