void *
task_pingpong_black(void *arg)
{
  arg_t *	Arg = (arg_t *)arg;
  register int	i;
  int		result = 0;

  ERRHAND_TILERA(tmc_cpus_set_my_cpu(Arg->cpu));
  /*ERRHAND_TILERA*/(tmc_udn_activate());
  pthread_barrier_wait(&computation_start);

#if TEST_VERBOSE >= 1  
  printf("[INFO] black: %d\n", tmc_cpus_get_my_cpu());
#endif

  for (i=0; i<Arg->num_scambi; i++) {
    int * received;

    received = ch_receive(CH0_IMPL)(Arg->ch[0]);
    ch_send(CH1_IMPL)(Arg->ch[1], received);

    if (NULL == received) {
      result ++;
      fprintf(stderr, "[ERROR] black: null received\n");
    }
  }

  ERRHAND_TILERA(tmc_udn_close());
  return (void *)result;
}
Ejemplo n.º 2
0
void
ssmp_term_platf() 
{
  if (tmc_udn_close() != 0)
    {
      tmc_task_die("Failure in 'tmc_udn_close()'.");
    }

  free(udn_header);
}
void *
task_pingpong_white(void *arg)
{
  arg_t *	Arg = (arg_t *)arg;
  register int	i;
  int		integer;
  int		result = 0;

  ERRHAND_TILERA(tmc_cpus_set_my_cpu(Arg->cpu));
  /*ERRHAND_TILERA*/(tmc_udn_activate());
  pthread_barrier_wait(&computation_start);

#if TEST_VERBOSE >= 1
  printf("[INFO] white: cpu %d\n", tmc_cpus_get_my_cpu());
#endif
  
  for (i=0; i<Arg->num_scambi; i++) {
    int *	received = NULL;
    uint_reg_t	a, b;
    integer = i;

    a = GET_CLOCK_CYCLE;
    atomic_compiler_barrier();
    ch_send(CH0_IMPL)(Arg->ch[0], &integer);
    received = ch_receive(CH1_IMPL)(Arg->ch[1]);
    atomic_compiler_barrier();
    b = GET_CLOCK_CYCLE;

    if (b>a) { prepareStatistics(Tscambio, b-a); }
    else {
      //fprintf(stderr, "\n\n>>> %u %u \n\n", a, b);
    }

#if TEST_DEBUG >= 1
    if (b-a > 700) {
      fprintf(stderr, "i %-20d Tscambio %"PRIu64"\n", i, Tscambio[0]);      
    }
#endif

    if (NULL == received) {
      result ++;
      fprintf(stderr, "[ERROR] white: null received\n");
    } else {
      if (i != *received) result ++;
    }
  }

  ERRHAND_TILERA(tmc_udn_close());
  return (void *)result;
}