Skip to content

Commit

Permalink
openmp: Correct FLOP/s calculation
Browse files Browse the repository at this point in the history
The old flop count used a different kernel implementation.
  • Loading branch information
andreipoe committed Nov 30, 2020
1 parent a8caa24 commit bb049b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
25 changes: 15 additions & 10 deletions openmp/bude.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct
double getTimestamp();
void loadParameters(int argc, char *argv[]);
void freeParameters();
void printTimings(double start, double end, double poses_per_wi);
void printTimings(double start, double end);

void runOpenMP(float *energies);

Expand Down Expand Up @@ -112,7 +112,7 @@ void runOpenMP(float *restrict results)
for (int itr = 0; itr < params.iterations; itr++)
{
#pragma omp for
for (unsigned group = 0; group < (params.nposes/WGSIZE/PPWI); group++)
for (unsigned group = 0; group < (params.nposes/WGSIZE); group++)
{
fasten_main(params.natlig, params.natpro, params.protein, params.ligand,
params.poses[0], params.poses[1], params.poses[2],
Expand All @@ -123,7 +123,7 @@ void runOpenMP(float *restrict results)

double end = getTimestamp();

printTimings(start, end, PPWI);
printTimings(start, end);
}

int parseInt(const char *str)
Expand Down Expand Up @@ -240,16 +240,21 @@ void freeParameters()
free(params.poses[i]);
}

void printTimings(double start, double end, double poses_per_wi)
void printTimings(double start, double end)
{
double ms = ((end-start)/params.iterations)*1e-3;
// Average time per iteration
double ms = ((end-start)/params.iterations)*1e-3;
double runtime = ms * 1e-3;

// Compute FLOP/s
double runtime = ms*1e-3;
double ops_per_wi = 27*poses_per_wi
+ params.natlig*(3 + 18*poses_per_wi + params.natpro*(11 + 30*poses_per_wi))
+ poses_per_wi;
double total_ops = ops_per_wi * (params.nposes/poses_per_wi);
double ops_per_wg = WGSIZE*27 +
params.natlig * (
2 +
WGSIZE*18 +
params.natpro * (10 + WGSIZE*30)
) +
WGSIZE;
double total_ops = ops_per_wg * (params.nposes/WGSIZE);
double flops = total_ops / runtime;
double gflops = flops / 1e9;

Expand Down
3 changes: 0 additions & 3 deletions openmp/bude.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ifndef PPWI
#define PPWI 1
#endif
#ifndef WGSIZE
#define WGSIZE 4
#endif
Expand Down

0 comments on commit bb049b3

Please sign in to comment.