|
@@ -120,37 +120,26 @@ static void param_modified(struct starpu_top_param* d)
|
|
|
}
|
|
|
#endif /* !STARPU_USE_TOP */
|
|
|
|
|
|
-void init_heft_data(struct starpu_sched_node *node)
|
|
|
+void _heft_add_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
|
|
|
{
|
|
|
+ starpu_sched_node_add_child(node, child);
|
|
|
+ struct _starpu_heft_data * data = node->data;
|
|
|
+ starpu_sched_node_add_child(data->no_perf_model_node,child);
|
|
|
+ starpu_sched_node_add_child(data->calibrating_node, child);
|
|
|
+}
|
|
|
|
|
|
- const char *strval_alpha = getenv("STARPU_SCHED_ALPHA");
|
|
|
- if (strval_alpha)
|
|
|
- alpha = atof(strval_alpha);
|
|
|
-
|
|
|
- const char *strval_beta = getenv("STARPU_SCHED_BETA");
|
|
|
- if (strval_beta)
|
|
|
- beta = atof(strval_beta);
|
|
|
-
|
|
|
- const char *strval_gamma = getenv("STARPU_SCHED_GAMMA");
|
|
|
- if (strval_gamma)
|
|
|
- _gamma = atof(strval_gamma);
|
|
|
-
|
|
|
- const char *strval_idle_power = getenv("STARPU_IDLE_POWER");
|
|
|
- if (strval_idle_power)
|
|
|
- idle_power = atof(strval_idle_power);
|
|
|
+void _heft_remove_child(struct starpu_sched_node * node, struct starpu_sched_node * child)
|
|
|
+{
|
|
|
+ starpu_sched_node_remove_child(node, child);
|
|
|
+ struct _starpu_heft_data * data = node->data;
|
|
|
+ starpu_sched_node_remove_child(data->no_perf_model_node,child);
|
|
|
+ starpu_sched_node_remove_child(data->calibrating_node, child);
|
|
|
+}
|
|
|
|
|
|
-#ifdef STARPU_USE_TOP
|
|
|
- starpu_top_register_parameter_float("DMDA_ALPHA", &alpha,
|
|
|
- alpha_minimum, alpha_maximum, param_modified);
|
|
|
- starpu_top_register_parameter_float("DMDA_BETA", &beta,
|
|
|
- beta_minimum, beta_maximum, param_modified);
|
|
|
- starpu_top_register_parameter_float("DMDA_GAMMA", &_gamma,
|
|
|
- gamma_minimum, gamma_maximum, param_modified);
|
|
|
- starpu_top_register_parameter_float("DMDA_IDLE_POWER", &idle_power,
|
|
|
- idle_power_minimum, idle_power_maximum, param_modified);
|
|
|
-#endif /* !STARPU_USE_TOP */
|
|
|
+struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data * params)
|
|
|
+{
|
|
|
+ struct starpu_sched_node * node = starpu_sched_node_create();
|
|
|
|
|
|
- struct starpu_heft_data * params = node->data;
|
|
|
struct _starpu_heft_data * data = malloc(sizeof(*data));
|
|
|
data->alpha = params->alpha;
|
|
|
data->beta = params->beta;
|
|
@@ -158,57 +147,20 @@ void init_heft_data(struct starpu_sched_node *node)
|
|
|
data->idle_power = params->idle_power;
|
|
|
|
|
|
data->no_perf_model_node = params->no_perf_model_node_create(params->arg_no_perf_model);
|
|
|
- data->calibrating_node = params->calibrating_node_create(params->arg_calibrating_node);
|
|
|
-
|
|
|
- int i;
|
|
|
- for(i = 0; i < node->nchilds; i++)
|
|
|
- {
|
|
|
- starpu_sched_node_add_child(data->no_perf_model_node, node->childs[i]);
|
|
|
- starpu_sched_node_add_child(data->calibrating_node, node->childs[i]);
|
|
|
- }
|
|
|
- starpu_bitmap_destroy(data->no_perf_model_node->workers_in_ctx);
|
|
|
starpu_bitmap_destroy(data->no_perf_model_node->workers);
|
|
|
- data->no_perf_model_node->workers_in_ctx = node->workers_in_ctx;
|
|
|
+ starpu_bitmap_destroy(data->no_perf_model_node->workers_in_ctx);
|
|
|
data->no_perf_model_node->workers = node->workers;
|
|
|
+ data->no_perf_model_node->workers_in_ctx = node->workers_in_ctx;
|
|
|
|
|
|
+ data->calibrating_node = params->calibrating_node_create(params->arg_calibrating_node);
|
|
|
starpu_bitmap_destroy(data->calibrating_node->workers);
|
|
|
starpu_bitmap_destroy(data->calibrating_node->workers_in_ctx);
|
|
|
- data->calibrating_node->workers = data->calibrating_node->workers_in_ctx = node->workers;
|
|
|
-
|
|
|
- data->no_perf_model_node->init_data(data->no_perf_model_node);
|
|
|
- data->calibrating_node->init_data(data->calibrating_node);
|
|
|
-
|
|
|
- node->data = data;
|
|
|
- node->init_data = NULL;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void deinit_heft_data(struct starpu_sched_node * node)
|
|
|
-{
|
|
|
- struct _starpu_heft_data * data = node->data;
|
|
|
- data->calibrating_node->workers = NULL;
|
|
|
- data->calibrating_node->workers_in_ctx = NULL;
|
|
|
-
|
|
|
- data->no_perf_model_node->workers = NULL;
|
|
|
- data->no_perf_model_node->workers_in_ctx = NULL;
|
|
|
-
|
|
|
- data->calibrating_node->deinit_data(data->calibrating_node);
|
|
|
- data->no_perf_model_node->deinit_data(data->no_perf_model_node);
|
|
|
-
|
|
|
- starpu_sched_node_destroy(data->no_perf_model_node);
|
|
|
- starpu_sched_node_destroy(data->calibrating_node);
|
|
|
-
|
|
|
- free(node->data);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data * data)
|
|
|
-{
|
|
|
- struct starpu_sched_node * node = starpu_sched_node_create();
|
|
|
+ data->calibrating_node->workers = node->workers;
|
|
|
+ data->calibrating_node->workers_in_ctx = node->workers_in_ctx;
|
|
|
|
|
|
node->push_task = push_task;
|
|
|
- node->init_data = init_heft_data;
|
|
|
- node->deinit_data = deinit_heft_data;
|
|
|
+ node->add_child = _heft_add_child;
|
|
|
+ node->remove_child = _heft_remove_child;
|
|
|
node->data = data;
|
|
|
|
|
|
return node;
|
|
@@ -216,7 +168,7 @@ struct starpu_sched_node * starpu_sched_node_heft_create(struct starpu_heft_data
|
|
|
|
|
|
int starpu_sched_node_is_heft(struct starpu_sched_node * node)
|
|
|
{
|
|
|
- return node->deinit_data == deinit_heft_data;
|
|
|
+ return node->push_task == push_task;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -224,15 +176,41 @@ int starpu_sched_node_is_heft(struct starpu_sched_node * node)
|
|
|
static void initialize_heft_center_policy(unsigned sched_ctx_id)
|
|
|
{
|
|
|
starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
|
|
|
+ const char *strval_alpha = getenv("STARPU_SCHED_ALPHA");
|
|
|
+ if (strval_alpha)
|
|
|
+ alpha = atof(strval_alpha);
|
|
|
+
|
|
|
+ const char *strval_beta = getenv("STARPU_SCHED_BETA");
|
|
|
+ if (strval_beta)
|
|
|
+ beta = atof(strval_beta);
|
|
|
+
|
|
|
+ const char *strval_gamma = getenv("STARPU_SCHED_GAMMA");
|
|
|
+ if (strval_gamma)
|
|
|
+ _gamma = atof(strval_gamma);
|
|
|
+
|
|
|
+ const char *strval_idle_power = getenv("STARPU_IDLE_POWER");
|
|
|
+ if (strval_idle_power)
|
|
|
+ idle_power = atof(strval_idle_power);
|
|
|
+
|
|
|
+#ifdef STARPU_USE_TOP
|
|
|
+ starpu_top_register_parameter_float("DMDA_ALPHA", &alpha,
|
|
|
+ alpha_minimum, alpha_maximum, param_modified);
|
|
|
+ starpu_top_register_parameter_float("DMDA_BETA", &beta,
|
|
|
+ beta_minimum, beta_maximum, param_modified);
|
|
|
+ starpu_top_register_parameter_float("DMDA_GAMMA", &_gamma,
|
|
|
+ gamma_minimum, gamma_maximum, param_modified);
|
|
|
+ starpu_top_register_parameter_float("DMDA_IDLE_POWER", &idle_power,
|
|
|
+ idle_power_minimum, idle_power_maximum, param_modified);
|
|
|
+#endif /* !STARPU_USE_TOP */
|
|
|
+
|
|
|
|
|
|
struct starpu_sched_tree * t = starpu_sched_tree_create();
|
|
|
- struct starpu_sched_node * random = starpu_sched_node_random_create(NULL);
|
|
|
struct starpu_heft_data data =
|
|
|
{
|
|
|
- .alpha = 1.0,
|
|
|
- .beta = 1.0,
|
|
|
- .gamma = 1.0,
|
|
|
- .idle_power = 200,
|
|
|
+ .alpha = alpha,
|
|
|
+ .beta = beta,
|
|
|
+ .gamma = _gamma,
|
|
|
+ .idle_power = idle_power,
|
|
|
.no_perf_model_node_create = starpu_sched_node_random_create,
|
|
|
. arg_no_perf_model = NULL,
|
|
|
.calibrating_node_create = starpu_sched_node_random_create,
|
|
@@ -252,22 +230,9 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
|
|
|
|
|
|
starpu_sched_node_add_child(t->root, impl_node);
|
|
|
starpu_sched_node_set_father(impl_node, t->root, sched_ctx_id);
|
|
|
-
|
|
|
-
|
|
|
- struct starpu_sched_node * calibration_node = starpu_sched_node_calibration_create(NULL);
|
|
|
- starpu_sched_node_add_child(calibration_node, worker_node);
|
|
|
- calibration_node->workers_in_ctx = impl_node->workers;
|
|
|
- starpu_sched_node_add_child(random, calibration_node);
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
starpu_sched_node_init_rec(t->root);
|
|
|
- starpu_sched_node_init_rec(random);
|
|
|
-// _starpu_set_workers_bitmaps();
|
|
|
-// starpu_sched_tree_call_init_data(t);
|
|
|
- starpu_bitmap_destroy(random->workers_in_ctx);
|
|
|
- random->workers_in_ctx = t->root->workers_in_ctx;
|
|
|
starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)t);
|
|
|
}
|
|
|
|
|
@@ -281,7 +246,6 @@ static void deinitialize_heft_center_policy(unsigned sched_ctx_id)
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
struct starpu_sched_policy _starpu_sched_tree_heft_policy =
|
|
|
{
|
|
|
.init_sched = initialize_heft_center_policy,
|