view Lib/fftw-3.2.1/libbench2/mflops.c @ 1:e86e9c111b29

Updates stuff that potentially fixes the memory leak and also makes it work on Windows and Linux (Need to test). Still have to fix fftw include for linux in Jucer.
author David Ronan <d.m.ronan@qmul.ac.uk>
date Thu, 09 Jul 2015 15:01:32 +0100
parents 25bf17994ef1
children
line wrap: on
line source
/* not worth copyrighting */

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

double mflops(const bench_problem *p, double t)
{
     int size = tensor_sz(p->sz);
     int 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;
}