NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ Reduce_timestep()

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

MPI reduce for the 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

Definition at line 2476 of file cntr_herm_matrix_timestep_impl.hpp.

2476  {
2477  assert(tstp == tstp_);
2478  int taskid;
2479  int len = 2 * (2 * (tstp_ + 1) + ntau_ + 1) * element_size_;
2480  MPI_Comm_rank(MPI_COMM_WORLD, &taskid);
2481  if (sizeof(T) == sizeof(double)) {
2482  if (taskid == root) {
2483  MPI_Reduce(MPI_IN_PLACE, (double *)this->data_, len,
2484  MPI_DOUBLE_PRECISION, MPI_SUM, root, MPI_COMM_WORLD);
2485  } else {
2486  MPI_Reduce((double *)this->data_,
2487  (double *)this->data_, len, MPI_DOUBLE_PRECISION,
2488  MPI_SUM, root, MPI_COMM_WORLD);
2489  }
2490  } else {
2491  std::cerr << "herm_matrix_timestep<T>::MPI_Reduce only for double "
2492  << std::endl;
2493  exit(0);
2494  }
2495 }