Mercurial > hg > Game > Cerium
changeset 2017:1d7d1e398833 draft
minor change
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jul 2014 01:19:31 +0900 |
parents | e904bb51fea9 |
children | 433043c56a0c |
files | TaskManager/Cuda/CudaScheduler.cc TaskManager/test/flipTest/cuda/add.cu TaskManager/test/flipTest/main.cc TaskManager/test/flipTest/ppe/Add.cc example/fft/main.cc |
diffstat | 5 files changed, 27 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cuda/CudaScheduler.cc Thu Jul 10 17:32:30 2014 +0900 +++ b/TaskManager/Cuda/CudaScheduler.cc Tue Jul 15 01:19:31 2014 +0900 @@ -156,9 +156,9 @@ if (ret!=0) { CudaTaskError(cudabuffer, cur, tasklist, ret); continue; } transmitted.insert(make_pair(output_buf->addr, &cudabuffer[cur].memout[i])); reverse_map.insert(make_pair(&cudabuffer[cur].memout[i], output_buf->addr)); + cudabuffer[cur].kernelParams[param] = transmitted[output_buf->addr]; + param++; } - cudabuffer[cur].kernelParams[param] = transmitted[output_buf->addr]; - param++; } cudabuffer[cur].out_size = param - cudabuffer[cur].in_size; // no buffer on flip, but flip use memout event }
--- a/TaskManager/test/flipTest/cuda/add.cu Thu Jul 10 17:32:30 2014 +0900 +++ b/TaskManager/test/flipTest/cuda/add.cu Tue Jul 15 01:19:31 2014 +0900 @@ -1,6 +1,6 @@ extern "C" { - __global__ void add(long* params, int* A) { + __global__ void add(long* params, int* A, int* B) { int id = blockIdx.x * blockDim.x + threadIdx.x; - A[id] = A[id]+1; + B[id] = B[id]+A[id]; } }
--- a/TaskManager/test/flipTest/main.cc Thu Jul 10 17:32:30 2014 +0900 +++ b/TaskManager/test/flipTest/main.cc Tue Jul 15 01:19:31 2014 +0900 @@ -15,7 +15,8 @@ static int flip_flag = 0; void TMend(TaskManager *); -int *A; +int* A; +int* B; static double st_time = 0 ; static double ed_time = 0; @@ -32,7 +33,7 @@ printf("---\n"); if(print_flag == 1) { for (int i =0;i<length;i++) { - printf("%d\n",A[i]); + printf("%d\n",B[i]); } } printf("---\n"); @@ -74,14 +75,19 @@ HTask* add[task]; A = new int[length]; - for(int i=0; i<length; i++) + B = new int[length]; + + for(int i=0; i<length; i++) { A[i]=i; - + B[i]=0; + } + for (int i=0; i<task-1; i++) { add[i] = manager->create_task(ADD_TASK); add[i]->set_cpu(spe_cpu); add[i]->set_inData(0,(memaddr)A, sizeof(int)*length); - add[i]->set_outData(0,(memaddr)A, sizeof(int)*length); + add[i]->set_inData(1,(memaddr)B, sizeof(int)*length); + add[i]->set_outData(0,(memaddr)B, sizeof(int)*length); if (flip_flag == 1) add[i]->flip(); if (i != 0) @@ -92,8 +98,10 @@ add[task-1] = manager->create_task(ADD_TASK); add[task-1]->set_cpu(spe_cpu); add[task-1]->set_inData(0,(memaddr)A, sizeof(int)*length); - add[task-1]->set_outData(0,(memaddr)A, sizeof(int)*length); - add[task-1]->wait_for(add[task-2]); + add[task-1]->set_inData(1,(memaddr)B, sizeof(int)*length); + add[task-1]->set_outData(0,(memaddr)B, sizeof(int)*length); + if (task >= 2) + add[task-1]->wait_for(add[task-2]); add[task-1]->iterate(length); } @@ -117,7 +125,8 @@ ed_time = getTime(); print_result(); printf("Time: %0.6f\n",ed_time-st_time); - check_data(); + //check_data(); delete[] A; + delete[] B; }
--- a/TaskManager/test/flipTest/ppe/Add.cc Thu Jul 10 17:32:30 2014 +0900 +++ b/TaskManager/test/flipTest/ppe/Add.cc Tue Jul 15 01:19:31 2014 +0900 @@ -8,10 +8,12 @@ SchedDefineTask(Add); static int -run(SchedTask *s,void *rbuf, void *wbuf) +run(SchedTask *s, void *rbuf, void *wbuf) { - int *A = (int*)s->get_input(rbuf, 0); + int* A = (int*)s->get_input(rbuf, 0); + int* B = (int*)s->get_output(wbuf,0); long i = (long)s->x; - A[i] = A[i]+1; + + B[i] = B[i]+A[i]; return 0; }
--- a/example/fft/main.cc Thu Jul 10 17:32:30 2014 +0900 +++ b/example/fft/main.cc Tue Jul 15 01:19:31 2014 +0900 @@ -228,7 +228,6 @@ sfac->set_outData(0, wm, length_w*sizeof(cl_float2)); sfac->set_param(0,n); sfac->set_cpu(spe_cpu); - sfac->flip(); sfac->iterate(gws[0]); // Butterfly Operation @@ -280,7 +279,7 @@ // Butterfly Operation - waitTask = fftCore(manager,xm, rm, wm, m, inverse,second_trns); + waitTask = fftCore(manager,xm, rm, wm, m, inverse, second_trns); } int TMmain(TaskManager *manager, int argc, char** argv) {