mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
templateCufft.hpp
Go to the documentation of this file.
1/** \file templateCufft.hpp
2 * \author Jared R. Males
3 * \brief A template interface to cufft
4 * \ingroup cuda_files
5 *
6 */
7
8//***********************************************************************//
9// Copyright 2019,2020 Jared R. Males (jaredmales@gmail.com)
10//
11// This file is part of mxlib.
12//
13// mxlib is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// mxlib is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with mxlib. If not, see <http://www.gnu.org/licenses/>.
25//***********************************************************************//
26
27#ifndef math_templateCufft_hpp
28#define math_templateCufft_hpp
29
30#include <complex>
31#include <cuda_runtime.h>
32#include <cufft.h>
33
34namespace mx
35{
36namespace cuda
37{
38
39template <typename inputT, typename outputT>
40cufftResult cufftPlan2d( cufftHandle *plan, int nx, int ny );
41
42template <>
43cufftResult cufftPlan2d<std::complex<float>, std::complex<float>>( cufftHandle *plan, int nx, int ny );
44
45template <>
46cufftResult cufftPlan2d<cuComplex, cuComplex>( cufftHandle *plan, int nx, int ny );
47
48template <>
49cufftResult cufftPlan2d<std::complex<double>, std::complex<double>>( cufftHandle *plan, int nx, int ny );
50
51template <>
52cufftResult cufftPlan2d<cuDoubleComplex, cuDoubleComplex>( cufftHandle *plan, int nx, int ny );
53
54template <typename inputT, typename outputT>
55cufftResult cufftExec( cufftHandle plan, inputT *idata, inputT *odata, int direction );
56
57template <>
58cufftResult cufftExec<std::complex<float>, std::complex<float>>( cufftHandle plan,
59 std::complex<float> *idata,
60 std::complex<float> *odata,
61 int direction );
62
63template <>
64cufftResult cufftExec<cuComplex, cuComplex>( cufftHandle plan, cuComplex *idata, cuComplex *odata, int direction );
65
66template <>
67cufftResult cufftExec<std::complex<double>, std::complex<double>>( cufftHandle plan,
68 std::complex<double> *idata,
69 std::complex<double> *odata,
70 int direction );
71
72template <>
73cufftResult cufftExec<cuDoubleComplex, cuDoubleComplex>( cufftHandle plan,
74 cuDoubleComplex *idata,
75 cuDoubleComplex *odata,
76 int direction );
77
78} // namespace cuda
79} // namespace mx
80
81#endif // math_templateCufft_hpp
The mxlib c++ namespace.
Definition mxError.hpp:106