#ifndef __GPUDOUBLE32__H__ #define __GPUDOUBLE32__H__ // 定义double32 struct ,使用fp32模拟double struct double32{ float high; float low; __device__ __host__ double32(float h = 0, float l = 0) : high(h), low(l) {} }; extern __device__ double32 double_to_double32(double value); extern __device__ __host__ double double32_to_double(const double32& value); // 使用 PTX 优化的加法函数 extern __device__ double32 double32_add(const double32& a, const double32& b); // 使用 PTX 优化的减法函数 extern __device__ double32 double32_sub(const double32& a, const double32& b); // 使用 PTX 优化的乘法函数 extern __device__ double32 double32_mul(const double32& a, const double32& b); // 使用 PTX 优化的除法函数 extern __device__ double32 double32_div(const double32& a, const double32& b); // 使用 PTX 优化的 sin 函数 extern __device__ double32 double32_sin(const double32& a); // 使用 PTX 优化的 cos 函数 extern __device__ double32 double32_cos(const double32& a); // 使用 PTX 优化的 log2 函数 extern __device__ double32 double32_log2(const double32& a); // 使用 PTX 优化的 log10 函数 extern __device__ double32 double32_log10(const double32& a); // 使用 PTX 优化的 ln 函数 extern __device__ double32 double32_ln(const double32& a); // 使用 PTX 优化的 exp 函数 extern __device__ double32 double32_exp(const double32& a); // 使用 PTX 优化的 pow 函数 extern __device__ double32 double32_pow(const double32& a, const double32& b); // 使用 PTX 优化的 sqrt 函数 extern __device__ double32 double32_sqrt(const double32& a); extern "C" GPUBASELIBAPI void test_double_to_double32(); extern "C" GPUBASELIBAPI void test_function(int operation, const char* operation_name); extern "C" GPUBASELIBAPI void time_test_add(); extern "C" GPUBASELIBAPI void time_test_sub(); extern "C" GPUBASELIBAPI void time_test_mul(); extern "C" GPUBASELIBAPI void time_test_div(); extern "C" GPUBASELIBAPI void time_test_sin(); extern "C" GPUBASELIBAPI void time_test_cos(); extern "C" GPUBASELIBAPI void time_test_log2(); extern "C" GPUBASELIBAPI void time_test_log10(); extern "C" GPUBASELIBAPI void time_test_ln(); extern "C" GPUBASELIBAPI void time_test_exp(); extern "C" GPUBASELIBAPI void time_test_pow(); extern "C" GPUBASELIBAPI void time_test_sqrt(); #endif // !__GPUDOUBLE32__H__