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); }
counter_t parallel_uts ( Node *root ) { counter_t num_nodes; bots_message("Computing Unbalance Tree Search algorithm "); #pragma omp parallel #pragma omp single nowait #pragma omp task untied num_nodes = parTreeSearch( 0, root, getNumRootChildren(root) ); bots_message(" completed!"); return num_nodes; }
counter_t parallel_uts ( Node *root ) { struct thread_data input; hpx_time_t start; hpx_addr_t theThread = HPX_HERE; counter_t num_nodes; input.depth = 0; memcpy(&input.parent, root, sizeof(Node)); input.numChildren = getNumRootChildren(root); printf("Computing Unbalance Tree Search algorithm "); hpx_addr_t done = hpx_lco_future_new(sizeof(uint64_t)); 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; printf(" completed!"); return num_nodes; }