Skip to content
Snippets Groups Projects
Commit 563efdde authored by Rafael Ravedutti's avatar Rafael Ravedutti
Browse files

Print stats on number of local/ghost particles

parent a955fe9b
No related branches found
No related tags found
No related merge requests found
#include "pairs.hpp"
#pragma once
using namespace std;
namespace pairs {
void print_stats(PairsSimulation *ps, int nlocal, int nghost) {
int min_nlocal = nlocal;
int max_nlocal = nlocal;
int min_nghost = nghost;
int max_nghost = nghost;
int nglobal;
if(ps->getDomainPartitioner()->getWorldSize() > 1) {
MPI_Allreduce(&nlocal, &nglobal, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
min_nlocal = nglobal;
MPI_Allreduce(&nlocal, &nglobal, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
max_nlocal = nglobal;
MPI_Allreduce(&nghost, &nglobal, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
min_nghost = nglobal;
MPI_Allreduce(&nghost, &nglobal, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
max_nghost = nglobal;
}
if(ps->getDomainPartitioner()->getRank() == 0) {
std::cout << "Number of local particles: " << min_nlocal << " / " << max_nlocal << std::endl;
std::cout << "Number of ghost particles: " << min_nghost << " / " << max_nghost << std::endl;
}
}
}
...@@ -77,6 +77,7 @@ class CGen: ...@@ -77,6 +77,7 @@ class CGen:
self.print("#include \"runtime/dem_sc_grid.hpp\"") self.print("#include \"runtime/dem_sc_grid.hpp\"")
self.print("#include \"runtime/pairs.hpp\"") self.print("#include \"runtime/pairs.hpp\"")
self.print("#include \"runtime/read_from_file.hpp\"") self.print("#include \"runtime/read_from_file.hpp\"")
self.print("#include \"runtime/stats.hpp\"")
self.print("#include \"runtime/timing.hpp\"") self.print("#include \"runtime/timing.hpp\"")
self.print("#include \"runtime/thermo.hpp\"") self.print("#include \"runtime/thermo.hpp\"")
self.print("#include \"runtime/vtk.hpp\"") self.print("#include \"runtime/vtk.hpp\"")
...@@ -135,6 +136,7 @@ class CGen: ...@@ -135,6 +136,7 @@ class CGen:
self.print(" LIKWID_MARKER_CLOSE;") self.print(" LIKWID_MARKER_CLOSE;")
self.print(" pairs::print_timers(pairs);") self.print(" pairs::print_timers(pairs);")
self.print(" pairs::print_stats(pairs, nlocal, nghost);")
self.print(" delete pairs;") self.print(" delete pairs;")
self.print(" return 0;") self.print(" return 0;")
self.print("}") self.print("}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment