valib
Vortex Analysis LIBrary
Loading...
Searching...
No Matches
common_defs.h
Go to the documentation of this file.
1
5#ifndef VA_COMMON_DEFS_H
6#define VA_COMMON_DEFS_H
7
8// use 64-bit representation of real numbers
9//#define VA_REAL double
10// use 32-bit representation of real numbers
11#define VA_REAL float
12
13#define VA_PI 3.14159265358979323846
14
15#if defined(CUDA)
16 #include <cuda/std/complex>
17 #define VA_DEVICE_ADDR
18 #define VA_DEVICE_FUN __device__
19 #define fabs fabsf
20 #define sqrt sqrtf
21 #define pow powf
22 #define VA_COMPLEX cuda::std::complex<VA_REAL>
23 #define VA_DOUBLE_COMPLEX cuda::std::complex<double>
24#elif defined(HIP)
25 #include <hip/hip_complex.h>
26 #define VA_DEVICE_ADDR
27 #define VA_DEVICE_FUN __device__
28 #define fabs fabsf
29 #define sqrt sqrtf
30 #define pow powf
31 // in HIP, it is difficult to distinguish float and double complex numbers
32 #define VA_DOUBLE_COMPLEX hipDoubleComplex
33 #define VA_COMPLEX VA_DOUBLE_COMPLEX
34#else
35 #include <math.h>
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <complex.h>
39 #include <float.h>
40 #define VA_DEVICE_ADDR
41 #define VA_DEVICE_FUN
42 #define VA_COMPLEX complex VA_REAL
43 #define VA_DOUBLE_COMPLEX complex double
44 #define VA_INFINITY FLT_MAX
45#endif
46
47#endif // VA_COMMON_DEFS_H