|
@@ -151,7 +151,10 @@ struct _starpu_worker_component_data
|
|
|
union
|
|
|
{
|
|
|
struct _starpu_worker * worker;
|
|
|
- struct _starpu_combined_worker * combined_worker;
|
|
|
+ struct {
|
|
|
+ unsigned worker_size;
|
|
|
+ unsigned workerids[STARPU_NMAXWORKERS];
|
|
|
+ } parallel_worker;
|
|
|
};
|
|
|
struct _starpu_worker_task_list * list;
|
|
|
};
|
|
@@ -354,12 +357,6 @@ struct _starpu_worker * _starpu_sched_component_worker_get_worker(struct starpu_
|
|
|
struct _starpu_worker_component_data * data = worker_component->data;
|
|
|
return data->worker;
|
|
|
}
|
|
|
-struct _starpu_combined_worker * _starpu_sched_component_combined_worker_get_combined_worker(struct starpu_sched_component * worker_component)
|
|
|
-{
|
|
|
- STARPU_ASSERT(starpu_sched_component_is_combined_worker(worker_component));
|
|
|
- struct _starpu_worker_component_data * data = worker_component->data;
|
|
|
- return data->combined_worker;
|
|
|
-}
|
|
|
|
|
|
/******************************************************************************
|
|
|
* Worker Components' Private Helper Functions *
|
|
@@ -602,10 +599,10 @@ static int combined_worker_can_pull(struct starpu_sched_component * component)
|
|
|
STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
|
|
|
struct _starpu_worker_component_data * data = component->data;
|
|
|
int workerid = starpu_worker_get_id();
|
|
|
- int i;
|
|
|
- for(i = 0; i < data->combined_worker->worker_size; i++)
|
|
|
+ unsigned i;
|
|
|
+ for(i = 0; i < data->parallel_worker.worker_size; i++)
|
|
|
{
|
|
|
- int target = data->combined_worker->combined_workerid[i];
|
|
|
+ int target = data->parallel_worker.workerids[i];
|
|
|
if(target == workerid)
|
|
|
continue;
|
|
|
if (starpu_wake_worker_relax_light(target))
|
|
@@ -618,25 +615,23 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
|
|
|
{
|
|
|
STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
|
|
|
struct _starpu_worker_component_data * data = component->data;
|
|
|
- STARPU_ASSERT(data->combined_worker);
|
|
|
- struct _starpu_combined_worker * combined_worker = data->combined_worker;
|
|
|
- STARPU_ASSERT(combined_worker->worker_size >= 1);
|
|
|
- struct _starpu_task_grid * task_alias[combined_worker->worker_size];
|
|
|
+ STARPU_ASSERT(data->parallel_worker.worker_size >= 1);
|
|
|
+ struct _starpu_task_grid * task_alias[data->parallel_worker.worker_size];
|
|
|
starpu_parallel_task_barrier_init(task, starpu_bitmap_first(component->workers));
|
|
|
task_alias[0] = _starpu_task_grid_create();
|
|
|
task_alias[0]->task = starpu_task_dup(task);
|
|
|
- task_alias[0]->task->workerid = combined_worker->combined_workerid[0];
|
|
|
+ task_alias[0]->task->workerid = data->parallel_worker.workerids[0];
|
|
|
task_alias[0]->task->destroy = 1;
|
|
|
task_alias[0]->left = NULL;
|
|
|
- task_alias[0]->ntasks = combined_worker->worker_size;
|
|
|
+ task_alias[0]->ntasks = data->parallel_worker.worker_size;
|
|
|
_STARPU_TRACE_JOB_PUSH(task_alias[0]->task, task_alias[0]->task->priority > 0);
|
|
|
- int i;
|
|
|
- for(i = 1; i < combined_worker->worker_size; i++)
|
|
|
+ unsigned i;
|
|
|
+ for(i = 1; i < data->parallel_worker.worker_size; i++)
|
|
|
{
|
|
|
task_alias[i] = _starpu_task_grid_create();
|
|
|
task_alias[i]->task = starpu_task_dup(task);
|
|
|
task_alias[i]->task->destroy = 1;
|
|
|
- task_alias[i]->task->workerid = combined_worker->combined_workerid[i];
|
|
|
+ task_alias[i]->task->workerid = data->parallel_worker.workerids[i];
|
|
|
task_alias[i]->left = task_alias[i-1];
|
|
|
task_alias[i - 1]->right = task_alias[i];
|
|
|
task_alias[i]->pntasks = &(task_alias[0]->ntasks);
|
|
@@ -647,7 +642,7 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
|
|
|
i = 0;
|
|
|
do
|
|
|
{
|
|
|
- struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(component->tree->sched_ctx_id, combined_worker->combined_workerid[i]);
|
|
|
+ struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(component->tree->sched_ctx_id, data->parallel_worker.workerids[i]);
|
|
|
struct _starpu_worker_component_data * worker_data = worker_component->data;
|
|
|
struct _starpu_worker_task_list * list = worker_data->list;
|
|
|
STARPU_COMPONENT_MUTEX_LOCK(&list->mutex);
|
|
@@ -658,7 +653,7 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
|
|
|
_starpu_worker_task_list_push(list, task_alias[i]);
|
|
|
i++;
|
|
|
}
|
|
|
- while(i < combined_worker->worker_size);
|
|
|
+ while(i < data->parallel_worker.worker_size);
|
|
|
|
|
|
STARPU_COMPONENT_MUTEX_UNLOCK(mutex_to_unlock);
|
|
|
|
|
@@ -670,9 +665,9 @@ static int combined_worker_push_task(struct starpu_sched_component * component,
|
|
|
else
|
|
|
{
|
|
|
/* wake up all other workers of combined worker */
|
|
|
- for(i = 0; i < combined_worker->worker_size; i++)
|
|
|
+ for(i = 0; i < data->parallel_worker.worker_size; i++)
|
|
|
{
|
|
|
- struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(component->tree->sched_ctx_id, combined_worker->combined_workerid[i]);
|
|
|
+ struct starpu_sched_component * worker_component = starpu_sched_component_worker_get(component->tree->sched_ctx_id, data->parallel_worker.workerids[i]);
|
|
|
simple_worker_can_pull(worker_component);
|
|
|
}
|
|
|
|
|
@@ -686,12 +681,11 @@ static double combined_worker_estimated_end(struct starpu_sched_component * comp
|
|
|
{
|
|
|
STARPU_ASSERT(starpu_sched_component_is_combined_worker(component));
|
|
|
struct _starpu_worker_component_data * data = component->data;
|
|
|
- struct _starpu_combined_worker * combined_worker = data->combined_worker;
|
|
|
double max = 0.0;
|
|
|
- int i;
|
|
|
- for(i = 0; i < combined_worker->worker_size; i++)
|
|
|
+ unsigned i;
|
|
|
+ for(i = 0; i < data->parallel_worker.worker_size; i++)
|
|
|
{
|
|
|
- data = _worker_components[component->tree->sched_ctx_id][combined_worker->combined_workerid[i]]->data;
|
|
|
+ data = _worker_components[component->tree->sched_ctx_id][data->parallel_worker.workerids[i]]->data;
|
|
|
double tmp = data->list->exp_end;
|
|
|
max = tmp > max ? tmp : max;
|
|
|
}
|
|
@@ -701,12 +695,11 @@ static double combined_worker_estimated_end(struct starpu_sched_component * comp
|
|
|
static double combined_worker_estimated_load(struct starpu_sched_component * component)
|
|
|
{
|
|
|
struct _starpu_worker_component_data * d = component->data;
|
|
|
- struct _starpu_combined_worker * c = d->combined_worker;
|
|
|
double load = 0;
|
|
|
- int i;
|
|
|
- for(i = 0; i < c->worker_size; i++)
|
|
|
+ unsigned i;
|
|
|
+ for(i = 0; i < d->parallel_worker.worker_size; i++)
|
|
|
{
|
|
|
- struct starpu_sched_component * n = starpu_sched_component_worker_get(component->tree->sched_ctx_id, c->combined_workerid[i]);
|
|
|
+ struct starpu_sched_component * n = starpu_sched_component_worker_get(component->tree->sched_ctx_id, d->parallel_worker.workerids[i]);
|
|
|
load += n->estimated_load(n);
|
|
|
}
|
|
|
return load;
|
|
@@ -726,7 +719,8 @@ static struct starpu_sched_component * starpu_sched_component_combined_worker_c
|
|
|
struct _starpu_worker_component_data *data;
|
|
|
_STARPU_MALLOC(data, sizeof(*data));
|
|
|
memset(data, 0, sizeof(*data));
|
|
|
- data->combined_worker = combined_worker;
|
|
|
+ data->parallel_worker.worker_size = combined_worker->worker_size;
|
|
|
+ memcpy(data->parallel_worker.workerids, combined_worker->combined_workerid, combined_worker->worker_size * sizeof(unsigned));
|
|
|
|
|
|
component->data = data;
|
|
|
component->push_task = combined_worker_push_task;
|
|
@@ -742,7 +736,7 @@ static struct starpu_sched_component * starpu_sched_component_combined_worker_c
|
|
|
#ifdef STARPU_HAVE_HWLOC
|
|
|
struct _starpu_machine_config *config = _starpu_get_machine_config();
|
|
|
struct _starpu_machine_topology *topology = &config->topology;
|
|
|
- hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, config->cpu_depth, combined_worker->combined_workerid[0]);
|
|
|
+ hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, config->cpu_depth, data->parallel_worker.workerids[0]);
|
|
|
STARPU_ASSERT(obj);
|
|
|
component->obj = obj;
|
|
|
#endif
|