Selaa lähdekoodia

src/core/perfmodel/perfmodel_history.c: deal with cases when there is no history for a perf model

Nathalie Furmento 11 vuotta sitten
vanhempi
commit
9858d13da9
1 muutettua tiedostoa jossa 9 lisäystä ja 3 poistoa
  1. 9 3
      src/core/perfmodel/perfmodel_history.c

+ 9 - 3
src/core/perfmodel/perfmodel_history.c

@@ -1139,17 +1139,23 @@ double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfm
 
 double _starpu_history_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct _starpu_job *j,unsigned nimpl)
 {
-	int comb = starpu_get_arch_comb(arch->ndevices, arch->devices);
+	int comb;
 	double exp = NAN;
-	if(comb == -1) return exp;
 	struct starpu_perfmodel_per_arch *per_arch_model;
 	struct starpu_perfmodel_history_entry *entry;
 	struct starpu_perfmodel_history_table *history, *elt;
+	uint32_t key;
 
-	uint32_t key = _starpu_compute_buffers_footprint(model, arch, nimpl, j);
+	comb = starpu_get_arch_comb(arch->ndevices, arch->devices);
+	if(comb == -1)
+		return NAN;
+	if (model->per_arch[comb] == NULL)
+		// The model has not been executed on this combination
+		return NAN;
 
 	per_arch_model = &model->per_arch[comb][nimpl];
 
+	key = _starpu_compute_buffers_footprint(model, arch, nimpl, j);
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&model->model_rwlock);
 	history = per_arch_model->history;
 	HASH_FIND_UINT32_T(history, &key, elt);