Restructure timing and instrumentation. Add performance metric.
This commit is contained in:
12
src/force.c
12
src/force.c
@@ -39,9 +39,8 @@ double computeForce(
|
||||
MD_FLOAT sigma6 = param->sigma6;
|
||||
MD_FLOAT epsilon = param->epsilon;
|
||||
MD_FLOAT* fx = atom->fx; MD_FLOAT* fy = atom->fy; MD_FLOAT* fz = atom->fz;
|
||||
MD_FLOAT S, E;
|
||||
double S, E;
|
||||
|
||||
S = getTimeStamp();
|
||||
for(int i = 0; i < Nlocal; i++) {
|
||||
fx[i] = 0.0;
|
||||
fy[i] = 0.0;
|
||||
@@ -49,7 +48,7 @@ double computeForce(
|
||||
}
|
||||
|
||||
if(profile) {
|
||||
LIKWID_MARKER_START("force");
|
||||
// LIKWID_MARKER_START("force");
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
@@ -64,6 +63,8 @@ double computeForce(
|
||||
MD_FLOAT fiy = 0;
|
||||
MD_FLOAT fiz = 0;
|
||||
|
||||
// printf("%d: %d\n", i, numneighs);
|
||||
|
||||
for(int k = 0; k < numneighs; k++) {
|
||||
int j = neighs[k];
|
||||
MD_FLOAT delx = xtmp - atom_x(j);
|
||||
@@ -87,9 +88,8 @@ double computeForce(
|
||||
}
|
||||
|
||||
if(profile) {
|
||||
LIKWID_MARKER_STOP("force");
|
||||
// LIKWID_MARKER_STOP("force");
|
||||
}
|
||||
|
||||
E = getTimeStamp();
|
||||
return E-S;
|
||||
return 0.0;
|
||||
}
|
||||
|
@@ -158,11 +158,17 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
const double estim_volume = (double)(atom->Nlocal * 6 * sizeof(MD_FLOAT) + (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0;
|
||||
const double estim_volume = (double)
|
||||
(atom->Nlocal * 6 * sizeof(MD_FLOAT) +
|
||||
atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0;
|
||||
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);
|
||||
printf("Total number of atoms: %d\n", atom->Nlocal);
|
||||
printf("Estimated memory volume (kB): %.4f\n", estim_volume);
|
||||
printf("Estimated total data volume (kB): %.4f\n", estim_volume );
|
||||
printf("Estimated atom data volume (kB): %.4f\n",
|
||||
(double)(atom->Nlocal * 3 * sizeof(MD_FLOAT) / 1000.0));
|
||||
printf("Estimated neighborlist data volume (kB): %.4f\n",
|
||||
(double)(atom->Nlocal * (atoms_per_unit_cell - 1 + 2) * sizeof(int)) / 1000.0);
|
||||
|
||||
DEBUG("Initializing neighbor lists...\n");
|
||||
initNeighbor(&neighbor, ¶m);
|
||||
@@ -173,12 +179,18 @@ int main(int argc, const char *argv[]) {
|
||||
DEBUG("Computing forces...\n");
|
||||
computeForce(¶m, atom, &neighbor, 0);
|
||||
|
||||
double T_accum = 0.0;
|
||||
double S, E;
|
||||
S = getTimeStamp();
|
||||
LIKWID_MARKER_START("force");
|
||||
for(int i = 0; i < param.ntimes; i++) {
|
||||
T_accum += computeForce(¶m, atom, &neighbor, 1);
|
||||
computeForce(¶m, atom, &neighbor, 1);
|
||||
}
|
||||
LIKWID_MARKER_STOP("force");
|
||||
E = getTimeStamp();
|
||||
double T_accum = E-S;
|
||||
|
||||
printf("Total time: %.4f, Time/force: %.4f\n", T_accum, T_accum / param.ntimes);
|
||||
printf("Total time: %.4f, Mega atom updates/s: %.4f\n",
|
||||
T_accum, atom->Nlocal * param.ntimes/T_accum/1.E6);
|
||||
LIKWID_MARKER_CLOSE;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user