From 6a61eb1f701c01b9d00fc1c54b8d473c7b1abc45 Mon Sep 17 00:00:00 2001 From: Josh Milthorpe Date: Tue, 29 Nov 2022 00:02:02 -0500 Subject: [PATCH] fix FLOP/s calculation for OpenMP The GFLOP/s calculation in printTimings() for the OpenMP implementation was reporting incorrect (negative) values for large inputs, due to overflow. Computing ops_per_wg using long (rather than 32-bit) ints fixes the problem. --- openmp/bude.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmp/bude.c b/openmp/bude.c index f6b61db..593ec57 100644 --- a/openmp/bude.c +++ b/openmp/bude.c @@ -303,10 +303,10 @@ void printTimings(double start, double end) // Compute FLOP/s double ops_per_wg = WGSIZE*27 + - params.natlig * ( + (long)params.natlig * ( 2 + WGSIZE*18 + - params.natpro * (10 + WGSIZE*30) + (long)params.natpro * (10 + WGSIZE*30) ) + WGSIZE; double total_ops = ops_per_wg * (params.nposes/WGSIZE);