static int _uts_main_action(void *args, size_t size)
{
	Node *root = (Node *)args;
	Node temp;

	uts_initRoot(&temp, type);

	//bots_number_of_tasks = parallel_uts(&temp);
	printf("Computing Unbalance Tree Search algorithm ");

	hpx_addr_t theThread = HPX_HERE;
	counter_t num_nodes;
	hpx_time_t start;
	struct thread_data input;

	input.depth = 0;
	memcpy(&input.parent, &temp, sizeof(Node));
	input.numChildren = getNumRootChildren(&temp);

	start = hpx_time_now();
	hpx_call_sync(theThread, _uts, &num_nodes, sizeof(num_nodes), &input, sizeof(input));
	bots_time_program = hpx_time_elapsed_ms(start)/1e3;

	bots_number_of_tasks = num_nodes;

	printf(" completed!");


	uts_show_stats();
	uts_check_result();

	hpx_shutdown(HPX_SUCCESS);
}
Beispiel #2
0
void initRootNode(Node * root, int type)
{
  uts_initRoot(root, type);

  #ifdef TRACE
    stealStack[0]->md->stealRecords[0].victimThread = 0;  // first session is own "parent session"
  #endif

#ifdef UTS_STAT
  if (stats){
    int i;
    root->ind = 0;
    root->sizeChildren = 1;
    root->maxSizeChildren = 1;
    root->pp = NULL;
    
    if (type != BIN){
      for (i=0; i<MAXNUMCHILDREN; i++){
        root->size[i] = 0;
        root->unb[i]  =.0; 
      }
    }
    else {
      int rbf = (int) ceil(b_0);
      rootSize = malloc(rbf*sizeof(int));
      rootUnb = malloc(rbf*sizeof(double));
      for (i = 0; i < rbf; i++) {
        rootSize[i] = 0;
        rootUnb[i] = 0.0;
      }
    }
  }
#endif
}
Beispiel #3
0
int main(int argc, char *argv[]) {
  Node root;
  double t1, t2;

  lace_parseParams(&argc, argv);
  uts_parseParams(argc, argv);

  uts_printParams();
  uts_initRoot(&root, type);
  
  lace_init(_lace_workers, _lace_dqsize);
  lace_startup(32*1024*1024, 0, 0);

  printf("Initialized Lace with %d workers, dqsize=%d\n", _lace_workers, _lace_dqsize);

  LACE_ME;

  t1 = uts_wctime();
  Result r = CALL(parTreeSearch, 0, &root);
  t2 = uts_wctime();

  maxTreeDepth = r.maxdepth;
  nNodes  = r.size;
  nLeaves = r.leaves;

  uts_showStats(GET_NUM_THREADS, 0, t2-t1, nNodes, nLeaves, maxTreeDepth);

  printf("Time: %f\n", t2-t1);

  lace_exit();

  return 0;
}
Beispiel #4
0
int main(int argc, char *argv[]) {
  double t1, t2;
  Node root;
  StealStack *ss;

  /* initialize stealstacks and comm. layer */
  ss = ss_init(&argc, &argv);

  /* determine benchmark parameters */
  uts_parseParams(argc, argv);

  /* Initialize trace collection structures */
  ss_initStats(ss);
 
  /* show parameter settings */
  if (ss_get_thread_num() == 0) {
      uts_printParams();
  }
  
  fflush(NULL);

  // Workers will return 1 from ss_start(), all others (managers)
  // will return 0 here once the computation ends
  if (ss_start(sizeof(Node), chunkSize)) {

      /* initialize root node and push on thread 0 stack */
      if (ss_get_thread_num() == 0) {
          uts_initRoot(&root, type);
#ifdef TRACE
	  ss_markSteal(ss, 0); // first session is own "parent session"
#endif
          ss_put_work(ss, &root);
      }
  
      /* time parallel search */
      t1 = uts_wctime();
      parTreeSearch(ss);
      t2 = uts_wctime();
      ss->walltime = t2 - t1;
#ifdef TRACE
      ss->startTime = t1;
      ss->sessionRecords[SS_IDLE][ss->entries[SS_IDLE] - 1].endTime = t2;
#endif
  }

  ss_stop();

  /* display results */
  showStats();

  ss_finalize();

  return 0;
}
static int _uts_main_action(void *args, size_t size)
{
	Node *root = (Node *)args;
	Node temp;

	uts_initRoot(&temp, type);

	//mutex = hpx_lco_sema_new(1);
	bots_number_of_tasks = parallel_uts(&temp);

	uts_show_stats();
	uts_check_result();

	hpx_exit(HPX_SUCCESS);
}
Beispiel #6
0
int main(int argc, char** argv) {
	Node root;
	const char *fn = argc > 1 ? argv[1] : "input/uts/test.input";
	uts_read_file(fn);

	std::stringstream ss;
	ss << "Unbalanced Tree Search (" << fn << ")";
	
	inncabs::run_all(
		[&](const std::launch l) {
			number_of_tasks = parallel_uts(l, &root);
			return number_of_tasks;
		},
		[&](unsigned long long nt) {
			return uts_check_result(nt);
		},
		ss.str(), 
		[&] { uts_initRoot(&root); }
		);
}