-
Notifications
You must be signed in to change notification settings - Fork 548
Expand file tree
/
Copy pathcufft.hpp
More file actions
52 lines (42 loc) · 2.04 KB
/
cufft.hpp
File metadata and controls
52 lines (42 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************
* Copyright (c) 2016, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <common/FFTPlanCache.hpp>
#include <common/err_common.hpp>
#include <common/unique_handle.hpp>
#include <cufft.h>
#include <cstdio>
DEFINE_HANDLER(cufftHandle, cufftCreate, cufftDestroy);
namespace arrayfire {
namespace cuda {
typedef cufftHandle PlanType;
typedef std::shared_ptr<PlanType> SharedPlan;
const char *_cufftGetResultString(cufftResult res);
SharedPlan findPlan(int rank, int *n, int *inembed, int istride, int idist,
int *onembed, int ostride, int odist, cufftType type,
int batch);
class PlanCache : public common::FFTPlanCache<PlanCache, PlanType> {
friend SharedPlan findPlan(int rank, int *n, int *inembed, int istride,
int idist, int *onembed, int ostride, int odist,
cufftType type, int batch);
};
} // namespace cuda
} // namespace arrayfire
#define CUFFT_CHECK(fn) \
do { \
cufftResult _cufft_res = fn; \
if (_cufft_res != CUFFT_SUCCESS) { \
char cufft_res_msg[1024]; \
snprintf(cufft_res_msg, sizeof(cufft_res_msg), \
"cuFFT Error (%d): %s\n", (int)(_cufft_res), \
arrayfire::cuda::_cufftGetResultString(_cufft_res)); \
\
AF_ERROR(cufft_res_msg, AF_ERR_INTERNAL); \
} \
} while (0)