예제 #1
0
파일: exchngc.c 프로젝트: Jiawen1991/GitHub
void 
ExchangeStart(Mesh *mesh)
{
  double   *xlocal = mesh->xlocal;
  int       maxm = mesh->maxm;
  int       lrow = mesh->lrow;
  int       up_nbr = mesh->up_nbr;
  int       down_nbr = mesh->down_nbr;
  MPI_Comm  ring_comm = mesh->ring_comm;

#ifdef V_T
  {
      static int scl = VT_NOSCL;
      static int exchangestart_state;
      
      if( scl == VT_NOSCL ) {
	  VT_scldef( __FILE__, __LINE__, &scl );
	  VT_funcdef( "ExchangeStart", communication_class, &exchangestart_state );
      }
      VT_enter( exchangestart_state, scl );
  }
#endif
  /* Send up, then receive from below */
  MPI_Irecv(xlocal, maxm, MPI_DOUBLE, down_nbr, 0, ring_comm,
	    &mesh->rq[0]);
  MPI_Irecv(xlocal + maxm * (lrow + 1), maxm, MPI_DOUBLE, up_nbr, 1,
	    ring_comm, &mesh->rq[1]);
  MPI_Isend(xlocal + maxm * lrow, maxm, MPI_DOUBLE, up_nbr, 0,
	    ring_comm, &mesh->rq[2]);
  MPI_Isend(xlocal + maxm, maxm, MPI_DOUBLE, down_nbr, 1, ring_comm,
	    &mesh->rq[3]);
#ifdef V_T
  VT_leave( VT_NOSCL );
#endif
}
예제 #2
0
int Zoltan_Timer_Init(
  ZTIMER *zt,           /* Ptr to Timer object */
  int use_barrier,      /* Flag indicating whether to perform a 
                           barrier operation before starting the
                           timer. */
  const char *name            /* Name of this timer */
)
{
/* Function that returns the index of the next available Timer timer. */
int ret;
static char *yo = "Zoltan_Timer_Init";

  TESTTIMER(zt, yo);
  
  ret = zt->NextTimeStruct++;

  if (ret >= zt->Length) {
    /* Realloc -- need more individual timers */
    zt->Length += INITLENGTH;
    zt->Times = (ZTIMER_TS *) ZOLTAN_REALLOC(zt->Times, zt->Length * sizeof(ZTIMER_TS));
  }

  Zoltan_Timer_Reset(zt, ret, use_barrier, name);

#ifdef VAMPIR
  if (VT_funcdef(name, VT_NOCLASS, &((zt->Times[ret]).vt_handle)) != VT_OK)
      FATALERROR(yo, "VT_funcdef failed.");
#endif

  return ret;
}
예제 #3
0
파일: exchngc.c 프로젝트: Jiawen1991/GitHub
void 
ExchangeEnd( Mesh *mesh)
{
  MPI_Status statuses[4];
#ifdef V_T
  {
      static int scl = VT_NOSCL;
      static int exchangeend_state;

      if( scl == VT_NOSCL ) {
	  VT_scldef( __FILE__, __LINE__, &scl );
	  VT_funcdef( "ExchangeEnd", communication_class, &exchangeend_state );
      }
      VT_enter( exchangeend_state, scl );
  }
#endif
  MPI_Waitall(4, mesh->rq, statuses);
#ifdef V_T
  VT_leave( VT_NOSCL );
#endif
}