File: mflops.c

package info (click to toggle)
fftw3 3.3.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 28,788 kB
  • sloc: ansic: 259,336; ml: 5,474; sh: 4,457; perl: 1,666; makefile: 1,126; fortran: 110
file content (32 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* 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;
}