Update stats for cluster version

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2022-02-08 00:55:27 +01:00
parent 8deee3d954
commit 6a35a7a482
3 changed files with 22 additions and 16 deletions

View File

@ -93,8 +93,8 @@ double computeForceLJ_ref(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
} }
} }
addStat(stats->total_force_neighs, numneighs); addStat(stats->num_neighs, numneighs);
addStat(stats->total_force_iters, (numneighs + VECTOR_WIDTH - 1) / VECTOR_WIDTH); addStat(stats->force_iters, (numneighs + VECTOR_WIDTH - 1) / VECTOR_WIDTH);
} }
LIKWID_MARKER_STOP("force"); LIKWID_MARKER_STOP("force");
@ -248,8 +248,9 @@ double computeForceLJ_4xn(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
cluster_y(cifptr, 3) = simd_horizontal_sum(fiy3); cluster_y(cifptr, 3) = simd_horizontal_sum(fiy3);
cluster_z(cifptr, 3) = simd_horizontal_sum(fiz3); cluster_z(cifptr, 3) = simd_horizontal_sum(fiz3);
addStat(stats->total_force_neighs, numneighs * CLUSTER_DIM_M * CLUSTER_DIM_N); addStat(stats->calculated_forces, 1);
addStat(stats->total_force_iters, numneighs / 2); addStat(stats->num_neighs, numneighs);
addStat(stats->force_iters, numneighs / 2);
} }
LIKWID_MARKER_STOP("force"); LIKWID_MARKER_STOP("force");

View File

@ -26,8 +26,9 @@
#ifndef __STATS_H_ #ifndef __STATS_H_
#define __STATS_H_ #define __STATS_H_
typedef struct { typedef struct {
long long int total_force_neighs; long long int calculated_forces;
long long int total_force_iters; long long int num_neighs;
long long int force_iters;
} Stats; } Stats;
void initStats(Stats *s); void initStats(Stats *s);

View File

@ -6,26 +6,30 @@
#include <timers.h> #include <timers.h>
void initStats(Stats *s) { void initStats(Stats *s) {
s->total_force_neighs = 0; s->calculated_forces = 0;
s->total_force_iters = 0; s->num_neighs = 0;
s->force_iters = 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;
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)) +
(double)(stats->total_force_neighs) * (sizeof(MD_FLOAT) * 3 + sizeof(int)) ); (double)(stats->num_neighs) * (sizeof(MD_FLOAT) * 3 + sizeof(int)) );
double avg_neigh = stats->total_force_neighs / (double)(atom->Nlocal * (param->ntimes + 1)); double avg_neigh_atom = (stats->num_neighs * CLUSTER_DIM_N) / (double)(atom->Nlocal * (param->ntimes + 1));
double avg_simd = stats->total_force_iters / (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));
#ifdef EXPLICIT_TYPES #ifdef EXPLICIT_TYPES
force_useful_volume += 1e-9 * (double)((atom->Nlocal * (param->ntimes + 1)) + stats->total_force_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 neighbors per atom: %.4f\n", avg_neigh); printf("\tAverage neighbors per atom: %.4f\n", avg_neigh_atom);
printf("\tAverage neighbors per cluster: %.4f\n", avg_neigh_cluster);
printf("\tAverage SIMD iterations per atom: %.4f\n", avg_simd); printf("\tAverage SIMD iterations per atom: %.4f\n", avg_simd);
printf("\tTotal number of computed pair interactions: %lld\n", stats->total_force_neighs); printf("\tTotal number of computed pair interactions: %lld\n", stats->num_neighs * MxN);
printf("\tTotal number of SIMD iterations: %lld\n", stats->total_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->total_force_iters); printf("\tCycles/SIMD iteration: %.4f\n", timer[FORCE] * param->proc_freq * 1e9 / stats->force_iters);
#endif #endif
} }