NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ mpi_send_block()

template<typename T >
void cntr::distributed_array< T >::mpi_send_block ( int  j,
int  dest 
)

Sends the j-th block to the MPI rank dest

Purpose

Sends the j-th block to the MPI rank (=tid_ of the block) dest

Parameters
j

Index of the block send

dest

Index of the MPI rank (=tid_ of the block) receiving the data

Definition at line 292 of file cntr_distributed_array_impl.hpp.

292  {
293  assert(0<=dest && 0<=ntasks_-1);
294  int root=tid_map_[j];
295  if(dest==root){
296  return;
297  }else{
298  int tag=100;
299  size_t int_per_t=sizeof(T)/sizeof(int);
300  size_t len=int_per_t*blocksize_;
301  if(tid_map_[j]==tid_){
302  MPI_Send((int*) block(j), len, MPI_INT, dest, tag, MPI_COMM_WORLD);
303  // MPI::COMM_WORLD.Send((int*) block(j),len,MPI::INT,dest,tag);
304  }
305  if(tid_==dest){
306  // MPI::COMM_WORLD.Recv((int*) block(j),len,MPI::INT,root,tag);
307  MPI_Recv((int*) block(j), len, MPI_INT, root, tag, MPI_COMM_WORLD,
308  MPI_STATUS_IGNORE);
309  }
310  }
311 }
T * block(int j)
Returns the pointer to block j.