starpufft.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. // The documentation for this file is in doc/doxygen/chapters/api/fft_support.doxy
  17. #ifndef __STARPU_FFT_H__
  18. #define __STARPU_FFT_H__
  19. #include <stdio.h>
  20. #include <complex.h>
  21. #include <starpu.h>
  22. #ifdef STARPU_USE_CUDA
  23. #include <cufft.h>
  24. #define STARPU_CUFFT_REPORT_ERROR(status) STARPUFFT(report_error)(__starpu_func__, __FILE__, __LINE__, status)
  25. #endif /* !STARPU_USE_CUDA */
  26. #define STARPUFFT_FORWARD -1
  27. #define STARPUFFT_INVERSE 1
  28. #define __STARPUFFT(name) starpufft_##name
  29. #define __STARPUFFTF(name) starpufftf_##name
  30. #define __STARPUFFTL(name) starpufftl_##name
  31. #define __STARPUFFT_INTERFACE(starpufft,real) \
  32. typedef real _Complex starpufft(complex); \
  33. \
  34. typedef struct starpufft(plan) *starpufft(plan); \
  35. \
  36. starpufft(plan) starpufft(plan_dft_1d)(int n, int sign, unsigned flags); \
  37. starpufft(plan) starpufft(plan_dft_2d)(int n, int m, int sign, unsigned flags); \
  38. starpufft(plan) starpufft(plan_dft_3d)(int n, int m, int p, int sign, unsigned flags); \
  39. starpufft(plan) starpufft(plan_dft_r2c_1d)(int n, unsigned flags); \
  40. starpufft(plan) starpufft(plan_dft_c2r_1d)(int n, unsigned flags); \
  41. \
  42. void *starpufft(malloc)(size_t n); \
  43. void starpufft(free)(void *p); \
  44. \
  45. int starpufft(execute)(starpufft(plan) p, void *in, void *out); \
  46. struct starpu_task *starpufft(start)(starpufft(plan) p, void *in, void *out); \
  47. \
  48. int starpufft(execute_handle)(starpufft(plan) p, starpu_data_handle_t in, starpu_data_handle_t out); \
  49. struct starpu_task *starpufft(start_handle)(starpufft(plan) p, starpu_data_handle_t in, starpu_data_handle_t out); \
  50. \
  51. void starpufft(cleanup)(starpufft(plan) p); \
  52. void starpufft(destroy_plan)(starpufft(plan) p); \
  53. \
  54. void starpufft(startstats)(void); \
  55. void starpufft(stopstats)(void); \
  56. void starpufft(showstats)(FILE *out);
  57. __STARPUFFT_INTERFACE(__STARPUFFT, double)
  58. __STARPUFFT_INTERFACE(__STARPUFFTF, float)
  59. __STARPUFFT_INTERFACE(__STARPUFFTL, long double)
  60. /* Internal use */
  61. extern int starpufft_last_plan_number;
  62. #endif // __STARPU_FFT_H__