Browse Source

_starpu_update_perfmodel_history should not assume the combination is already created, it may not be if starpu_perfmodel_update_history() is called directly from the application

Nathalie Furmento 11 years ago
parent
commit
0bb7139719
2 changed files with 5 additions and 4 deletions
  1. 1 1
      src/core/perfmodel/perfmodel.h
  2. 4 3
      src/core/perfmodel/perfmodel_history.c

+ 1 - 1
src/core/perfmodel/perfmodel.h

@@ -83,7 +83,7 @@ double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfm
 					struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
 void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch * arch,
 				unsigned cpuid, double measured, unsigned nimpl);
-void _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch);
+int _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch);
 
 void _starpu_create_sampling_directory_if_needed(void);
 

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

@@ -1257,11 +1257,12 @@ double starpu_permodel_history_based_expected_perf(struct starpu_perfmodel *mode
 	return _starpu_history_based_job_expected_perf(model, arch, &j, j.nimpl);
 }
 
-void _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch)
+int _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch)
 {
 	int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
 	if(comb == -1)
 		comb = starpu_perfmodel_arch_comb_add(arch->ndevices, arch->devices);
+	return comb;
 }
 
 void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, unsigned cpuid STARPU_ATTRIBUTE_UNUSED, double measured, unsigned impl)
@@ -1270,8 +1271,8 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 	{
 		int c;
 		unsigned found = 0;
-		int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
-		STARPU_ASSERT(comb != -1);
+		int comb = _starpu_perfmodel_create_comb_if_needed(arch);
+
 		for(c = 0; c < model->state->ncombs; c++)
 		{
 			if(model->state->combs[c] == comb)