Browse Source

Do not load a perfmodel if its field symbol is not set

- src/core/task.c: check value of symbol before loading the model
- doc/chapters/basic-api.texi: document the feature
   (the field is already marked as mandatory when defining the
   structure starpu_perfmodel).
Nathalie Furmento 13 years ago
parent
commit
5362831fe1
2 changed files with 8 additions and 5 deletions
  1. 6 3
      doc/chapters/basic-api.texi
  2. 2 2
      src/core/task.c

+ 6 - 3
doc/chapters/basic-api.texi

@@ -1343,11 +1343,13 @@ option when configuring StarPU.
 
 
 @item @code{struct starpu_perfmodel *model} (optional)
 @item @code{struct starpu_perfmodel *model} (optional)
 This is a pointer to the task duration performance model associated to this
 This is a pointer to the task duration performance model associated to this
-codelet. This optional field is ignored when set to @code{NULL}.
+codelet. This optional field is ignored when set to @code{NULL} or
+when its @code{symbol} field is not set.
 
 
 @item @code{struct starpu_perfmodel *power_model} (optional)
 @item @code{struct starpu_perfmodel *power_model} (optional)
 This is a pointer to the task power consumption performance model associated
 This is a pointer to the task power consumption performance model associated
-to this codelet. This optional field is ignored when set to @code{NULL}.
+to this codelet. This optional field is ignored when set to
+@code{NULL} or when its @code{symbol} field is not set.
 In the case of parallel codelets, this has to account for all processing units
 In the case of parallel codelets, this has to account for all processing units
 involved in the parallel execution.
 involved in the parallel execution.
 
 
@@ -1825,7 +1827,8 @@ archs will be determined by multiplying by an arch-specific factor.
 
 
 @item @code{const char *symbol}
 @item @code{const char *symbol}
 is the symbol name for the performance model, which will be used as
 is the symbol name for the performance model, which will be used as
-file name to store the model.
+file name to store the model. It must be set otherwise the model will
+be ignored.
 
 
 @item @code{double (*cost_model)(struct starpu_buffer_descr *)}
 @item @code{double (*cost_model)(struct starpu_buffer_descr *)}
 This field is deprecated. Use instead the @code{cost_function} field.
 This field is deprecated. Use instead the @code{cost_function} field.

+ 2 - 2
src/core/task.c

@@ -390,10 +390,10 @@ int starpu_task_submit(struct starpu_task *task)
 
 
 		_starpu_detect_implicit_data_deps(task);
 		_starpu_detect_implicit_data_deps(task);
 
 
-		if (task->cl->model)
+		if (task->cl->model && task->cl->model->symbol)
 			_starpu_load_perfmodel(task->cl->model);
 			_starpu_load_perfmodel(task->cl->model);
 
 
-		if (task->cl->power_model)
+		if (task->cl->power_model && task->cl->power_model->symbol)
 			_starpu_load_perfmodel(task->cl->power_model);
 			_starpu_load_perfmodel(task->cl->power_model);
 	}
 	}