2021-10-12 22:39:54 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <atom.h>
|
|
|
|
#include <parameter.h>
|
2021-10-12 15:04:08 +02:00
|
|
|
#include <stats.h>
|
2021-10-12 22:39:54 +02:00
|
|
|
#include <timers.h>
|
2021-10-12 15:04:08 +02:00
|
|
|
|
|
|
|
void initStats(Stats *s) {
|
2022-02-08 00:55:27 +01:00
|
|
|
s->calculated_forces = 0;
|
|
|
|
s->num_neighs = 0;
|
|
|
|
s->force_iters = 0;
|
2021-10-12 15:04:08 +02:00
|
|
|
}
|
2021-10-12 22:39:54 +02:00
|
|
|
|
|
|
|
void displayStatistics(Atom *atom, Parameter *param, Stats *stats, double *timer) {
|
|
|
|
#ifdef COMPUTE_STATS
|
2022-02-08 00:55:27 +01:00
|
|
|
const int MxN = CLUSTER_DIM_M * CLUSTER_DIM_N;
|
2022-02-09 17:50:54 +01:00
|
|
|
double avg_atoms_cluster = (double)(atom->Nlocal) / (double)(atom->Nclusters_local);
|
2021-10-12 22:39:54 +02:00
|
|
|
double force_useful_volume = 1e-9 * ( (double)(atom->Nlocal * (param->ntimes + 1)) * (sizeof(MD_FLOAT) * 6 + sizeof(int)) +
|
2022-02-08 00:55:27 +01:00
|
|
|
(double)(stats->num_neighs) * (sizeof(MD_FLOAT) * 3 + sizeof(int)) );
|
|
|
|
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_simd = stats->force_iters / (double)(atom->Nlocal * (param->ntimes + 1));
|
2021-10-12 22:39:54 +02:00
|
|
|
#ifdef EXPLICIT_TYPES
|
2022-02-08 00:55:27 +01:00
|
|
|
force_useful_volume += 1e-9 * (double)((atom->Nlocal * (param->ntimes + 1)) + stats->num_neighs) * sizeof(int);
|
2021-10-12 22:39:54 +02:00
|
|
|
#endif
|
|
|
|
printf("Statistics:\n");
|
|
|
|
printf("\tVector width: %d, Processor frequency: %.4f GHz\n", VECTOR_WIDTH, param->proc_freq);
|
2022-02-09 17:50:54 +01:00
|
|
|
printf("\tAverage atoms per cluster: %.4f\n", avg_atoms_cluster);
|
2022-02-08 00:55:27 +01:00
|
|
|
printf("\tAverage neighbors per atom: %.4f\n", avg_neigh_atom);
|
|
|
|
printf("\tAverage neighbors per cluster: %.4f\n", avg_neigh_cluster);
|
2021-10-20 22:43:08 +02:00
|
|
|
printf("\tAverage SIMD iterations per atom: %.4f\n", avg_simd);
|
2022-02-08 00:55:27 +01:00
|
|
|
printf("\tTotal number of computed pair interactions: %lld\n", stats->num_neighs * MxN);
|
|
|
|
printf("\tTotal number of SIMD iterations: %lld\n", stats->force_iters);
|
2021-10-12 22:39:54 +02:00
|
|
|
printf("\tUseful read data volume for force computation: %.2fGB\n", force_useful_volume);
|
2022-02-08 00:55:27 +01:00
|
|
|
printf("\tCycles/SIMD iteration: %.4f\n", timer[FORCE] * param->proc_freq * 1e9 / stats->force_iters);
|
2021-10-12 22:39:54 +02:00
|
|
|
#endif
|
|
|
|
}
|