You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
3.2 KiB
Plaintext
54 lines
3.2 KiB
Plaintext
#pragma once
|
|
|
|
__device__ __host__ static float zero_float() { return 0.0f; }
|
|
__device__ __host__ static cuFloatComplex zero_cuFloatComplex() { return make_cuFloatComplex(0.0, 0.0); }
|
|
__device__ __host__ static bool float_isNotZero(float x) { return x != 0.0f; }
|
|
__device__ __host__ static bool float_isZero(float x) { return x == 0.0f; }
|
|
__device__ __host__ static bool int_isZero(int x) { return x == 0; }
|
|
__device__ __host__ static bool int_isNotZero(int x) { return x != 0; }
|
|
|
|
__device__ static int int_fma(int a, int b, int c) { return ((a*b)+c); }
|
|
|
|
__device__ static float float_fma(float a, float b, float c) { return PREC_FADD(PREC_FMUL (a, b), c); }
|
|
__device__ static float float_add(float a, float b) { return PREC_FADD (a, b); }
|
|
__device__ static float float_mul(float a, float b) { return PREC_FMUL (a, b); }
|
|
__device__ static float float_abs(float a) { return fabsf(a); }
|
|
|
|
__device__ static cuFloatComplex cuFloatComplex_fma(cuFloatComplex a, cuFloatComplex b, cuFloatComplex c) { return cuCfmaf(a, b, c); }
|
|
__device__ static cuFloatComplex cuFloatComplex_add(cuFloatComplex a, cuFloatComplex b) { return cuCaddf(a, b); }
|
|
__device__ static cuFloatComplex cuFloatComplex_mul(cuFloatComplex a, cuFloatComplex b) { return cuCmulf(a, b); }
|
|
__device__ static cuFloatComplex cuFloatComplex_abs(cuFloatComplex a) { return make_cuFloatComplex(cuCabsf(a),0); }
|
|
|
|
//__device__ static float cuFloatComplex_abs(cuFloatComplex a) { return cuCabsf(a); }
|
|
|
|
__device__ static float readValue_float(float fetch) { return fetch; }
|
|
__device__ static cuFloatComplex readValue_cuFloatComplex(cuFloatComplex fetch) { return fetch; }
|
|
|
|
// host or c.c >= 1.3
|
|
#if (__CUDA_ARCH__ >= 130) || (!__CUDA_ARCH__)
|
|
__device__ __host__ static double zero_double() { return 0.0; }
|
|
__device__ __host__ static cuDoubleComplex zero_cuDoubleComplex() { return make_cuDoubleComplex(0.0, 0.0); }
|
|
__device__ __host__ static bool double_isNotZero(double x) { return x != 0.0; }
|
|
__device__ __host__ static bool double_isZero(double x) { return x == 0.0; }
|
|
|
|
__device__ static double double_fma(double a, double b, double c) { return PREC_DADD(PREC_DMUL (a, b), c); }
|
|
__device__ static double double_add(double a, double b) { return PREC_DADD (a, b); }
|
|
__device__ static double double_mul(double a, double b) { return PREC_DMUL (a, b); }
|
|
__device__ static double double_abs(double a) { return fabs (a); }
|
|
|
|
__device__ static cuDoubleComplex cuDoubleComplex_fma(cuDoubleComplex a, cuDoubleComplex b, cuDoubleComplex c) { return cuCfma(a, b, c); }
|
|
__device__ static cuDoubleComplex cuDoubleComplex_add(cuDoubleComplex a, cuDoubleComplex b) { return cuCadd(a, b); }
|
|
__device__ static cuDoubleComplex cuDoubleComplex_mul(cuDoubleComplex a, cuDoubleComplex b) { return cuCmul(a, b); }
|
|
__device__ static cuDoubleComplex cuDoubleComplex_abs(cuDoubleComplex a) { return make_cuDoubleComplex(cuCabs(a),0); }
|
|
//__device__ static double cuDoubleComplex_abs(cuDoubleComplex a) { return cuCabs(a); }
|
|
|
|
__device__ static double readValue_double(int2 fetch) { return __hiloint2double (fetch.y, fetch.x); }
|
|
__device__ static cuDoubleComplex readValue_cuDoubleComplex(int4 fetch)
|
|
{
|
|
cuDoubleComplex c;
|
|
c.x = __hiloint2double (fetch.y, fetch.x);
|
|
c.y = __hiloint2double (fetch.w, fetch.z);
|
|
return c;
|
|
}
|
|
#endif
|