Browse Source

Factorize initialization

Samuel Thibault 5 years ago
parent
commit
a3ff446518

+ 0 - 3
src/sched_policies/component_heft.c

@@ -93,9 +93,6 @@ static int heft_progress_one(struct starpu_sched_component *component)
 		{
 		{
 			unsigned offset = component->nchildren * n;
 			unsigned offset = component->nchildren * n;
 
 
-			min_exp_end_with_task[n] = DBL_MAX;
-			max_exp_end_with_task[n] = 0.0;
-
 			nsuitable_components[n] = starpu_mct_compute_execution_times(component, tasks[n],
 			nsuitable_components[n] = starpu_mct_compute_execution_times(component, tasks[n],
 					estimated_lengths + offset,
 					estimated_lengths + offset,
 					estimated_transfer_length + offset,
 					estimated_transfer_length + offset,

+ 3 - 5
src/sched_policies/component_mct.c

@@ -2,7 +2,7 @@
  *
  *
  * Copyright (C) 2013,2017                                Inria
  * Copyright (C) 2013,2017                                Inria
  * Copyright (C) 2014,2015,2017                           CNRS
  * Copyright (C) 2014,2015,2017                           CNRS
- * Copyright (C) 2013-2018                                Université de Bordeaux
+ * Copyright (C) 2013-2019                                Université de Bordeaux
  * Copyright (C) 2013                                     Simon Archipoff
  * Copyright (C) 2013                                     Simon Archipoff
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -40,15 +40,13 @@ static int mct_push_task(struct starpu_sched_component * component, struct starp
 	unsigned i;
 	unsigned i;
 	for(i=0; i < component->nchildren; i++)
 	for(i=0; i < component->nchildren; i++)
 	{
 	{
-		estimated_lengths[i] = 0.0;
-		estimated_transfer_length[i] = 0.0;
 		estimated_ends_with_task[i] = 0.0;
 		estimated_ends_with_task[i] = 0.0;
 
 
 	}
 	}
 	/* Minimum transfer+task termination on all children */
 	/* Minimum transfer+task termination on all children */
-	double min_exp_end_with_task = DBL_MAX;
+	double min_exp_end_with_task;
 	/* Maximum transfer+task termination on all children */
 	/* Maximum transfer+task termination on all children */
-	double max_exp_end_with_task = 0.0;
+	double max_exp_end_with_task;
 
 
 	unsigned suitable_components[component->nchildren];
 	unsigned suitable_components[component->nchildren];
 	unsigned nsuitable_components = 0;
 	unsigned nsuitable_components = 0;

+ 9 - 1
src/sched_policies/helper_mct.c

@@ -2,7 +2,7 @@
  *
  *
  * Copyright (C) 2013,2017                                Inria
  * Copyright (C) 2013,2017                                Inria
  * Copyright (C) 2014-2017, 2019                          CNRS
  * Copyright (C) 2014-2017, 2019                          CNRS
- * Copyright (C) 2013,2014,2016,2017                      Université de Bordeaux
+ * Copyright (C) 2013,2014,2016,2017,2019                 Université de Bordeaux
  * Copyright (C) 2013                                     Simon Archipoff
  * Copyright (C) 2013                                     Simon Archipoff
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
 
 
 #include <starpu_sched_component.h>
 #include <starpu_sched_component.h>
 #include "helper_mct.h"
 #include "helper_mct.h"
+#include <float.h>
 
 
 /* Alpha, Beta and Gamma are MCT-specific values, which allows the
 /* Alpha, Beta and Gamma are MCT-specific values, which allows the
  * user to set more precisely the weight of each computing value.
  * user to set more precisely the weight of each computing value.
@@ -99,6 +100,11 @@ unsigned starpu_mct_compute_execution_times(struct starpu_sched_component *compo
 	for(i = 0; i < component->nchildren; i++)
 	for(i = 0; i < component->nchildren; i++)
 	{
 	{
 		struct starpu_sched_component * c = component->children[i];
 		struct starpu_sched_component * c = component->children[i];
+
+		/* Silence static analysis warnings */
+		estimated_lengths[i] = NAN;
+		estimated_transfer_length[i] = NAN;
+
 		if(starpu_sched_component_execute_preds(c, task, estimated_lengths + i))
 		if(starpu_sched_component_execute_preds(c, task, estimated_lengths + i))
 		{
 		{
 			if(isnan(estimated_lengths[i]))
 			if(isnan(estimated_lengths[i]))
@@ -120,6 +126,8 @@ void starpu_mct_compute_expected_times(struct starpu_sched_component *component,
 {
 {
 	unsigned i;
 	unsigned i;
 	double now = starpu_timing_now();
 	double now = starpu_timing_now();
+	*min_exp_end_with_task = DBL_MAX;
+	*max_exp_end_with_task = 0.0;
 	for(i = 0; i < nsuitable_components; i++)
 	for(i = 0; i < nsuitable_components; i++)
 	{
 	{
 		unsigned icomponent = suitable_components[i];
 		unsigned icomponent = suitable_components[i];