Skip to content
Snippets Groups Projects
Commit 469025b2 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Move to a floating point tasks_per_cell

parent 870ba5ce
No related branches found
No related tags found
1 merge request!731Move to a floating point tasks_per_cell
...@@ -72,7 +72,7 @@ Scheduler: ...@@ -72,7 +72,7 @@ Scheduler:
cell_extra_gparts: 0 # (Optional) Number of spare gparts per top-level allocated at rebuild time for on-the-fly creation. cell_extra_gparts: 0 # (Optional) Number of spare gparts per top-level allocated at rebuild time for on-the-fly creation.
cell_extra_sparts: 400 # (Optional) Number of spare sparts per top-level allocated at rebuild time for on-the-fly creation. cell_extra_sparts: 400 # (Optional) Number of spare sparts per top-level allocated at rebuild time for on-the-fly creation.
max_top_level_cells: 12 # (Optional) Maximal number of top-level cells in any dimension. The number of top-level cells will be the cube of this (this is the default value). max_top_level_cells: 12 # (Optional) Maximal number of top-level cells in any dimension. The number of top-level cells will be the cube of this (this is the default value).
tasks_per_cell: 0 # (Optional) The average number of tasks per cell. If not large enough the simulation will fail (means guess...). tasks_per_cell: 0.0 # (Optional) The average number of tasks per cell. If not large enough the simulation will fail (means guess...).
links_per_tasks: 10 # (Optional) The average number of links per tasks (before adding the communication tasks). If not large enough the simulation will fail (means guess...). Defaults to 10. links_per_tasks: 10 # (Optional) The average number of links per tasks (before adding the communication tasks). If not large enough the simulation will fail (means guess...). Defaults to 10.
mpi_message_limit: 4096 # (Optional) Maximum MPI task message size to send non-buffered, KB. mpi_message_limit: 4096 # (Optional) Maximum MPI task message size to send non-buffered, KB.
......
...@@ -1911,8 +1911,8 @@ void engine_print_task_counts(const struct engine *e) { ...@@ -1911,8 +1911,8 @@ void engine_print_task_counts(const struct engine *e) {
else else
counts[(int)tasks[k].type] += 1; counts[(int)tasks[k].type] += 1;
} }
message("Total = %d (per cell = %d)", nr_tasks, message("Total = %d (per cell = %.2f)", nr_tasks,
(int)ceil((double)nr_tasks / e->s->tot_cells)); (float)nr_tasks / e->s->tot_cells);
#ifdef WITH_MPI #ifdef WITH_MPI
printf("[%04i] %s engine_print_task_counts: task counts are [ %s=%i", printf("[%04i] %s engine_print_task_counts: task counts are [ %s=%i",
e->nodeID, clocks_get_timesincestart(), taskID_names[0], counts[0]); e->nodeID, clocks_get_timesincestart(), taskID_names[0], counts[0]);
...@@ -1937,7 +1937,7 @@ void engine_print_task_counts(const struct engine *e) { ...@@ -1937,7 +1937,7 @@ void engine_print_task_counts(const struct engine *e) {
* @brief if necessary, estimate the number of tasks required given * @brief if necessary, estimate the number of tasks required given
* the current tasks in use and the numbers of cells. * the current tasks in use and the numbers of cells.
* *
* If e->tasks_per_cell is set greater than 0 then that value is used * If e->tasks_per_cell is set greater than 0.0 then that value is used
* as the estimate of the average number of tasks per cell, * as the estimate of the average number of tasks per cell,
* otherwise we attempt an estimate. * otherwise we attempt an estimate.
* *
...@@ -1947,8 +1947,13 @@ void engine_print_task_counts(const struct engine *e) { ...@@ -1947,8 +1947,13 @@ void engine_print_task_counts(const struct engine *e) {
*/ */
int engine_estimate_nr_tasks(const struct engine *e) { int engine_estimate_nr_tasks(const struct engine *e) {
int tasks_per_cell = e->tasks_per_cell; float tasks_per_cell = e->tasks_per_cell;
if (tasks_per_cell > 0) return e->s->tot_cells * tasks_per_cell; if (tasks_per_cell > 0.0f) {
if (e->verbose)
message("tasks per cell given as: %.2f, so maximum tasks: %d",
e->tasks_per_cell, (int)(e->s->tot_cells * tasks_per_cell));
return (int)(e->s->tot_cells * tasks_per_cell);
}
/* Our guess differs depending on the types of tasks we are using, but we /* Our guess differs depending on the types of tasks we are using, but we
* basically use a formula <n1>*ntopcells + <n2>*(totcells - ntopcells). * basically use a formula <n1>*ntopcells + <n2>*(totcells - ntopcells).
...@@ -2053,15 +2058,15 @@ int engine_estimate_nr_tasks(const struct engine *e) { ...@@ -2053,15 +2058,15 @@ int engine_estimate_nr_tasks(const struct engine *e) {
int ncells = e->s->tot_cells; int ncells = e->s->tot_cells;
#endif #endif
double ntasks = n1 * ntop + n2 * (ncells - ntop); float ntasks = n1 * ntop + n2 * (ncells - ntop);
if (ncells > 0) tasks_per_cell = ceil(ntasks / ncells); if (ncells > 0) tasks_per_cell = ceil(ntasks / ncells);
if (tasks_per_cell < 1.0) tasks_per_cell = 1.0; if (tasks_per_cell < 1.0f) tasks_per_cell = 1.0f;
if (e->verbose) if (e->verbose)
message("tasks per cell estimated as: %d, maximum tasks: %d", message("tasks per cell estimated as: %.2f, maximum tasks: %d",
tasks_per_cell, ncells * tasks_per_cell); tasks_per_cell, (int) (ncells * tasks_per_cell));
return ncells * tasks_per_cell; return (int) (ncells * tasks_per_cell);
} }
/** /**
...@@ -4689,8 +4694,8 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, ...@@ -4689,8 +4694,8 @@ void engine_config(int restart, struct engine *e, struct swift_params *params,
* On restart this number cannot be estimated (no cells yet), so we recover * On restart this number cannot be estimated (no cells yet), so we recover
* from the end of the dumped run. Can be changed on restart. */ * from the end of the dumped run. Can be changed on restart. */
e->tasks_per_cell = e->tasks_per_cell =
parser_get_opt_param_int(params, "Scheduler:tasks_per_cell", 0); parser_get_opt_param_float(params, "Scheduler:tasks_per_cell", 0.0);
int maxtasks = 0; float maxtasks = 0;
if (restart) if (restart)
maxtasks = e->restart_max_tasks; maxtasks = e->restart_max_tasks;
else else
......
...@@ -327,7 +327,7 @@ struct engine { ...@@ -327,7 +327,7 @@ struct engine {
/* Average number of tasks per cell. Used to estimate the sizes /* Average number of tasks per cell. Used to estimate the sizes
* of the various task arrays. */ * of the various task arrays. */
size_t tasks_per_cell; float tasks_per_cell;
/* Average number of links per tasks. This number is used before /* Average number of links per tasks. This number is used before
the creation of communication tasks so needs to be large enough. */ the creation of communication tasks so needs to be large enough. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment