Skip to content
Snippets Groups Projects
Commit 558ecbf7 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

fix scaling of times, set initial scaling to nanoseconds, use idx_t throughout.

Former-commit-id: 98ed2bf12beb62eb75ed4fe5be48c558e5eb31b4
parent 0259e72b
Branches
Tags
No related merge requests found
...@@ -287,7 +287,7 @@ void engine_repartition ( struct engine *e ) { ...@@ -287,7 +287,7 @@ void engine_repartition ( struct engine *e ) {
#if defined(WITH_MPI) && defined(HAVE_METIS) #if defined(WITH_MPI) && defined(HAVE_METIS)
int i, j, k, l, cid, cjd, ii, jj, kk, res, w; int i, j, k, l, cid, cjd, ii, jj, kk, res;
idx_t *inds, *nodeIDs; idx_t *inds, *nodeIDs;
idx_t *weights_v, *weights_e; idx_t *weights_v, *weights_e;
struct space *s = e->s; struct space *s = e->s;
...@@ -297,7 +297,7 @@ void engine_repartition ( struct engine *e ) { ...@@ -297,7 +297,7 @@ void engine_repartition ( struct engine *e ) {
struct task *t, *tasks = e->sched.tasks; struct task *t, *tasks = e->sched.tasks;
struct cell *ci, *cj; struct cell *ci, *cj;
int nr_nodes = e->nr_nodes, nodeID = e->nodeID; int nr_nodes = e->nr_nodes, nodeID = e->nodeID;
float wscale = 1.0, vscale = 1e-3, wscale_buff; float wscale = 1e-3, vscale = 1e-3, wscale_buff;
idx_t wtot = 0; idx_t wtot = 0;
const idx_t wmax = 1e9 / e->nr_nodes; const idx_t wmax = 1e9 / e->nr_nodes;
...@@ -358,15 +358,16 @@ void engine_repartition ( struct engine *e ) { ...@@ -358,15 +358,16 @@ void engine_repartition ( struct engine *e ) {
continue; continue;
/* Get the task weight. */ /* Get the task weight. */
w = ( t->toc - t->tic ) * wscale; idx_t w = ( t->toc - t->tic ) * wscale;
if ( w < 0 ) if ( w < 0 )
error( "Bad task weight (%i)." , w ); error( "Bad task weight (%i)." , w );
/* Do we need to re-scale? */ /* Do we need to re-scale? */
wtot += w; wtot += w;
if (wtot > wmax) { while (wtot > wmax) {
wscale /= 2; wscale /= 2;
wtot /= 2; wtot /= 2;
w /= 2;
for (k = 0; k < 26 * nr_cells; k++) weights_e[k] *= 0.5; for (k = 0; k < 26 * nr_cells; k++) weights_e[k] *= 0.5;
for (k = 0; k < nr_cells; k++) weights_v[k] *= 0.5; for (k = 0; k < nr_cells; k++) weights_v[k] *= 0.5;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment