Add output as CSV

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2021-04-22 01:22:18 +02:00
parent fd108d97d8
commit 4c53519c73

View File

@ -57,6 +57,7 @@ int main(int argc, const char *argv[]) {
Neighbor neighbor; Neighbor neighbor;
Parameter param; Parameter param;
int atoms_per_unit_cell = 8; int atoms_per_unit_cell = 8;
int csv = 0;
LIKWID_MARKER_INIT; LIKWID_MARKER_INIT;
LIKWID_MARKER_REGISTER("force"); LIKWID_MARKER_REGISTER("force");
@ -90,6 +91,11 @@ int main(int argc, const char *argv[]) {
atoms_per_unit_cell = atoi(argv[++i]); atoms_per_unit_cell = atoi(argv[++i]);
continue; continue;
} }
if((strcmp(argv[i], "-csv") == 0))
{
csv = 1;
continue;
}
if((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) if((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0))
{ {
printf("MD Bench: A minimalistic re-implementation of miniMD\n"); printf("MD Bench: A minimalistic re-implementation of miniMD\n");
@ -153,17 +159,19 @@ int main(int argc, const char *argv[]) {
} }
} }
const double estim_volume = (double) const double estim_atom_volume = (double)(atom->Nlocal * 3 * sizeof(MD_FLOAT));
(atom->Nlocal * 6 * sizeof(MD_FLOAT) + const double estim_neighbors_volume = (double)(atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int));
atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0; const double estim_volume = (double)(atom->Nlocal * 6 * sizeof(MD_FLOAT) + estim_neighbors_volume);
printf("System size (unit cells): %dx%dx%d\n", param.nx, param.ny, param.nz);
printf("Atoms per unit cell: %d\n", atoms_per_unit_cell); if(!csv) {
printf("Total number of atoms: %d\n", atom->Nlocal); printf("Number of timesteps: %d\n", param.ntimes);
printf("Estimated total data volume (kB): %.4f\n", estim_volume ); printf("System size (unit cells): %dx%dx%d\n", param.nx, param.ny, param.nz);
printf("Estimated atom data volume (kB): %.4f\n", printf("Atoms per unit cell: %d\n", atoms_per_unit_cell);
(double)(atom->Nlocal * 3 * sizeof(MD_FLOAT) / 1000.0)); printf("Total number of atoms: %d\n", atom->Nlocal);
printf("Estimated neighborlist data volume (kB): %.4f\n", printf("Estimated total data volume (kB): %.4f\n", estim_volume / 1000.0);
(double)(atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0); printf("Estimated atom data volume (kB): %.4f\n", estim_atom_volume / 1000.0);
printf("Estimated neighborlist data volume (kB): %.4f\n", estim_neighbors_volume / 1000.0);
}
DEBUG("Initializing neighbor lists...\n"); DEBUG("Initializing neighbor lists...\n");
initNeighbor(&neighbor, &param); initNeighbor(&neighbor, &param);
@ -183,9 +191,17 @@ int main(int argc, const char *argv[]) {
LIKWID_MARKER_STOP("force"); LIKWID_MARKER_STOP("force");
E = getTimeStamp(); E = getTimeStamp();
double T_accum = E-S; double T_accum = E-S;
const double atoms_updates_per_sec = atom->Nlocal * param.ntimes / T_accum;
if(!csv) {
printf("Total time: %.4f, Mega atom updates/s: %.4f\n", T_accum, atoms_updates_per_sec / 1.E6);
} else {
printf("steps,unit cells,atoms/unit cell,total atoms,total vol.(kB),atoms vol.(kB),neigh vol.(kB),time(s),atom upds/s(M)\n");
printf("%d,%dx%dx%d,%d,%d,%.4f,%.4f,%.4f,%.4f,%.4f\n",
param.ntimes, param.nx, param.ny, param.nz, atoms_per_unit_cell, atom->Nlocal,
estim_volume / 1.E3, estim_atom_volume / 1.E3, estim_neighbors_volume / 1.E3, T_accum, atoms_updates_per_sec / 1.E6);
}
printf("Total time: %.4f, Mega atom updates/s: %.4f\n",
T_accum, atom->Nlocal * param.ntimes/T_accum/1.E6);
LIKWID_MARKER_CLOSE; LIKWID_MARKER_CLOSE;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }