starpufft.h 2.4 KB

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