-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclfft.cpp
More file actions
29 lines (25 loc) · 784 Bytes
/
Copy pathclfft.cpp
File metadata and controls
29 lines (25 loc) · 784 Bytes
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
#include <iostream>
#include "clfft.h"
bool clFFT::init(cl_context context, cl_command_queue cmd_queue, size_t len, size_t maxbatch)
{
this->cmd_queue = cmd_queue;
this->len = len;
if (1)
std::cout << "Using " << "Apple" << " OpenCL FFT\n";
cl_int err;
clFFT_Dim3 dim = {len, 1, 1};
if (!(fft_plan.apple = clFFT_CreatePlan(context, dim, clFFT_1D, clFFT_InterleavedComplexFormat, &err)))
return false;
return true;
}
void clFFT::cleanup()
{
clFFT_DestroyPlan(fft_plan.apple);
}
bool clFFT::apply(cl_mem in, cl_mem out, size_t batch, cl_event * evt)
{
cl_int ret_fft = clFFT_ExecuteInterleaved(cmd_queue, fft_plan.apple, batch, clFFT_Forward, in, out, 0, NULL, evt);
if (ret_fft != CL_SUCCESS)
return false;
return true;
}