Add timing for file IO

This commit is contained in:
Jan Eitzinger 2024-01-15 06:33:42 +01:00
parent f36089a56c
commit aa5c98a436
3 changed files with 19 additions and 0 deletions

View File

@ -73,11 +73,17 @@ int main(int argc, char** argv)
printf("Solution took %.2fs\n", timeStop - timeStart); printf("Solution took %.2fs\n", timeStop - timeStart);
} }
timeStart = getTimeStamp();
VtkOptions opts = { .grid = s.grid, .comm = s.comm }; VtkOptions opts = { .grid = s.grid, .comm = s.comm };
vtkOpen(&opts, s.problem); vtkOpen(&opts, s.problem);
vtkScalar(&opts, "pressure", s.p); vtkScalar(&opts, "pressure", s.p);
vtkVector(&opts, "velocity", (VtkVector) { s.u, s.v, s.w }); vtkVector(&opts, "velocity", (VtkVector) { s.u, s.v, s.w });
vtkClose(&opts); vtkClose(&opts);
timeStop = getTimeStamp();
if (commIsMaster(&s.comm)) {
printf("Result output took %.2fs\n", timeStop - timeStart);
}
commFinalize(&s.comm); commFinalize(&s.comm);
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -73,6 +73,7 @@ int main(int argc, char** argv)
printf("Solution took %.2fs\n", timeStop - timeStart); printf("Solution took %.2fs\n", timeStop - timeStart);
} }
timeStart = getTimeStamp();
double *pg, *ug, *vg, *wg; double *pg, *ug, *vg, *wg;
if (commIsMaster(&s.comm)) { if (commIsMaster(&s.comm)) {
@ -104,6 +105,11 @@ int main(int argc, char** argv)
vtkVector(&opts, "velocity", (VtkVector) { ug, vg, wg }); vtkVector(&opts, "velocity", (VtkVector) { ug, vg, wg });
vtkClose(&opts); vtkClose(&opts);
} }
timeStop = getTimeStamp();
if (commIsMaster(&s.comm)) {
printf("Result output took %.2fs\n", timeStop - timeStart);
}
commFinalize(&s.comm); commFinalize(&s.comm);
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -111,6 +111,7 @@ int main(int argc, char** argv)
#endif #endif
printf("Solution took %.2fs\n", timeStop - timeStart); printf("Solution took %.2fs\n", timeStop - timeStart);
timeStart = getTimeStamp();
double *pg, *ug, *vg, *wg; double *pg, *ug, *vg, *wg;
size_t bytesize = (size_t)(s.grid.imax * s.grid.jmax * s.grid.kmax) * sizeof(double); size_t bytesize = (size_t)(s.grid.imax * s.grid.jmax * s.grid.kmax) * sizeof(double);
@ -126,5 +127,11 @@ int main(int argc, char** argv)
vtkScalar(&opts, "pressure", pg); vtkScalar(&opts, "pressure", pg);
vtkVector(&opts, "velocity", (VtkVector) { ug, vg, wg }); vtkVector(&opts, "velocity", (VtkVector) { ug, vg, wg });
vtkClose(&opts); vtkClose(&opts);
timeStop = getTimeStamp();
if (commIsMaster(&s.comm)) {
printf("Result output took %.2fs\n", timeStop - timeStart);
}
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }