Skip to content

Commit

Permalink
Use mpi::gather for strings in mc_generic::collect_results
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoemi09 committed Nov 21, 2024
1 parent 1a1ca4d commit f8a396c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions c++/triqs/mc_tools/mc_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,9 @@ namespace triqs::mc_tools {
info += fmt::format("[Rank {}] Measurement durations:\n{}", c.rank(), measures_.get_timings(fmt::format("[Rank {}] ", c.rank())));
info += fmt::format("[Rank {}] Move statistics:\n{}", c.rank(), moves_.get_statistics(fmt::format("[Rank {}] ", c.rank())));

// gather all output strings on rank 0 to print in order
auto all_infos_vec = mpi::gather(std::vector<char>{info.begin(), info.end()}, c);
// gather all output string on rank 0 to print in order
auto all_infos = mpi::gather(info, c);
if (c.rank() == 0) {
std::string all_infos{all_infos_vec.begin(), all_infos_vec.end()};
report_(3) << all_infos;
std::string more_info{"\n"};
more_info += fmt::format("Total number of measures: {}\n", tot_nmeasures);
Expand Down

0 comments on commit f8a396c

Please sign in to comment.