Ejemplo n.º 1
0
void *thread_main(void *arg) {
  thread_data_t *td = arg;
  int i;
                
#if GASNET_PAR
  if (td->local_id >= threads) {
    while (!done) gasnet_AMPoll();
    return NULL;
  }

  gasnet_image_t *imagearray = test_malloc(numprocs * sizeof(gasnet_image_t));
  for (i=0; i<numprocs; ++i) { imagearray[i] = threads; }
  gasnet_coll_init(imagearray, td->mythread, NULL, 0, 0);
  test_free(imagearray);
#else
  gasnet_coll_init(NULL, 0, NULL, 0, 0);
#endif

  td->hndl = test_malloc(iters*sizeof(gasnet_coll_handle_t));

  /* Run w/ root = (first, middle, last) w/o duplication */
  for (i = 0; i < 3; ++i) {
    int root;

    if (i == 0) {
      root = 0;
    } else if (i == 1) {
      if (images < 3) continue;
      root = images / 2;
    } else {
      if (images < 2) continue;
      root = images - 1;
    }

    MSG00("Running tests with root = %d", (int)root);

    if (threads > 1) {
      MSG00("Skipping SINGLE/single-addr tests (multiple threads)");
    } else if (!TEST_ALIGNED_SEGMENTS()) {
      MSG00("Skipping SINGLE/single-addr tests (unaligned segments)");
    } else {
      testSS_NONO(root, td);
      testSS_MYMY(root, td);
      testSS_ALLALL(root, td);
      testSS_NB(root, td);
    }
    testSM_NONO(root, td);
    testSM_MYMY(root, td);
    testSM_ALLALL(root, td);
    testSM_NB(root, td);

#if 1
    testLS_NONO(root, td);
    testLS_MYMY(root, td);
    testLS_ALLALL(root, td);
    testLS_NB(root, td);

    testLM_NONO(root, td);
    testLM_MYMY(root, td);
    testLM_ALLALL(root, td);
    testLM_NB(root, td);
#endif
  }
  
  test_free(td->hndl);

  PTHREAD_LOCALBARRIER(threads);
  done = 1;

  return NULL;
}
Ejemplo n.º 2
0
void *thread_main(void *arg) {
  int flag_iter;
  thread_data_t *td = (thread_data_t*) arg;
  myxml_node_t *tuning_root, *temp, *temp2;
  char buffer[100];
  int skip_msg_printed = 0;
#if GASNET_PAR
  int i;
  gasnet_image_t *imagearray = test_malloc(nodes * sizeof(gasnet_image_t));
  for (i=0; i<nodes; ++i) { imagearray[i] = threads_per_node; }
  gasnet_coll_init(imagearray, td->mythread, NULL, 0, 0);
  test_free(imagearray);
#else
  gasnet_coll_init(NULL, td->mythread, NULL, 0, 0);
#endif
  return 0;

#if 0
  COLL_BARRIER();

  tuning_root = myxml_createNode(NULL, (char*) "machine", (char*)"CONFIG", (char*) GASNET_CONFIG_STRING, NULL);

  temp = myxml_createNodeInt(tuning_root, (char*)"num_nodes", (char*)"val", nodes, NULL);  
  temp = myxml_createNodeInt(temp, (char*)"threads_per_node", (char*)"val", threads_per_node, NULL);

  for(flag_iter=0; flag_iter<9; flag_iter++) {
    int flags;
    myxml_node_t *sync_node, *test_root;
    char buffer[8];
    COLL_BARRIER();
    

   

    switch(flag_iter) {
    case 0: flags = GASNET_COLL_IN_NOSYNC  | GASNET_COLL_OUT_NOSYNC; break;
    case 1: flags = GASNET_COLL_IN_NOSYNC  | GASNET_COLL_OUT_MYSYNC; break;
    case 2: flags = GASNET_COLL_IN_NOSYNC  | GASNET_COLL_OUT_ALLSYNC; break;
    case 3: flags = GASNET_COLL_IN_MYSYNC  | GASNET_COLL_OUT_NOSYNC; break;
    case 4: flags = GASNET_COLL_IN_MYSYNC  | GASNET_COLL_OUT_MYSYNC; break;
    case 5: flags = GASNET_COLL_IN_MYSYNC  | GASNET_COLL_OUT_ALLSYNC; break;
    case 6: flags = GASNET_COLL_IN_ALLSYNC | GASNET_COLL_OUT_NOSYNC; break;
    case 7: flags = GASNET_COLL_IN_ALLSYNC | GASNET_COLL_OUT_MYSYNC; break;
    case 8: flags = GASNET_COLL_IN_ALLSYNC | GASNET_COLL_OUT_ALLSYNC; break;
    default: continue;
    }
    

    sync_node = myxml_createNode(temp, (char*)"sync_mode", (char*)"val", fill_flag_str(flags, buffer), NULL);
    /*do single addr tests*/
 
    if (!TEST_ALIGNED_SEGMENTS()) {
      if(td->mythread == 0 && !skip_msg_printed)
        MSG0("Skipping SINGLE/SINGLE (unaligned segments)");
    } else if(threads_per_node != 1) {
      if(td->mythread == 0 && !skip_msg_printed)
        MSG0("skipping SINGLE/SINGLE (multiple threads per node)");
    } else {
      /*call the single address (coll single) test routines with testroot*/
      run_SINGLE_tree_tests(td, all_dsts, all_srcs, 0, flags | GASNET_COLL_SINGLE, sync_node);
    }
#endif

    if(threads_per_node == 1) {
      /*call the single address (coll local) test routines with testroot*/
      run_SINGLE_tree_tests(td, all_dsts, all_srcs, 0, flags | GASNET_COLL_LOCAL, sync_node);
    } else {
      if(td->mythread == 0 && !skip_msg_printed) MSG0("skipping SINGLE/LOCAL (multiple threads per node) (test unimplemetned for now)");
    }

    skip_msg_printed = 1;
    /*do multi addr tests*/

#if GASNET_ALIGNED_SEGMENTS /* Why this conditional? -PHH */
    if(threads_per_node > 1)
#endif
    {
      /*call the multi address test (coll single) routines with testroot*/
      run_MULTI_tree_tests(td, all_dsts, all_srcs, 0, flags | GASNET_COLL_SINGLE, sync_node);
      
      /*call the multi address test (coll local) routines with testroot*/
     run_MULTI_tree_tests(td, my_dsts, my_srcs, 0, flags | GASNET_COLL_LOCAL, sync_node);
    }
  }


  
  if(td->mythread==0)
    MSG0("starting dump of tuning data");
  if(td->mythread == 0){ 
    FILE *outstream=fopen(outputfile, "w");
    myxml_printTreeBIN(outstream, tuning_root);
    fclose(outstream);
 /*   myxml_printTreeXML(stdout, tuning_root, " "); */
    fflush(stdout);
    fflush(stdout);
  }
  if(td->mythread==0)
    MSG0("tuning data dumped");
      

  COLL_BARRIER();
  return 0;
#endif
}