Mercurial > hg > Game > Cerium
changeset 1656:05adaf6f7afb draft
fix fft
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Jul 2013 21:50:02 +0900 |
parents | 963d2fc5f685 |
children | 6fe17b1c8cf3 |
files | example/fft/Func.h example/fft/main.cc example/fft/task_init.cc |
diffstat | 3 files changed, 26 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/example/fft/Func.h Mon Jul 01 21:15:23 2013 +0900 +++ b/example/fft/Func.h Tue Jul 02 21:50:02 2013 +0900 @@ -5,7 +5,7 @@ BIT_REVERSE, NORMALIZATION, BUTTERFLY, - TRANSEPOSE, + TRANSPOSE, HIGH_PASS_FILTER, #include "GlobalID.h" };
--- a/example/fft/main.cc Mon Jul 01 21:15:23 2013 +0900 +++ b/example/fft/main.cc Tue Jul 02 21:50:02 2013 +0900 @@ -148,7 +148,7 @@ norm->set_cpu(spe_cpu); norm->flip(); norm->wait_for(bfly); - norm->iterate(gws[0],gws[0]); + norm->iterate(gws[0],gws[1]); waitTask = norm; } @@ -217,39 +217,36 @@ sfac->set_outData(0, wm, length_w*sizeof(cl_float2)); sfac->set_param(3,n); sfac->set_cpu(spe_cpu); - sfac->iterate(gws[0],gws[1]); + sfac->iterate(gws[0]); // Butterfly Operation waitTask = fftCore(manager, rm, xm, wm, m, forward,sfac); - HTaskPtr *trns = (HTask**)manager->allocate(sizeof(HTask*)*2); - // Transpose matrix int length_r =n*n; - setWorkSize(gws,lws,n/2,1); - for (int i=0;i<2;i++) { - trns[i]= manager->create_task(TRANSEPOSE); - trns[i]->set_inData(0, rm, length_r*sizeof(cl_float2)); - trns[i]->set_outData(0, xm, length_r*sizeof(cl_float2)); - trns[i]->set_param(3,n); - trns[i]->set_cpu(spe_cpu); - } - // trns[0]->wait_for(sfac); - trns[0]->wait_for(waitTask); - trns[0]->iterate(gws[0],gws[1]); + setWorkSize(gws,lws,n,n); + HTask* first_trns = manager->create_task(TRANSPOSE); + first_trns->set_inData(0,rm,length_r*sizeof(cl_float2)); + first_trns->set_outData(0,xm,length_r*sizeof(cl_float2)); + first_trns->set_param(3,n); + first_trns->set_cpu(spe_cpu); + first_trns->wait_for(waitTask); + first_trns->iterate(gws[0],gws[1]); + // Butterfly Operation - // fftCore(manager, rm, xm, wm, m, forward); + waitTask = fftCore(manager, rm, xm, wm, m, forward,first_trns); // Apply high-pass filter HTask *hpfl = manager->create_task(HIGH_PASS_FILTER); cl_int radius = n/8; - setWorkSize(gws,lws,n/2,1); + setWorkSize(gws,lws,n,n); hpfl->set_outData(0, rm, length_r*sizeof(cl_float2)); hpfl->set_param(3,n); hpfl->set_param(4,radius); hpfl->set_cpu(spe_cpu); - hpfl->wait_for(trns[0]); + hpfl->wait_for(waitTask); hpfl->iterate(gws[0],gws[1]); + // Inverse FFT // Butterfly Operation @@ -257,12 +254,17 @@ // Transpose matrix setWorkSize(gws,lws,n,n); - trns[1]->wait_for(waitTask); - trns[1]->iterate(gws[0],gws[1]); + HTask* second_trns = manager->create_task(TRANSPOSE); + second_trns->set_inData(0,xm,length_r*sizeof(cl_float2)); + second_trns->set_outData(0,rm,length_r*sizeof(cl_float2)); + second_trns->set_param(3,n); + second_trns->set_cpu(spe_cpu); + second_trns->wait_for(waitTask); + second_trns->iterate(gws[0],gws[1]); // Butterfly Operation - waitTask = fftCore(manager,xm, rm, wm, m, inverse,trns[1]); + waitTask = fftCore(manager,xm, rm, wm, m, inverse,second_trns); } int TMmain(TaskManager *manager, int argc, char** argv) {
--- a/example/fft/task_init.cc Mon Jul 01 21:15:23 2013 +0900 +++ b/example/fft/task_init.cc Tue Jul 02 21:50:02 2013 +0900 @@ -20,14 +20,14 @@ GpuSchedRegister(BIT_REVERSE, "gpu/fft.cl", "bitReverse"); GpuSchedRegister(NORMALIZATION, "gpu/fft.cl", "norm"); GpuSchedRegister(BUTTERFLY, "gpu/fft.cl", "butterfly"); - GpuSchedRegister(TRANSEPOSE, "gpu/fft.cl", "transpose"); + GpuSchedRegister(TRANSPOSE, "gpu/fft.cl", "transpose"); GpuSchedRegister(HIGH_PASS_FILTER, "gpu/fft.cl", "highPassFilter"); #else SchedRegisterTask(SPIN_FACT,spinFact); SchedRegisterTask(NORMALIZATION, norm); SchedRegisterTask(BIT_REVERSE, bitReverse); SchedRegisterTask(BUTTERFLY, butterfly); - SchedRegisterTask(TRANSEPOSE, transpose); + SchedRegisterTask(TRANSPOSE, transpose); SchedRegisterTask(HIGH_PASS_FILTER, highPassFilter); #endif }