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); }
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); }
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); } ); }