int
MPIDO_Barrier_gi(MPID_Comm * comm)
{
  int rc;
  MPID_Comm * comm_world;
  MPID_Comm_get_ptr(MPI_COMM_WORLD, comm_world);
  DCMF_Callback_t callback = { barrier_cb_done,
			       (void *) &mpid_globalbarrier_active };

  /* initialize global active field */
  mpid_globalbarrier_active = 1;

  if (mpid_globalbarrier_restart)
    rc = DCMF_Restart (&mpid_globalbarrier_request);
  else
  {
    mpid_globalbarrier_restart = 1;
    rc = DCMF_GlobalBarrier(&MPIDI_Protocols.globalbarrier,
                            &mpid_globalbarrier_request, callback);
  }

  if (rc == DCMF_SUCCESS)
    MPID_PROGRESS_WAIT_WHILE(* (int *) callback.clientdata);

  return rc;
}
示例#2
0
void put_restart()
{

    if (myrank == 0)
    {

        DCMF_Request_t put_req[ITERATIONS + SKIP];
        DCMF_Callback_t put_done, put_ack;
        int done_count, ack_count;
        int msgsize, i;

        put_done.function = done;
        put_done.clientdata = (void *) &done_count;
        put_ack.function = done;
        put_ack.clientdata = (void *) &ack_count;

        char buffer[50];
        sprintf(buffer,
                "%20s %20s %20s",
                "Msg Size",
                "Latency(usec)",
                "Restart-latency(usec)");
        printf("%s \n", buffer);
        fflush(stdout);

        barrier();

        for (msgsize = 1; msgsize < MAX_MSG_SIZE; msgsize *= 2)
        {

            /***********************
             * warmup               *
             ***********************/
            ack_count = SKIP;
            for (i = 0; i < SKIP; i++)
            {
                DCMF_Put(&put_reg,
                         &put_req[i],
                         put_done,
                         DCMF_SEQUENTIAL_CONSISTENCY,
                         1,
                         msgsize,
                         memregion[myrank],
                         memregion[myrank + 1],
                         i * msgsize,
                         i * msgsize,
                         put_ack);
            }
            while (ack_count)
                DCMF_Messager_advance();

            /***********************
             * start timer          *
             ***********************/
            t_start = DCMF_Timebase();
            ack_count = ITERATIONS;

            for (i = SKIP; i < ITERATIONS + SKIP; i++)
            {
                DCMF_Put(&put_reg,
                         &put_req[i],
                         put_done,
                         DCMF_SEQUENTIAL_CONSISTENCY,
                         1,
                         msgsize,
                         memregion[myrank],
                         memregion[myrank + 1],
                         i * msgsize,
                         i * msgsize,
                         put_ack);
            }

            while (ack_count)
                DCMF_Messager_advance();
            t_stop = DCMF_Timebase();
            /***********************
             * stop timer          *
             ***********************/

            t_usec = ((t_stop - t_start) / clockMHz);
            printf("%20d %20.0f ", msgsize, t_usec / (ITERATIONS));

            /***********************
             * start timer          *
             ***********************/
            t_start = DCMF_Timebase();
            ack_count = ITERATIONS;

            for (i = SKIP; i < ITERATIONS + SKIP; i++)
            {
                DCMF_Restart(&put_req[i]);
            }

            while (ack_count)
                DCMF_Messager_advance();
            t_stop = DCMF_Timebase();
            /***********************
             * stop timer          *
             ***********************/

            t_usec = ((t_stop - t_start) / clockMHz);
            printf("%20.0f\n", t_usec / (ITERATIONS));

        }

        barrier();

    }
    else
    {

        barrier();

        barrier();

    }
}