NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ Reduce_timestep() [1/7]

template<typename T >
void cntr::Reduce_timestep ( int  tstp,
int  root,
herm_matrix_timestep< T > &  Gred,
herm_matrix_timestep< T > &  G 
)

MPI reduce for the herm_matrix_timestep to a herm_matrix_timestep

Purpose

MPI reduce for the herm_matrix_timestep to the root Works for scalar or square-matrix contour objects.

Parameters
tstp

time step

root

Index of root

Gred

The reduced herm_matrix_timestep on rank root.

G

The herm_matrix_timestep on the individual ranks.

Definition at line 34 of file cntr_mpitools_impl.hpp.

References cntr::herm_matrix_timestep< T >::ntau(), cntr::herm_matrix_timestep< T >::size1(), cntr::herm_matrix_timestep< T >::size2(), and cntr::herm_matrix_timestep< T >::tstp().

Referenced by Reduce_timestep().

35  {
36  assert(tstp == G.tstp());
37  int taskid;
38  MPI_Comm_rank(MPI_COMM_WORLD, &taskid);
39  if (taskid == root) {
40  assert(tstp == Gred.tstp());
41  assert(G.ntau() == Gred.ntau());
42  assert(G.size1() == Gred.size1());
43  assert(G.size2() == Gred.size2());
44  }
45 
46  int len = 2 * (2 * (tstp + 1) + G.ntau() + 1) * G.size1() * G.size2();
47 
48  if (sizeof(T) == sizeof(double)) {
49  MPI_Reduce((double *)G.data_, (double *)Gred.data_, len, MPI_DOUBLE_PRECISION, MPI_SUM, root,
50  MPI_COMM_WORLD);
51  } else {
52  if (taskid == root) std::cerr << "herm_matrix_timestep<T>::MPI_Reduce only for double " << std::endl;
53  MPI_Finalize();
54  exit(0);
55  }
56 
57 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function: