view src/fftw-3.3.8/libbench2/mflops.c @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents d0c2a83c1364
children
line wrap: on
line source
/* not worth copyrighting */

#include "libbench2/bench.h"
#include <math.h>

double mflops(const bench_problem *p, double t)
{
     size_t size = tensor_sz(p->sz);
     size_t vsize = tensor_sz(p->vecsz);

     if (size <= 1) /* a copy: just return reals copied / time */
	  switch (p->kind) {
	      case PROBLEM_COMPLEX:
		   return (2.0 * size * vsize / (t * 1.0e6));
	      case PROBLEM_REAL:
	      case PROBLEM_R2R:
		   return (1.0 * size * vsize / (t * 1.0e6));
	  }

     switch (p->kind) {
	 case PROBLEM_COMPLEX:
	      return (5.0 * size * vsize * log((double)size) / 
		      (log(2.0) * t * 1.0e6));
	 case PROBLEM_REAL:
	 case PROBLEM_R2R:
	      return (2.5 * vsize * size * log((double) size) / 
		      (log(2.0) * t * 1.0e6));
     }
     BENCH_ASSERT(0 /* can't happen */);
     return 0.0;
}