1#include "npbparams.h"
2
3
4/*
5c If processor array is 1x1 -> 0D grid decomposition
6
7
8c Cache blocking params. These values are good for most
9c RISC processors.
10c FFT parameters:
11c  fftblock controls how many ffts are done at a time.
12c  The default is appropriate for most cache-based machines
13c  On vector machines, the FFT can be vectorized with vector
14c  length equal to the block size, so the block size should
15c  be as large as possible. This is the size of the smallest
16c  dimension of the problem: 128 for class A, 256 for class B and
17c  512 for class C.
18*/
19
20#define	FFTBLOCK_DEFAULT	16
21#define	FFTBLOCKPAD_DEFAULT	18
22
23#define FFTBLOCK	FFTBLOCK_DEFAULT
24#define FFTBLOCKPAD	FFTBLOCKPAD_DEFAULT
25
26/* COMMON block: blockinfo */
27int fftblock;
28int fftblockpad;
29
30/*
31c we need a bunch of logic to keep track of how
32c arrays are laid out.
33
34
35c Note: this serial version is the derived from the parallel 0D case
36c of the ft NPB.
37c The computation proceeds logically as
38
39c set up initial conditions
40c fftx(1)
41c transpose (1->2)
42c ffty(2)
43c transpose (2->3)
44c fftz(3)
45c time evolution
46c fftz(3)
47c transpose (3->2)
48c ffty(2)
49c transpose (2->1)
50c fftx(1)
51c compute residual(1)
52
53c for the 0D, 1D, 2D strategies, the layouts look like xxx
54c
55c            0D        1D        2D
56c 1:        xyz       xyz       xyz
57c 2:        xyz       xyz       yxz
58c 3:        xyz       zyx       zxy
59
60c the array dimensions are stored in dims(coord, phase)
61*/
62
63/* COMMON block: layout */
64static int dims[3][3];
65static int xstart[3];
66static int ystart[3];
67static int zstart[3];
68static int xend[3];
69static int yend[3];
70static int zend[3];
71
72#define	T_TOTAL		0
73#define	T_SETUP		1
74#define	T_FFT		2
75#define	T_EVOLVE	3
76#define	T_CHECKSUM	4
77#define	T_FFTLOW	5
78#define	T_FFTCOPY	6
79#define	T_MAX		7
80
81#define	TIMERS_ENABLED	FALSE
82
83/* other stuff */
84
85#define	SEED	314159265.0
86#define	A	1220703125.0
87#define	PI	3.141592653589793238
88#define	ALPHA	1.0e-6
89
90#define	EXPMAX	(NITER_DEFAULT*(NX*NX/4+NY*NY/4+NZ*NZ/4))
91
92/* COMMON block: excomm */
93static double ex[EXPMAX+1];	/* ex(0:expmax) */
94
95/*
96c roots of unity array
97c relies on x being largest dimension?
98*/
99
100/* COMMON block: ucomm */
101static dcomplex u[NX];
102
103/* for checksum data */
104
105/* COMMON block: sumcomm */
106static dcomplex sums[NITER_DEFAULT+1]; /* sums(0:niter_default) */
107
108/* number of iterations*/
109
110/* COMMON block: iter */
111static int niter;
112
113