mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
templateCuda.hpp
Go to the documentation of this file.
1/** \file templateCuda.hpp
2 * \author Jared R. Males
3 * \brief Utilities for a template interface to cuda
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_templateCuda_hpp
28#define math_templateCuda_hpp
29
30#ifdef MXLIB_CUDA
31
32#include <complex>
33
34#include <cuda_runtime.h>
35#include <cuComplex.h>
36
37namespace mx
38{
39namespace cuda
40{
41
42template <typename realT>
43struct complex;
44
45template <>
46struct complex<float>
47{
48 typedef cuComplex cudaType;
49};
50
51template <>
52struct complex<double>
53{
54 typedef cuDoubleComplex cudaType;
55};
56
57template <typename cppType>
58struct cpp2cudaType
59{
60 typedef cppType cudaType;
61};
62
63template <>
64struct cpp2cudaType<std::complex<float>>
65{
66 typedef complex<float>::cudaType cudaType;
67};
68
69template <>
70struct cpp2cudaType<std::complex<double>>
71{
72 typedef complex<double>::cudaType cudaType;
73};
74
75
76} // namespace cuda
77} // namespace mx
78
79#endif //MXLIB_CUDA
80
81#endif // templateCuda_hpp
The mxlib c++ namespace.
Definition mxlib.hpp:37