/* * Processes all the tasks put in the work queue. */ static void *empty_workQ(void *argin) { int tid; proc_t *procinfo; val_t *Wstruct; vec_t *Zstruct; tol_t *tolstruct; workQ_t *workQ; counter_t *num_left; retrieve_auxarg3 ((auxarg3_t*)argin, &tid, &procinfo, &Wstruct, &Zstruct, &tolstruct, &workQ, &num_left); int n = Wstruct->n; /* max. needed double precision work space: odr1v */ double *work = (double*)malloc(4*n*sizeof(double)); assert(work != NULL); /* max. needed double precision work space: odrrb */ int *iwork = (int*)malloc(2*n*sizeof(int)); assert(iwork != NULL); /* while loop to empty the work queue */ while (PMR_get_counter_value(num_left) > 0) { /* empty r-queue before processing other tasks */ PMR_process_r_queue (tid, procinfo, Wstruct, Zstruct, tolstruct, workQ, num_left, work, iwork); task_t *task = PMR_remove_task_at_front(workQ->s_queue); if ( task != NULL ) { assert(task->flag == SINGLETON_TASK_FLAG); PMR_process_s_task ((singleton_t*)task->data, tid, procinfo, Wstruct, Zstruct, tolstruct, num_left, work, iwork); free(task); continue; } task = PMR_remove_task_at_front(workQ->c_queue); if ( task != NULL ) { assert(task->flag == CLUSTER_TASK_FLAG); PMR_process_c_task ((cluster_t*)task->data, tid, procinfo, Wstruct, Zstruct, tolstruct, workQ, num_left, work, iwork); free(task); continue; } } /* end while */ free(work); free(iwork); return NULL; }
/* * Processes all the tasks put in the work queue. */ static void *empty_workQ(void *argin) { /* input arguments */ int tid; int nthreads; counter_t *num_left; workQ_t *workQ; in_t *Dstruct; val_t *Wstruct; vec_t *Zstruct; tol_t *tolstruct; int n; /* others */ task_t *task; double *work; int *iwork; /* retrieve necessary arguments from structures */ retrieve_aux3((aux3_t *) argin, &tid, &nthreads, &num_left, &workQ, &Dstruct, &Wstruct, &Zstruct, &tolstruct); n = Wstruct->n; /* max. needed double precision work space: dlar1v */ work = (double *) malloc( 4*n * sizeof(double) ); assert(work != NULL); /* max. needed double precision work space: dlarrb */ iwork = (int *) malloc( 2*n * sizeof(int) ); assert(iwork != NULL); /* While loop to empty the work queue */ while (PMR_get_counter_value(num_left) > 0) { task = PMR_remove_task_at_front(workQ->r_queue); if (task != NULL) { assert(task->flag == REFINEMENT_TASK_FLAG); PMR_process_r_task((refine_t *) task->data, tid, Wstruct, tolstruct, work, iwork); free(task); continue; } task = PMR_remove_task_at_front(workQ->s_queue); if ( task != NULL ) { assert(task->flag == SINGLETON_TASK_FLAG); PMR_process_s_task((singleton_t *) task->data, tid, num_left, workQ, Wstruct, Zstruct, tolstruct, work, iwork); free(task); continue; } task = PMR_remove_task_at_front(workQ->c_queue); if ( task != NULL ) { assert(task->flag == CLUSTER_TASK_FLAG); PMR_process_c_task((cluster_t *) task->data, tid, nthreads, num_left, workQ, Wstruct, Zstruct, tolstruct, work, iwork); free(task); continue; } } /* end while */ free(work); free(iwork); return(NULL); }