Commit 07bab5c7 authored by Matthias Werner's avatar Matthias Werner

removed commented old code.

parent f139f4d1
......@@ -336,6 +336,7 @@ namespace ClFFT
}
void destroy() {
clSafeCall( clFinish(queue_) );
clSafeCall( clReleaseMemObject( data_ ) );
if(IsInplace==false)
clSafeCall( clReleaseMemObject( data_transform_ ) );
......@@ -365,138 +366,5 @@ RUN_BENCHMARKS_NORMALIZED_FFT(ClFFT,
gearshifft::ClFFT::Outplace_Complex
)
/*
struct ClFFT_Inplace_Real {
static constexpr auto InputIsReal = true;
template<typename T>
constexpr void operator()(T* hdata, size_t n0, size_t n1, size_t n2, Results& results)
{
cl_int err;
cl_platform_id platform = 0;
cl_device_id device = 0;
cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 };
cl_context ctx = 0;
cl_command_queue queue = 0;
cl_mem bufX;
cl_event event = nullptr;
int ret = 0;
clfftPlanHandle planHandle;
size_t clLengths[3] = {n0,n1,n2};
size_t size = n0*n1*n2;
size_t bytes_in = size * sizeof(T);
size_t bytes = 2 * size * sizeof(T);
clSafeCall(clGetPlatformIDs( 1, &platform, nullptr ));
clSafeCall(clGetDeviceIDs( platform, CL_DEVICE_TYPE_GPU, 1, &device, nullptr ));
props[1] = (cl_context_properties)platform;
ctx = clCreateContext( props, 1, &device, nullptr, nullptr, &err );
queue = clCreateCommandQueue( ctx, device, 0, &err );
clfftSetupData fftSetup;
clSafeCall(clfftInitSetupData(&fftSetup));
clSafeCall(clfftSetup(&fftSetup));
bufX = clCreateBuffer( ctx, CL_MEM_READ_WRITE, bytes, nullptr, &err );
clSafeCall(clEnqueueWriteBuffer( queue, bufX, CL_TRUE, 0, bytes_in, hdata, 0, nullptr, nullptr ));
clSafeCall(clfftCreateDefaultPlan(&planHandle, ctx, CLFFT_3D, clLengths));
clSafeCall(clfftSetPlanPrecision(planHandle, CLFFT_SINGLE));
clSafeCall(clfftSetLayout(planHandle, CLFFT_REAL, CLFFT_COMPLEX_INTERLEAVED));
clSafeCall(clfftSetResultLocation(planHandle, CLFFT_INPLACE));
clSafeCall(clfftBakePlan(planHandle, 1, &queue, nullptr, nullptr));
clSafeCall(clfftEnqueueTransform(planHandle, CLFFT_FORWARD, 1, &queue, 0, nullptr, nullptr, &bufX, nullptr, nullptr));
clSafeCall(clFinish(queue));
clSafeCall(clfftSetLayout(planHandle, CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL));
clSafeCall(clfftBakePlan(planHandle, 1, &queue, nullptr, nullptr));
clSafeCall(clfftEnqueueTransform(planHandle, CLFFT_FORWARD, 1, &queue, 0, nullptr, nullptr, &bufX, nullptr, nullptr));
clSafeCall(clFinish(queue));
clSafeCall(clEnqueueReadBuffer( queue, bufX, CL_TRUE, 0, bytes_in, hdata, 0, nullptr, nullptr ));
clReleaseMemObject( bufX );
clSafeCall(clfftDestroyPlan( &planHandle ));
clfftTeardown( );
clReleaseCommandQueue( queue );
clReleaseContext( ctx );
}
};
struct ClFFT_Complex {
static constexpr auto InputIsReal = false;
template<typename T>
constexpr void operator()(T* hdata, size_t n0, size_t n1, size_t n2, Results& results)
{
cl_int err = CL_SUCCESS;
cl_platform_id platform = 0;
cl_device_id device = 0;
cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 };
cl_context ctx = 0;
cl_command_queue queue = 0;
cl_mem bufX;
cl_event event = nullptr;
int ret = 0;
clfftPlanHandle planHandle;
size_t clLengths[3] = {n0,n1,n2};
size_t size = n0*n1*n2;
size_t bytes = size * sizeof(T);
findClDevice(&platform, &device);
props[1] = (cl_context_properties)platform;
ctx = clCreateContext( props, 1, &device, nullptr, nullptr, &err );
queue = clCreateCommandQueue( ctx, device, 0, &err );
clfftSetupData fftSetup;
clSafeCall(clfftInitSetupData(&fftSetup));
clSafeCall(clfftSetup(&fftSetup));
bufX = clCreateBuffer( ctx, CL_MEM_READ_WRITE, bytes, nullptr, &err );
clSafeCall(clEnqueueWriteBuffer( queue, bufX, CL_TRUE, 0, bytes, hdata, 0, nullptr, nullptr ));
clSafeCall(clfftCreateDefaultPlan(&planHandle, ctx, CLFFT_3D, clLengths));
clSafeCall(clfftSetPlanPrecision(planHandle, CLFFT_SINGLE));
clSafeCall(clfftSetLayout(planHandle, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED));
clSafeCall(clfftSetResultLocation(planHandle, CLFFT_INPLACE));
clSafeCall(clfftBakePlan(planHandle, 1, &queue, nullptr, nullptr));
clSafeCall(clfftEnqueueTransform(planHandle, CLFFT_FORWARD, 1, &queue, 0, nullptr, nullptr, &bufX, nullptr, nullptr));
clSafeCall(clFinish(queue));
clSafeCall(clfftSetLayout(planHandle, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED));
clSafeCall(clfftBakePlan(planHandle, 1, &queue, nullptr, nullptr));
clSafeCall(clfftEnqueueTransform(planHandle, CLFFT_BACKWARD, 1, &queue, 0, nullptr, nullptr, &bufX, nullptr, nullptr));
clSafeCall(clFinish(queue));
clSafeCall(clEnqueueReadBuffer( queue, bufX, CL_TRUE, 0, bytes, hdata, 0, nullptr, nullptr ));
clReleaseMemObject( bufX );
clSafeCall(clfftDestroyPlan( &planHandle ));
clfftTeardown( );
clReleaseCommandQueue( queue );
clReleaseContext( ctx );
}
};
RUN_BENCHMARKS_NORMALIZED_FFT(clFFT3D, ClFFT_Complex)
*/
#endif /* CLFFT_HPP_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment