Add percentage of atoms within cutoff radius when using GROMACS reference version
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
fdd18df816
commit
e637a26844
@ -83,6 +83,9 @@ double computeForceLJ_ref(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
|
|||||||
fix += delx * force;
|
fix += delx * force;
|
||||||
fiy += dely * force;
|
fiy += dely * force;
|
||||||
fiz += delz * force;
|
fiz += delz * force;
|
||||||
|
addStat(stats->atoms_within_cutoff, 1);
|
||||||
|
} else {
|
||||||
|
addStat(stats->atoms_outside_cutoff, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,8 +96,9 @@ double computeForceLJ_ref(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addStat(stats->calculated_forces, 1);
|
||||||
addStat(stats->num_neighs, numneighs);
|
addStat(stats->num_neighs, numneighs);
|
||||||
addStat(stats->force_iters, (numneighs + VECTOR_WIDTH - 1) / VECTOR_WIDTH);
|
addStat(stats->force_iters, (long long int)((double)numneighs * CLUSTER_DIM_M / CLUSTER_DIM_N));
|
||||||
}
|
}
|
||||||
|
|
||||||
LIKWID_MARKER_STOP("force");
|
LIKWID_MARKER_STOP("force");
|
||||||
@ -250,7 +254,7 @@ double computeForceLJ_4xn(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
|
|||||||
|
|
||||||
addStat(stats->calculated_forces, 1);
|
addStat(stats->calculated_forces, 1);
|
||||||
addStat(stats->num_neighs, numneighs);
|
addStat(stats->num_neighs, numneighs);
|
||||||
addStat(stats->force_iters, numneighs / 2);
|
addStat(stats->force_iters, (long long int)((double)numneighs * CLUSTER_DIM_M / CLUSTER_DIM_N));
|
||||||
}
|
}
|
||||||
|
|
||||||
LIKWID_MARKER_STOP("force");
|
LIKWID_MARKER_STOP("force");
|
||||||
|
@ -29,6 +29,8 @@ typedef struct {
|
|||||||
long long int calculated_forces;
|
long long int calculated_forces;
|
||||||
long long int num_neighs;
|
long long int num_neighs;
|
||||||
long long int force_iters;
|
long long int force_iters;
|
||||||
|
long long int atoms_within_cutoff;
|
||||||
|
long long int atoms_outside_cutoff;
|
||||||
} Stats;
|
} Stats;
|
||||||
|
|
||||||
void initStats(Stats *s);
|
void initStats(Stats *s);
|
||||||
|
@ -9,10 +9,13 @@ void initStats(Stats *s) {
|
|||||||
s->calculated_forces = 0;
|
s->calculated_forces = 0;
|
||||||
s->num_neighs = 0;
|
s->num_neighs = 0;
|
||||||
s->force_iters = 0;
|
s->force_iters = 0;
|
||||||
|
s->atoms_within_cutoff = 0;
|
||||||
|
s->atoms_outside_cutoff = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayStatistics(Atom *atom, Parameter *param, Stats *stats, double *timer) {
|
void displayStatistics(Atom *atom, Parameter *param, Stats *stats, double *timer) {
|
||||||
#ifdef COMPUTE_STATS
|
#ifdef COMPUTE_STATS
|
||||||
|
|
||||||
const int MxN = CLUSTER_DIM_M * CLUSTER_DIM_N;
|
const int MxN = CLUSTER_DIM_M * CLUSTER_DIM_N;
|
||||||
double avg_atoms_cluster = (double)(atom->Nlocal) / (double)(atom->Nclusters_local);
|
double avg_atoms_cluster = (double)(atom->Nlocal) / (double)(atom->Nclusters_local);
|
||||||
double force_useful_volume = 1e-9 * ( (double)(atom->Nlocal * (param->ntimes + 1)) * (sizeof(MD_FLOAT) * 6 + sizeof(int)) +
|
double force_useful_volume = 1e-9 * ( (double)(atom->Nlocal * (param->ntimes + 1)) * (sizeof(MD_FLOAT) * 6 + sizeof(int)) +
|
||||||
@ -20,9 +23,11 @@ void displayStatistics(Atom *atom, Parameter *param, Stats *stats, double *timer
|
|||||||
double avg_neigh_atom = (stats->num_neighs * CLUSTER_DIM_N) / (double)(atom->Nlocal * (param->ntimes + 1));
|
double avg_neigh_atom = (stats->num_neighs * CLUSTER_DIM_N) / (double)(atom->Nlocal * (param->ntimes + 1));
|
||||||
double avg_neigh_cluster = (double)(stats->num_neighs) / (double)(stats->calculated_forces);
|
double avg_neigh_cluster = (double)(stats->num_neighs) / (double)(stats->calculated_forces);
|
||||||
double avg_simd = stats->force_iters / (double)(atom->Nlocal * (param->ntimes + 1));
|
double avg_simd = stats->force_iters / (double)(atom->Nlocal * (param->ntimes + 1));
|
||||||
#ifdef EXPLICIT_TYPES
|
|
||||||
|
#ifdef EXPLICIT_TYPES
|
||||||
force_useful_volume += 1e-9 * (double)((atom->Nlocal * (param->ntimes + 1)) + stats->num_neighs) * sizeof(int);
|
force_useful_volume += 1e-9 * (double)((atom->Nlocal * (param->ntimes + 1)) + stats->num_neighs) * sizeof(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("Statistics:\n");
|
printf("Statistics:\n");
|
||||||
printf("\tVector width: %d, Processor frequency: %.4f GHz\n", VECTOR_WIDTH, param->proc_freq);
|
printf("\tVector width: %d, Processor frequency: %.4f GHz\n", VECTOR_WIDTH, param->proc_freq);
|
||||||
printf("\tAverage atoms per cluster: %.4f\n", avg_atoms_cluster);
|
printf("\tAverage atoms per cluster: %.4f\n", avg_atoms_cluster);
|
||||||
@ -33,5 +38,11 @@ void displayStatistics(Atom *atom, Parameter *param, Stats *stats, double *timer
|
|||||||
printf("\tTotal number of SIMD iterations: %lld\n", stats->force_iters);
|
printf("\tTotal number of SIMD iterations: %lld\n", stats->force_iters);
|
||||||
printf("\tUseful read data volume for force computation: %.2fGB\n", force_useful_volume);
|
printf("\tUseful read data volume for force computation: %.2fGB\n", force_useful_volume);
|
||||||
printf("\tCycles/SIMD iteration: %.4f\n", timer[FORCE] * param->proc_freq * 1e9 / stats->force_iters);
|
printf("\tCycles/SIMD iteration: %.4f\n", timer[FORCE] * param->proc_freq * 1e9 / stats->force_iters);
|
||||||
|
|
||||||
|
#ifdef USE_REFERENCE_VERSION
|
||||||
|
const double eff_pct = (double)stats->atoms_within_cutoff / (double)(stats->atoms_within_cutoff + stats->atoms_outside_cutoff) * 100.0;
|
||||||
|
printf("\tAtoms within/outside cutoff radius: %lld/%lld (%.2f%%)\n", stats->atoms_within_cutoff, stats->atoms_outside_cutoff, eff_pct);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user