Commit 2a458da2 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Make use of the clocks_getunit() function

parent c5808890
......@@ -357,8 +357,8 @@ int main(int argc, char *argv[]) {
if (myrank == 0) {
clocks_gettime(&toc);
message("reading particle properties took %.3f ms.",
clocks_diff(&tic, &toc));
message("reading particle properties took %.3f %s.",
clocks_diff(&tic, &toc), clocks_getunit());
fflush(stdout);
}
......@@ -391,7 +391,8 @@ int main(int argc, char *argv[]) {
space_init(&s, dim, parts, N, periodic, h_max, myrank == 0);
if (myrank == 0) {
clocks_gettime(&toc);
message("space_init took %.3f ms.", clocks_diff(&tic, &toc));
message("space_init took %.3f %s.", clocks_diff(&tic, &toc),
clocks_getunit());
fflush(stdout);
}
......@@ -430,7 +431,8 @@ int main(int argc, char *argv[]) {
time_end, dt_min, dt_max);
if (myrank == 0) {
clocks_gettime(&toc);
message("engine_init took %.3f ms.", clocks_diff(&tic, &toc));
message("engine_init took %.3f %s.", clocks_diff(&tic, &toc),
clocks_getunit());
fflush(stdout);
}
......@@ -458,8 +460,8 @@ int main(int argc, char *argv[]) {
#endif
if (myrank == 0) {
clocks_gettime(&toc);
message("writing particle properties took %.3f ms.",
clocks_diff(&tic, &toc));
message("writing particle properties took %.3f %s.",
clocks_diff(&tic, &toc), clocks_getunit());
fflush(stdout);
}
}
......@@ -484,7 +486,7 @@ int main(int argc, char *argv[]) {
if (myrank == 0)
printf(
"# Step Time time-step Number of updates CPU Wall-clock time "
"[ms]\n");
"[%s]\n", clocks_getunit());
/* Let loose a runner on the space. */
for (j = 0; !engine_is_done(&e); j++) {
......
......@@ -1116,7 +1116,7 @@ int engine_marktasks(struct engine *e) {
}
}
// message( "took %.3f ms." , clocks_from_ticks(getticks() - tic));
// message( "took %.3f %s." , clocks_from_ticks(getticks() - tic), clocks_getunit());
/* All is well... */
return 0;
......@@ -1167,29 +1167,29 @@ void engine_rebuild(struct engine *e) {
/* Re-build the space. */
// tic = getticks();
space_rebuild(e->s, 0.0, e->nodeID == 0);
// message( "space_rebuild took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "space_rebuild took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* If in parallel, exchange the cell structure. */
#ifdef WITH_MPI
// tic = getticks();
engine_exchange_cells(e);
// message( "engine_exchange_cells took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "engine_exchange_cells took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
/* Re-build the tasks. */
// tic = getticks();
engine_maketasks(e);
// message( "engine_maketasks took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "engine_maketasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Run through the tasks and mark as skip or not. */
// tic = getticks();
if (engine_marktasks(e))
error("engine_marktasks failed after space_rebuild.");
// message( "engine_marktasks took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "engine_marktasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Print the status of the system */
engine_print(e);
......@@ -1210,8 +1210,8 @@ void engine_prepare(struct engine *e) {
/* Run through the tasks and mark as skip or not. */
// tic = getticks();
rebuild = (e->forcerebuild || engine_marktasks(e));
// message( "space_marktasks took %.3f ms." ,
//clocks_from_ticks((getticks() - tic)));
// message( "space_marktasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Collect the values of rebuild from all nodes. */
#ifdef WITH_MPI
......@@ -1221,8 +1221,8 @@ void engine_prepare(struct engine *e) {
MPI_SUCCESS)
error("Failed to aggregate the rebuild flag across nodes.");
rebuild = buff;
// message( "rebuild allreduce took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "rebuild allreduce took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
e->tic_step = getticks();
......@@ -1230,16 +1230,16 @@ void engine_prepare(struct engine *e) {
if (rebuild) {
// tic = getticks();
engine_rebuild(e);
// message( "engine_rebuild took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "engine_rebuild took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
}
/* Re-rank the tasks every now and then. */
if (e->tasks_age % engine_tasksreweight == 1) {
// tic = getticks();
scheduler_reweight(&e->sched);
// message( "scheduler_reweight took %.3f ms." ,
//clocks_from_ticks(getticks() -tic));
// message( "scheduler_reweight took %.3f %s." ,
//clocks_from_ticks(getticks() -tic), clocks_getunit());
}
e->tasks_age += 1;
......
......@@ -835,8 +835,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
} /* loop over the parts in ci. */
/* printf( "runner_dopair: first half took %.3f ms...\n" ,
clocks_from_ticks(getticks() - tic));
/* printf( "runner_dopair: first half took %.3f %s...\n" ,
clocks_from_ticks(getticks() - tic), clocks_getunit());
tic = getticks(); */
/* Loop over the parts in cj. */
......@@ -1138,8 +1138,8 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
} /* loop over the parts in ci. */
/* printf( "runner_dopair: first half took %.3f ms...\n" ,
clocks_from_ticks(getticks() - tic));
/* printf( "runner_dopair: first half took %.3f %s...\n" ,
clocks_from_ticks(getticks() - tic), clocks_getunit());
tic = getticks(); */
/* Loop over the parts in cj. */
......
......@@ -936,8 +936,8 @@ void scheduler_reweight(struct scheduler *s) {
if (t->type == task_type_send) t->weight = INT_MAX / 8;
if (t->type == task_type_recv) t->weight *= 1.41;
}
// message( "weighting tasks took %.3f ms." ,
//clocks_from_ticks( getticks() - tic ));
// message( "weighting tasks took %.3f %s." ,
//clocks_from_ticks( getticks() - tic ), clocks_getunit());
/* int min = tasks[0].weight, max = tasks[0].weight;
for ( k = 1 ; k < nr_tasks ; k++ )
......@@ -973,8 +973,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
s->tasks[k].wait = 1;
s->tasks[k].rid = -1;
}
// message( "waiting tasks took %.3f ms." ,
//clocks_from_ticks( getticks() - tic ) );
// message( "waiting tasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit() );
/* Enqueue a set of extraenous tasks to set the task waits. */
struct task *rewait_tasks = &s->tasks[s->nr_tasks];
......@@ -1016,8 +1016,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
pthread_cond_wait(&s->sleep_cond, &s->sleep_mutex);
}
pthread_mutex_unlock(&s->sleep_mutex);
/* message("waiting tasks took %.3f ms.",
clocks_from_ticks(getticks() - tic));*/
/* message("waiting tasks took %.3f %s.",
clocks_from_ticks(getticks() - tic), clocks_getunit());*/
s->mask = mask;
s->submask = submask | (1 << task_subtype_none);
......@@ -1033,8 +1033,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
}
}
// message( "enqueueing tasks took %.3f ms." ,
//clocks_from_ticks( getticks() - tic ));
// message( "enqueueing tasks took %.3f %s." ,
//clocks_from_ticks( getticks() - tic ), clocks_getunit());
}
/**
......
......@@ -264,8 +264,8 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
fflush(stdout);
} /* re-build upper-level cells? */
// message( "rebuilding upper-level cells took %.3f ms." ,
// clocks_from_ticks(double)(getticks() - tic));
// message( "rebuilding upper-level cells took %.3f %s." ,
// clocks_from_ticks(double)(getticks() - tic), clocks_getunit());
/* Otherwise, just clean up the cells. */
else {
......@@ -343,8 +343,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
cell_getid(cdim, p->x[0] * ih[0], p->x[1] * ih[1], p->x[2] * ih[2]);
cells[ind[k]].count++;
}
// message( "getting particle indices took %.3f ms." ,
//clocks_from_ticks(getticks() - tic)):
// message( "getting particle indices took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit()):
#ifdef WITH_MPI
/* Move non-local parts to the end of the list. */
......@@ -396,8 +396,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Sort the parts according to their cells. */
// tic = getticks();
space_parts_sort(s, ind, nr_parts, 0, s->nr_cells - 1);
// message( "parts_sort took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "parts_sort took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Re-link the gparts. */
for (k = 0; k < nr_parts; k++)
......@@ -431,16 +431,16 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
cell_getid(cdim, gp->x[0] * ih[0], gp->x[1] * ih[1], gp->x[2] * ih[2]);
cells[ind[k]].gcount++;
}
// message( "getting particle indices took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "getting particle indices took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* TODO: Here we should exchange the gparts as well! */
/* Sort the parts according to their cells. */
// tic = getticks();
gparts_sort(s->gparts, ind, nr_gparts, 0, s->nr_cells - 1);
// message( "gparts_sort took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "gparts_sort took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Re-link the parts. */
for (k = 0; k < nr_gparts; k++)
......@@ -463,8 +463,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
xfinger = &xfinger[c->count];
gfinger = &gfinger[c->gcount];
}
// message( "hooking up cells took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "hooking up cells took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
/* At this point, we have the upper-level cells, old or new. Now make
sure that the parts in each cell are ok. */
......@@ -475,8 +475,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
0, &cells[k], NULL, 0);
engine_launch(s->e, s->e->nr_threads, 1 << task_type_split_cell, 0);
// message( "space_split took %.3f ms." ,
//clocks_from_ticks(getticks() - tic));
// message( "space_split took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment