ProcessorUpdate.cpp
1 #include "ProcessorUpdate.hpp"
2 #ifdef RICH_MPI
3 #include <mpi.h>
4 #endif
5 
7 
8 #ifdef RICH_MPI
9 double ProcessorUpdate::GetLoadImbalance(Tessellation const& tlocal,int &total)const
10 {
11  int ws;
12  MPI_Comm_size(MPI_COMM_WORLD, &ws);
13  vector<int> N(ws,0);
14  int n=tlocal.GetPointNo();
15  MPI_Allgather(&n, 1, MPI_INT, &N[0], 1, MPI_INT, MPI_COMM_WORLD);
16  total=0;
17  for(size_t i=0;i<N.size();++i)
18  total+=N[i];
19  return 1.0*(*std::max_element(N.begin(),N.end())*ws)/(1.0*total);
20 }
21 #endif
Abstract class for motion of the processor points.
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
double GetLoadImbalance(Tessellation const &tlocal, int &total) const
Calcualtes the load imbalance as max(number of points per proc)/(avg per proc)
virtual ~ProcessorUpdate(void)
virtual destructor