-
Notifications
You must be signed in to change notification settings - Fork 0
/
allvars.h
179 lines (144 loc) · 3.39 KB
/
allvars.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/* file to store global variables*/
#if defined(__STDC__)
# if (__STDC_VERSION__ >= 199901L)
# define _XOPEN_SOURCE 700
# endif
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdatomic.h>
#include <mpi.h>
#ifdef FITSIO
#include "fitsio.h"
#endif
#if defined (_OPENMP)
#include <omp.h>
#endif
#if defined(USE_FFTW) && !defined(CUFFTMP) // use MPI fftw
#include <fftw3-mpi.h>
#endif
#if defined(ACCOMP)
#include "w-stacking_omp.h"
#else
#include "w-stacking.h"
#endif
#if defined(NVIDIA)
#include <cuda_runtime.h>
#endif
#include "fft.h"
#include "numa.h"
#include "timing.h"
#include "errcodes.h"
#define PI 3.14159265359
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define NOVERBOSE
#define NFILES 100
#define NAME_LEN 50
#define LONGNAME_LEN 1000
#define REDUCE_MPI 0
#define REDUCE_RING 1
#if defined(DEBUG)
#define dprintf(LEVEL, T, t, ...) if( (verbose_level >= (LEVEL)) && \
( ((t) ==-1 ) || ((T)==(t)) ) ) { \
printf(__VA_ARGS__); fflush(stdout); }
#else
#define dprintf(...)
#endif
typedef double double_t;
#if defined(DOUBLE_PRECISION)
typedef double float_t;
#else
typedef float float_t;
#endif
typedef unsigned int myuint;
typedef unsigned long long myull;
extern struct io
{
FILE * pFile;
FILE * pFile1;
FILE * pFilereal;
FILE * pFileimg;
} file;
extern struct ip
{
char ufile[NAME_LEN];
char vfile[NAME_LEN];
char wfile[NAME_LEN];
char weightsfile[NAME_LEN];
char visrealfile[NAME_LEN];
char visimgfile[NAME_LEN];
char metafile[NAME_LEN];
char paramfile[NAME_LEN];
} in;
extern struct op
{
char outfile[NAME_LEN];
char outfile1[NAME_LEN];
char outfile2[NAME_LEN];
char outfile3[NAME_LEN];
char fftfile[NAME_LEN];
char gridded_writedata1[NAME_LEN];
char gridded_writedata2[NAME_LEN];
char fftfile_writedata1[NAME_LEN];
char fftfile_writedata2[NAME_LEN];
char fftfile2[NAME_LEN];
char fftfile3[NAME_LEN];
char logfile[NAME_LEN];
char extension[NAME_LEN];
char timingfile[NAME_LEN];
} out, outparam;
extern struct meta
{
myuint Nmeasures;
myull Nvis;
myuint Nweights;
myuint freq_per_chan;
myuint polarisations;
myuint Ntimes;
double dt;
double thours;
myuint baselines;
double uvmin;
double uvmax;
double wmin;
double wmax;
} metaData;
extern struct parameter
{
int num_threads;
int ndatasets;
char datapath_multi[NFILES][LONGNAME_LEN];
int grid_size_x;
int grid_size_y;
int num_w_planes;
int w_support;
int reduce_method;
} param;
extern struct fileData
{
double * uu;
double * vv;
double * ww;
float * weights;
float * visreal;
float * visimg;
}data;
extern char filename[LONGNAME_LEN], buf[NAME_LEN], num_buf[NAME_LEN];
extern char datapath[LONGNAME_LEN];
extern int xaxis, yaxis;
extern int rank;
extern int size;
extern myuint nsectors;
extern myuint startrow;
extern double_t resolution, dx, dw, w_supporth;
extern myuint **sectorarray;
extern myuint *histo_send;
extern int verbose_level;
extern myuint size_of_grid;
extern double_t *grid_pointers, *grid, *gridss, *gridss_real, *gridss_img, *gridss_w, *grid_gpu, *gridss_gpu;
extern MPI_Comm MYMPI_COMM_WORLD;
extern MPI_Win slabwin;