precision_macros.h 10.3 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
Pavel Kus's avatar
Pavel Kus committed
35
#undef  PRECISION_LASET
36
37
38
#undef  cublas_PRECISION_GEMM
#undef  cublas_PRECISION_TRMM
#undef  cublas_PRECISION_GEMV
Pavel Kus's avatar
Pavel Kus committed
39
#undef  cublas_PRECISION_SYMV
40
#undef  scal_PRECISION_GEMM
Pavel Kus's avatar
Pavel Kus committed
41
#undef  scal_PRECISION_NRM2
Pavel Kus's avatar
Pavel Kus committed
42
#undef  scal_PRECISION_LASET
43
#undef  PRECISION_SUFFIX
Andreas Marek's avatar
Andreas Marek committed
44

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

Andreas Marek's avatar
Andreas Marek committed
56

Andreas Marek's avatar
Andreas Marek committed
57
/* General definitions needed in single and double case */
58
#define  MATH_DATATYPE real
59
#define  BLAS_TRANS_OR_CONJ 'T'
60

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

#define  PRECISION_TRTRI DTRTRI
Andreas Marek's avatar
Andreas Marek committed
70
71
#define  PRECISION_POTRF DPOTRF
#define  PRECISION_TRSM DTRSM
72
73
74
75
76
77
78
79
#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
80
81
#define  PRECISION_HEMV DHEMV
#define  PRECISION_HER2 DHER2
82
83
84
85
86
87
88
89
90
91
#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
92
#define  PRECISION_NRM2 DNRM2
Pavel Kus's avatar
Pavel Kus committed
93
#define  PRECISION_LASET DLASET
94
95
96
#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
97
#define  cublas_PRECISION_SYMV cublas_DSYMV
98
#define  scal_PRECISION_GEMM PDGEMM
Pavel Kus's avatar
Pavel Kus committed
99
#define  scal_PRECISION_NRM2 PDNRM2
Pavel Kus's avatar
Pavel Kus committed
100
#define  scal_PRECISION_LASET PDLASET
101
#define  CONST_0_0 0.0_rk8
102
#define  CONST_REAL_0_0 0.0_rk8
103
104
105
106
107
#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
108
#define  MPI_MATH_DATATYPE_PRECISION MPI_REAL8
109
#define  C_DATATYPE_KIND c_double
110

Andreas Marek's avatar
Andreas Marek committed
111
#define THRESHOLD 1e-11_rk8
112
#endif /* DOUBLE_PRECISION */
Andreas Marek's avatar
Andreas Marek committed
113

114
#ifdef SINGLE_PRECISION
115

116
117
#define SINGLE_PRECISION_REAL

118
#define  PRECISION single
Pavel Kus's avatar
Pavel Kus committed
119
#define  PRECISION_STR 'single'
Andreas Marek's avatar
Andreas Marek committed
120
#define  PRECISION_SUFFIX "_single"
121
#define  REAL_DATATYPE rk4
Andreas Marek's avatar
Andreas Marek committed
122
#define  SPECIAL_COMPLEX_DATATYPE ck4
Andreas Marek's avatar
Andreas Marek committed
123

124
#define  PRECISION_TRTRI STRTRI
Andreas Marek's avatar
Andreas Marek committed
125
126
#define  PRECISION_POTRF SPOTRF
#define  PRECISION_TRSM STRSM
127
128
129
130
131
132
133
134
#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
135
136
#define  PRECISION_HEMV SHEMV
#define  PRECISION_HER2 SHER2
137
138
139
140
141
142
143
144
145
146
#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
147
#define  PRECISION_NRM2 SNRM2
Pavel Kus's avatar
Pavel Kus committed
148
#define  PRECISION_LASET SLASET
149
150
151
#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
152
#define  cublas_PRECISION_SYMV cublas_SSYMV
153
#define  scal_PRECISION_GEMM PSGEMM
Pavel Kus's avatar
Pavel Kus committed
154
#define  scal_PRECISION_NRM2 PSNRM2
Pavel Kus's avatar
Pavel Kus committed
155
#define  scal_PRECISION_LASET PSLASET
156
#define  CONST_0_0 0.0_rk4
157
#define  CONST_REAL_0_0 0.0_rk4
158
159
160
161
162
#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
163
#define  MPI_MATH_DATATYPE_PRECISION MPI_REAL4
164
#define  C_DATATYPE_KIND c_float
165

Andreas Marek's avatar
Andreas Marek committed
166
#define THRESHOLD 1e-4_rk4
167
168
169
#endif /* SINGLE_PRECISION */

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

171
#ifdef COMPLEXCASE
172
173

#undef DOUBLE_PRECISION_COMPLEX
174
#undef SINGLE_PRECISION_COMPLEX
175
#undef  MATH_DATATYPE
176
#undef  BLAS_TRANS_OR_CONJ
177
#undef  PRECISION
178
179
180
181
#undef COMPLEX_DATATYPE
/* in the complex case also sometime real valued variables are needed */
#undef REAL_DATATYPE

182
#undef  PRECISION_TRTRI
Andreas Marek's avatar
Andreas Marek committed
183
184
#undef  PRECISION_POTRF
#undef  PRECISION_TRSM
Pavel Kus's avatar
Pavel Kus committed
185
#undef  PRECISION_STR
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#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
206
#undef  PRECISION_DOTC
Pavel Kus's avatar
Pavel Kus committed
207
#undef  PRECISION_LASET
208
209
210
#undef  cublas_PRECISION_GEMM
#undef  cublas_PRECISION_TRMM
#undef  cublas_PRECISION_GEMV
Pavel Kus's avatar
Pavel Kus committed
211
#undef  cublas_PRECISION_SYMV
212
#undef  scal_PRECISION_GEMM
Pavel Kus's avatar
Pavel Kus committed
213
#undef  scal_PRECISION_DOTC
Pavel Kus's avatar
Pavel Kus committed
214
#undef  scal_PRECISION_LASET
215
216
#undef  PRECISION_SUFFIX
#undef  MPI_COMPLEX_PRECISION
217
#undef  MPI_MATH_DATATYPE_PRECISION
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#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
233
#undef  C_DATATYPE_KIND
234

Pavel Kus's avatar
Pavel Kus committed
235

Andreas Marek's avatar
Andreas Marek committed
236
237
#undef THRESHOLD

238
239
/* General definitions needed in single and double case */
#define  MATH_DATATYPE complex
240
#define  BLAS_TRANS_OR_CONJ 'C'
241

242
#ifdef DOUBLE_PRECISION
243
244

#define DOUBLE_PRECISION_COMPLEX
245
#define  PRECISION double
Pavel Kus's avatar
Pavel Kus committed
246
#define  PRECISION_STR 'double'
Andreas Marek's avatar
Andreas Marek committed
247
#define  PRECISION_SUFFIX "_double"
248
249
250
#define COMPLEX_DATATYPE CK8
#define REAL_DATATYPE RK8

251
#define  PRECISION_TRTRI ZTRTRI
Andreas Marek's avatar
Andreas Marek committed
252
253
#define  PRECISION_POTRF ZPOTRF
#define  PRECISION_TRSM ZTRSM
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#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
274
#define  PRECISION_DOTC ZDOTC
Pavel Kus's avatar
Pavel Kus committed
275
#define  PRECISION_LASET ZLASET
276
277
278
#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
279
#define  cublas_PRECISION_SYMV cublas_ZSYMV
280
#define  scal_PRECISION_GEMM PZGEMM
Pavel Kus's avatar
Pavel Kus committed
281
#define  scal_PRECISION_DOTC PZDOTC
Pavel Kus's avatar
Pavel Kus committed
282
#define  scal_PRECISION_LASET PZLASET
283
#define  MPI_COMPLEX_PRECISION MPI_DOUBLE_COMPLEX
284
#define  MPI_MATH_DATATYPE_PRECISION MPI_DOUBLE_COMPLEX
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#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
300
#define  C_DATATYPE_KIND c_double
301

Andreas Marek's avatar
Andreas Marek committed
302
#define THRESHOLD 1e-11_rk8
303
304
#endif /* DOUBLE PRECISION */

305
#ifdef SINGLE_PRECISION
306
#define SINGLE_PRECISION_COMPLEX
307
#define  PRECISION single
Pavel Kus's avatar
Pavel Kus committed
308
#define  PRECISION_STR 'single'
Andreas Marek's avatar
Andreas Marek committed
309
#define  PRECISION_SUFFIX "_single"
310
311
312
#define COMPLEX_DATATYPE CK4
#define REAL_DATATYPE RK4

313
#define  PRECISION_TRTRI CTRTRI
Andreas Marek's avatar
Andreas Marek committed
314
315
#define  PRECISION_POTRF CPOTRF
#define  PRECISION_TRSM CTRSM
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#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
336
#define  PRECISION_DOTC CDOTC
Pavel Kus's avatar
Pavel Kus committed
337
#define  PRECISION_LASET CLASET
338
339
340
#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
341
#define  cublas_PRECISION_SYMV cublas_CSYMV
342
#define  scal_PRECISION_GEMM PCGEMM
Pavel Kus's avatar
Pavel Kus committed
343
#define  scal_PRECISION_DOTC PCDOTC
Pavel Kus's avatar
Pavel Kus committed
344
#define  scal_PRECISION_LASET PCLASET
345
#define  MPI_COMPLEX_PRECISION MPI_COMPLEX
346
#define  MPI_MATH_DATATYPE_PRECISION MPI_COMPLEX
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#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
362
#define  C_DATATYPE_KIND c_float
363

Andreas Marek's avatar
Andreas Marek committed
364
#define THRESHOLD 1e-4_rk4
365
366
367
#endif /* SINGLE PRECISION */

#endif /* COMPLEXCASE */