From 372de0130d89c37add3c0e17c63d9710dba8c628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20And=C3=A9n?= Date: Mon, 18 Dec 2023 22:40:39 +0100 Subject: [PATCH] cuda: try simplifying cufinufft signatures --- include/cufinufft.h | 16 +++++++++++++--- src/cuda/cufinufft.cu | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/cufinufft.h b/include/cufinufft.h index f1c63b269..2bc1f6b07 100644 --- a/include/cufinufft.h +++ b/include/cufinufft.h @@ -1,8 +1,18 @@ // Defines the C++/C user interface to CUFINUFFT library. -#include #include +#ifdef __cplusplus +#define _USE_MATH_DEFINES +#include +#define CUFINUFFT_CPX_FLT std::complex +#define CUFINUFFT_CPX_DBL std::complex +#else +#include +#define CUFINUFFT_CPX_FLT float complex +#define CUFINUFFT_CPX_DBL double complex +#endif + #include #include @@ -24,8 +34,8 @@ int cufinufft_setpts(cufinufft_plan d_plan, int M, double *h_kx, double *h_ky, d int cufinufftf_setpts(cufinufftf_plan d_plan, int M, float *h_kx, float *h_ky, float *h_kz, int N, float *h_s, float *h_t, float *h_u); -int cufinufft_execute(cufinufft_plan d_plan, cuDoubleComplex *h_c, cuDoubleComplex *h_fk); -int cufinufftf_execute(cufinufftf_plan d_plan, cuFloatComplex *h_c, cuFloatComplex *h_fk); +int cufinufft_execute(cufinufft_plan d_plan, CUFINUFFT_CPX_DBL *h_c, CUFINUFFT_CPX_DBL *h_fk); +int cufinufftf_execute(cufinufftf_plan d_plan, CUFINUFFT_CPX_FLT*h_c, CUFINUFFT_CPX_FLT*h_fk); int cufinufft_destroy(cufinufft_plan d_plan); int cufinufftf_destroy(cufinufftf_plan d_plan); diff --git a/src/cuda/cufinufft.cu b/src/cuda/cufinufft.cu index 04196aca2..6776cd8c2 100644 --- a/src/cuda/cufinufft.cu +++ b/src/cuda/cufinufft.cu @@ -63,11 +63,11 @@ int cufinufft_setpts(cufinufft_plan d_plan, int M, double *d_kx, double *d_ky, d return cufinufft_setpts_impl(M, d_kx, d_ky, d_kz, N, d_s, d_t, d_u, (cufinufft_plan_t *)d_plan); } -int cufinufftf_execute(cufinufftf_plan d_plan, cuFloatComplex *d_c, cuFloatComplex *d_fk) { +int cufinufftf_execute(cufinufftf_plan d_plan, CUFINUFFT_CPX_FLT *d_c, CUFINUFFT_CPX_FLT *d_fk) { return cufinufft_execute_impl(d_c, d_fk, (cufinufft_plan_t *)d_plan); } -int cufinufft_execute(cufinufft_plan d_plan, cuDoubleComplex *d_c, cuda_complex *d_fk) { +int cufinufft_execute(cufinufft_plan d_plan, CUFINUFFT_CPX_DBL *d_c, CUFINUFFT_CPX_DBL *d_fk) { return cufinufft_execute_impl(d_c, d_fk, (cufinufft_plan_t *)d_plan); }