precision_macros.h 9.83 KB
Newer Older
1
#ifdef REALCASE
2
#undef DOUBLE_PRECISION_REAL
3
#undef SINGLE_PRECSION_REAL
4
#undef  MATH_DATATYPE
5
#undef  BLAS_TRANS_OR_CONJ
6
#undef  PRECISION
Andreas Marek's avatar
Andreas Marek committed
7
#undef  SPECIAL_COMPLEX_DATATYPE
Pavel Kus's avatar
Pavel Kus committed
8
#undef  PRECISION_STR
9
#undef  REAL_DATATYPE
Andreas Marek's avatar
Andreas Marek committed
10

11
#undef  PRECISION_TRTRI
Andreas Marek's avatar
Andreas Marek committed
12
13
#undef  PRECISION_POTRF
#undef  PRECISION_TRSM
14
15
16
17
18
19
20
21
#undef  PRECISION_GEMV
#undef  PRECISION_TRMV
#undef  PRECISION_GEMM
#undef  PRECISION_TRMM
#undef  PRECISION_HERK
#undef  PRECISION_SYRK
#undef  PRECISION_SYMV
#undef  PRECISION_SYMM
22
23
#undef  PRECISION_HEMV
#undef  PRECISION_HER2
24
25
26
27
28
29
30
31
32
33
#undef  PRECISION_SYR2
#undef  PRECISION_SYR2K
#undef  PRECISION_GEQRF
#undef  PRECISION_STEDC
#undef  PRECISION_STEQR
#undef  PRECISION_LAMRG
#undef  PRECISION_LAMCH
#undef  PRECISION_LAPY2
#undef  PRECISION_LAED4
#undef  PRECISION_LAED5
Pavel Kus's avatar
Pavel Kus committed
34
#undef  PRECISION_NRM2
35
36
37
#undef  cublas_PRECISION_GEMM
#undef  cublas_PRECISION_TRMM
#undef  cublas_PRECISION_GEMV
Pavel Kus's avatar
Pavel Kus committed
38
#undef  cublas_PRECISION_SYMV
39
#undef  scal_PRECISION_GEMM
Pavel Kus's avatar
Pavel Kus committed
40
#undef  scal_PRECISION_NRM2
41
#undef  PRECISION_SUFFIX
Andreas Marek's avatar
Andreas Marek committed
42

43
44
45
46
47
48
#undef  CONST_0_0
#undef  CONST_0_5
#undef  CONST_1_0
#undef  CONST_2_0
#undef  CONST_8_0
#undef  MPI_REAL_PRECISION
49
#undef  MPI_MATH_DATATYPE_PRECISION
50
#undef  C_DATATYPE_KIND
Andreas Marek's avatar
Andreas Marek committed
51
52
#undef THRESHOLD

Andreas Marek's avatar
Andreas Marek committed
53

Andreas Marek's avatar
Andreas Marek committed
54
/* General definitions needed in single and double case */
55
#define  MATH_DATATYPE real
56
#define  BLAS_TRANS_OR_CONJ 'T'
57

58
#ifdef DOUBLE_PRECISION
59
#define DOUBLE_PRECISION_REAL
60
#define  PRECISION double
Pavel Kus's avatar
Pavel Kus committed
61
#define  PRECISION_STR 'double'
Andreas Marek's avatar
Andreas Marek committed
62
#define  PRECISION_SUFFIX "_double"
63
#define  REAL_DATATYPE rk8
Andreas Marek's avatar
Andreas Marek committed
64
#define  SPECIAL_COMPLEX_DATATYPE ck8
65
66

#define  PRECISION_TRTRI DTRTRI
Andreas Marek's avatar
Andreas Marek committed
67
68
#define  PRECISION_POTRF DPOTRF
#define  PRECISION_TRSM DTRSM
69
70
71
72
73
74
75
76
#define  PRECISION_GEMV DGEMV
#define  PRECISION_TRMV DTRMV
#define  PRECISION_GEMM DGEMM
#define  PRECISION_TRMM DTRMM
#define  PRECISION_HERK DHERK
#define  PRECISION_SYRK DSYRK
#define  PRECISION_SYMV DSYMV
#define  PRECISION_SYMM DSYMM
77
78
#define  PRECISION_HEMV DHEMV
#define  PRECISION_HER2 DHER2
79
80
81
82
83
84
85
86
87
88
#define  PRECISION_SYR2 DSYR2
#define  PRECISION_SYR2K DSYR2K
#define  PRECISION_GEQRF DGEQRF
#define  PRECISION_STEDC DSTEDC
#define  PRECISION_STEQR DSTEQR
#define  PRECISION_LAMRG DLAMRG
#define  PRECISION_LAMCH DLAMCH
#define  PRECISION_LAPY2 DLAPY2
#define  PRECISION_LAED4 DLAED4
#define  PRECISION_LAED5 DLAED5
Pavel Kus's avatar
Pavel Kus committed
89
#define  PRECISION_NRM2 DNRM2
90
91
92
#define  cublas_PRECISION_GEMM cublas_DGEMM
#define  cublas_PRECISION_TRMM cublas_DTRMM
#define  cublas_PRECISION_GEMV cublas_DGEMV
Pavel Kus's avatar
Pavel Kus committed
93
#define  cublas_PRECISION_SYMV cublas_DSYMV
94
#define  scal_PRECISION_GEMM PDGEMM
Pavel Kus's avatar
Pavel Kus committed
95
#define  scal_PRECISION_NRM2 PDNRM2
96
97
98
99
100
101
#define  CONST_0_0 0.0_rk8
#define  CONST_0_5 0.5_rk8
#define  CONST_1_0 1.0_rk8
#define  CONST_2_0 2.0_rk8
#define  CONST_8_0 8.0_rk8
#define  MPI_REAL_PRECISION MPI_REAL8
102
#define  MPI_MATH_DATATYPE_PRECISION MPI_REAL8
103
#define  C_DATATYPE_KIND c_double
104

Andreas Marek's avatar
Andreas Marek committed
105
#define THRESHOLD 1e-11_rk8
106
#endif /* DOUBLE_PRECISION */
Andreas Marek's avatar
Andreas Marek committed
107

108
#ifdef SINGLE_PRECISION
109

110
111
#define SINGLE_PRECISION_REAL

112
#define  PRECISION single
Pavel Kus's avatar
Pavel Kus committed
113
#define  PRECISION_STR 'single'
Andreas Marek's avatar
Andreas Marek committed
114
#define  PRECISION_SUFFIX "_single"
115
#define  REAL_DATATYPE rk4
Andreas Marek's avatar
Andreas Marek committed
116
#define  SPECIAL_COMPLEX_DATATYPE ck4
Andreas Marek's avatar
Andreas Marek committed
117

118
#define  PRECISION_TRTRI STRTRI
Andreas Marek's avatar
Andreas Marek committed
119
120
#define  PRECISION_POTRF SPOTRF
#define  PRECISION_TRSM STRSM
121
122
123
124
125
126
127
128
#define  PRECISION_GEMV SGEMV
#define  PRECISION_TRMV STRMV
#define  PRECISION_GEMM SGEMM
#define  PRECISION_TRMM STRMM
#define  PRECISION_HERK SHERK
#define  PRECISION_SYRK SSYRK
#define  PRECISION_SYMV SSYMV
#define  PRECISION_SYMM SSYMM
129
130
#define  PRECISION_HEMV SHEMV
#define  PRECISION_HER2 SHER2
131
132
133
134
135
136
137
138
139
140
#define  PRECISION_SYR2 SSYR2
#define  PRECISION_SYR2K SSYR2K
#define  PRECISION_GEQRF SGEQRF
#define  PRECISION_STEDC SSTEDC
#define  PRECISION_STEQR SSTEQR
#define  PRECISION_LAMRG SLAMRG
#define  PRECISION_LAMCH SLAMCH
#define  PRECISION_LAPY2 SLAPY2
#define  PRECISION_LAED4 SLAED4
#define  PRECISION_LAED5 SLAED5
Pavel Kus's avatar
Pavel Kus committed
141
#define  PRECISION_NRM2 SNRM2
142
143
144
#define  cublas_PRECISION_GEMM cublas_SGEMM
#define  cublas_PRECISION_TRMM cublas_STRMM
#define  cublas_PRECISION_GEMV cublas_SGEMV
Pavel Kus's avatar
Pavel Kus committed
145
#define  cublas_PRECISION_SYMV cublas_SSYMV
146
#define  scal_PRECISION_GEMM PSGEMM
Pavel Kus's avatar
Pavel Kus committed
147
#define  scal_PRECISION_NRM2 PSNRM2
148
149
150
151
152
153
#define  CONST_0_0 0.0_rk4
#define  CONST_0_5 0.5_rk4
#define  CONST_1_0 1.0_rk4
#define  CONST_2_0 2.0_rk4
#define  CONST_8_0 8.0_rk4
#define  MPI_REAL_PRECISION MPI_REAL4
154
#define  MPI_MATH_DATATYPE_PRECISION MPI_REAL4
155
#define  C_DATATYPE_KIND c_float
156

Andreas Marek's avatar
Andreas Marek committed
157
#define THRESHOLD 1e-4_rk4
158
159
160
#endif /* SINGLE_PRECISION */

#endif /* REALCASE */
Andreas Marek's avatar
Andreas Marek committed
161

162
#ifdef COMPLEXCASE
163
164

#undef DOUBLE_PRECISION_COMPLEX
165
#undef SINGLE_PRECISION_COMPLEX
166
#undef  MATH_DATATYPE
167
#undef  BLAS_TRANS_OR_CONJ
168
#undef  PRECISION
169
170
171
172
#undef COMPLEX_DATATYPE
/* in the complex case also sometime real valued variables are needed */
#undef REAL_DATATYPE

173
#undef  PRECISION_TRTRI
Andreas Marek's avatar
Andreas Marek committed
174
175
#undef  PRECISION_POTRF
#undef  PRECISION_TRSM
Pavel Kus's avatar
Pavel Kus committed
176
#undef  PRECISION_STR
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#undef  PRECISION_GEMV
#undef  PRECISION_TRMV
#undef  PRECISION_GEMM
#undef  PRECISION_TRMM
#undef  PRECISION_HERK
#undef  PRECISION_SYRK
#undef  PRECISION_SYMV
#undef  PRECISION_SYMM
#undef  PRECISION_HEMV
#undef  PRECISION_HER2
#undef  PRECISION_SYR2
#undef  PRECISION_SYR2K
#undef  PRECISION_GEQRF
#undef  PRECISION_STEDC
#undef  PRECISION_STEQR
#undef  PRECISION_LAMRG
#undef  PRECISION_LAMCH
#undef  PRECISION_LAPY2
#undef  PRECISION_LAED4
#undef  PRECISION_LAED5
Pavel Kus's avatar
Pavel Kus committed
197
#undef  PRECISION_DOTC
198
199
200
#undef  cublas_PRECISION_GEMM
#undef  cublas_PRECISION_TRMM
#undef  cublas_PRECISION_GEMV
Pavel Kus's avatar
Pavel Kus committed
201
#undef  cublas_PRECISION_SYMV
202
#undef  scal_PRECISION_GEMM
Pavel Kus's avatar
Pavel Kus committed
203
#undef  scal_PRECISION_DOTC
204
205
#undef  PRECISION_SUFFIX
#undef  MPI_COMPLEX_PRECISION
206
#undef  MPI_MATH_DATATYPE_PRECISION
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#undef  MPI_COMPLEX_EXPLICIT_PRECISION
#undef  MPI_REAL_PRECISION
#undef  KIND_PRECISION
#undef  PRECISION_CMPLX
#undef  PRECISION_IMAG
#undef  PRECISION_REAL
#undef  CONST_REAL_0_0
#undef  CONST_REAL_1_0
#undef  CONST_REAL_0_5
#undef  CONST_COMPLEX_PAIR_0_0
#undef  CONST_COMPLEX_PAIR_1_0
#undef  CONST_COMPLEX_PAIR_NEGATIVE_1_0
#undef  CONST_COMPLEX_PAIR_NEGATIVE_0_5
#undef  CONST_COMPLEX_0_0
#undef  CONST_COMPLEX_1_0
222
#undef  C_DATATYPE_KIND
223

Pavel Kus's avatar
Pavel Kus committed
224

Andreas Marek's avatar
Andreas Marek committed
225
226
#undef THRESHOLD

227
228
/* General definitions needed in single and double case */
#define  MATH_DATATYPE complex
229
#define  BLAS_TRANS_OR_CONJ 'C'
230

231
#ifdef DOUBLE_PRECISION
232
233

#define DOUBLE_PRECISION_COMPLEX
234
#define  PRECISION double
Pavel Kus's avatar
Pavel Kus committed
235
#define  PRECISION_STR 'double'
Andreas Marek's avatar
Andreas Marek committed
236
#define  PRECISION_SUFFIX "_double"
237
238
239
#define COMPLEX_DATATYPE CK8
#define REAL_DATATYPE RK8

240
#define  PRECISION_TRTRI ZTRTRI
Andreas Marek's avatar
Andreas Marek committed
241
242
#define  PRECISION_POTRF ZPOTRF
#define  PRECISION_TRSM ZTRSM
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#define  PRECISION_GEMV ZGEMV
#define  PRECISION_TRMV ZTRMV
#define  PRECISION_GEMM ZGEMM
#define  PRECISION_TRMM ZTRMM
#define  PRECISION_HERK ZHERK
#define  PRECISION_SYRK ZSYRK
#define  PRECISION_SYMV ZSYMV
#define  PRECISION_SYMM ZSYMM
#define  PRECISION_HEMV ZHEMV
#define  PRECISION_HER2 ZHER2
#define  PRECISION_SYR2 ZSYR2
#define  PRECISION_SYR2K ZSYR2K
#define  PRECISION_GEQRF ZGEQRF
#define  PRECISION_STEDC ZSTEDC
#define  PRECISION_STEQR ZSTEQR
#define  PRECISION_LAMRG ZLAMRG
#define  PRECISION_LAMCH ZLAMCH
#define  PRECISION_LAPY2 ZLAPY2
#define  PRECISION_LAED4 ZLAED4
#define  PRECISION_LAED5 ZLAED5
Pavel Kus's avatar
Pavel Kus committed
263
#define  PRECISION_DOTC ZDOTC
264
265
266
#define  cublas_PRECISION_GEMM cublas_ZGEMM
#define  cublas_PRECISION_TRMM cublas_ZTRMM
#define  cublas_PRECISION_GEMV cublas_ZGEMV
Pavel Kus's avatar
Pavel Kus committed
267
#define  cublas_PRECISION_SYMV cublas_ZSYMV
268
#define  scal_PRECISION_GEMM PZGEMM
Pavel Kus's avatar
Pavel Kus committed
269
#define  scal_PRECISION_DOTC PZDOTC
270
#define  MPI_COMPLEX_PRECISION MPI_DOUBLE_COMPLEX
271
#define  MPI_MATH_DATATYPE_PRECISION MPI_DOUBLE_COMPLEX
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#define  MPI_COMPLEX_EXPLICIT_PRECISION MPI_COMPLEX16
#define  MPI_REAL_PRECISION MPI_REAL8
#define  KIND_PRECISION rk8
#define  PRECISION_CMPLX DCMPLX
#define  PRECISION_IMAG DIMAG
#define  PRECISION_REAL DREAL
#define  CONST_REAL_0_0 0.0_rk8
#define  CONST_REAL_1_0 1.0_rk8
#define  CONST_REAL_0_5 0.5_rk8
#define  CONST_COMPLEX_PAIR_0_0 (0.0_rk8,0.0_rk8)
#define  CONST_COMPLEX_PAIR_1_0 (1.0_rk8,0.0_rk8)
#define  CONST_COMPLEX_PAIR_NEGATIVE_1_0 (-1.0_rk8,0.0_rk8)
#define  CONST_COMPLEX_PAIR_NEGATIVE_0_5 (-0.5_rk8,0.0_rk8)
#define  CONST_COMPLEX_0_0 0.0_ck8
#define  CONST_COMPLEX_1_0 1.0_ck8
287
#define  C_DATATYPE_KIND c_double
288

Andreas Marek's avatar
Andreas Marek committed
289
#define THRESHOLD 1e-11_rk8
290
291
#endif /* DOUBLE PRECISION */

292
#ifdef SINGLE_PRECISION
293
#define SINGLE_PRECISION_COMPLEX
294
#define  PRECISION single
Pavel Kus's avatar
Pavel Kus committed
295
#define  PRECISION_STR 'single'
Andreas Marek's avatar
Andreas Marek committed
296
#define  PRECISION_SUFFIX "_single"
297
298
299
#define COMPLEX_DATATYPE CK4
#define REAL_DATATYPE RK4

300
#define  PRECISION_TRTRI CTRTRI
Andreas Marek's avatar
Andreas Marek committed
301
302
#define  PRECISION_POTRF CPOTRF
#define  PRECISION_TRSM CTRSM
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#define  PRECISION_GEMV CGEMV
#define  PRECISION_TRMV CTRMV
#define  PRECISION_GEMM CGEMM
#define  PRECISION_TRMM CTRMM
#define  PRECISION_HERK CHERK
#define  PRECISION_SYRK CSYRK
#define  PRECISION_SYMV CSYMV
#define  PRECISION_SYMM CSYMM
#define  PRECISION_HEMV CHEMV
#define  PRECISION_HER2 CHER2
#define  PRECISION_SYR2 CSYR2
#define  PRECISION_SYR2K CSYR2K
#define  PRECISION_GEQRF CGEQRF
#define  PRECISION_STEDC CSTEDC
#define  PRECISION_STEQR CSTEQR
#define  PRECISION_LAMRG CLAMRG
#define  PRECISION_LAMCH CLAMCH
#define  PRECISION_LAPY2 CLAPY2
#define  PRECISION_LAED4 CLAED4
#define  PRECISION_LAED5 CLAED5
Pavel Kus's avatar
Pavel Kus committed
323
#define  PRECISION_DOTC CDOTC
324
325
326
#define  cublas_PRECISION_GEMM cublas_CGEMM
#define  cublas_PRECISION_TRMM cublas_CTRMM
#define  cublas_PRECISION_GEMV cublas_CGEMV
Pavel Kus's avatar
Pavel Kus committed
327
#define  cublas_PRECISION_SYMV cublas_CSYMV
328
#define  scal_PRECISION_GEMM PCGEMM
Pavel Kus's avatar
Pavel Kus committed
329
#define  scal_PRECISION_DOTC PCDOTC
330
#define  MPI_COMPLEX_PRECISION MPI_COMPLEX
331
#define  MPI_MATH_DATATYPE_PRECISION MPI_COMPLEX
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#define  MPI_COMPLEX_EXPLICIT_PRECISION MPI_COMPLEX8
#define  MPI_REAL_PRECISION MPI_REAL4
#define  KIND_PRECISION rk4
#define  PRECISION_CMPLX CMPLX
#define  PRECISION_IMAG AIMAG
#define  PRECISION_REAL REAL
#define  CONST_REAL_0_0 0.0_rk4
#define  CONST_REAL_1_0 1.0_rk4
#define  CONST_REAL_0_5 0.5_rk4
#define  CONST_COMPLEX_PAIR_0_0 (0.0_rk4,0.0_rk4)
#define  CONST_COMPLEX_PAIR_1_0 (1.0_rk4,0.0_rk4)
#define  CONST_COMPLEX_PAIR_NEGATIVE_1_0 (-1.0_rk4,0.0_rk4)
#define  CONST_COMPLEX_PAIR_NEGATIVE_0_5 (-0.5_rk4,0.0_rk4)
#define  CONST_COMPLEX_0_0 0.0_ck4
#define  CONST_COMPLEX_1_0 1.0_ck4
347
#define  C_DATATYPE_KIND c_float
348

Andreas Marek's avatar
Andreas Marek committed
349
#define THRESHOLD 1e-4_rk4
350
351
352
#endif /* SINGLE PRECISION */

#endif /* COMPLEXCASE */