Browse Source

Fix detecting flops computation incoherency, and make it emit a warning

Samuel Thibault 5 years ago
parent
commit
967eb02c05
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/core/perfmodel/perfmodel_history.c

+ 5 - 2
src/core/perfmodel/perfmodel_history.c

@@ -1938,13 +1938,16 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 					entry->deviation = sqrt((fabs(entry->sum2 - (entry->sum*entry->sum)/n))/n);
 				}
 
-				if (j->task->flops != 0.)
+				if (j->task->flops != 0. && !isnan(entry->flops))
 				{
 					if (entry->flops == 0.)
 						entry->flops = j->task->flops;
-					else if (((entry->flops - j->task->flops) / entry->flops) > 0.00001)
+					else if ((fabs(entry->flops - j->task->flops) / entry->flops) > 0.00001)
+					{
 						/* Incoherent flops! forget about trying to record flops */
+						_STARPU_DISP("Incoherent flops in model %s: %f vs previous %f, stopping recording flops\n", model->symbol, j->task->flops, entry->flops);
 						entry->flops = NAN;
+					}
 				}
 			}