Mercurial > hg > Game > Cerium
changeset 1672:32bc4ea3557f draft
set_param in multi-dimension destroy shared TaskList. make dimension parammeter x,y,z in SchedTask.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 18 Jul 2013 11:20:51 +0900 |
parents | 6b34346cf23a |
children | 2c3adce7eb40 |
files | TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTaskBase.h example/basic/ppe/Twice.cc example/basic/spe/Twice.cc example/fft/ppe/bitReverse.cc example/fft/ppe/butterfly.cc example/fft/ppe/highPassFilter.cc example/fft/ppe/norm.cc example/fft/ppe/spinFact.cc example/fft/ppe/transpose.cc example/multiply/ppe/Multi.cc |
diffstat | 11 files changed, 34 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/SchedTask.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Thu Jul 18 11:20:51 2013 +0900 @@ -130,22 +130,19 @@ void SchedTask::multi_dimension(TaskListPtr list, void* read, void* write,TaskObjectRun run) { - int x=0,y=0,z=0; - int min = scheduler->min_cpu(); - int max = scheduler->max_cpu(); - int id = scheduler->id; - int lx = list->x; - int ly = list->y; - int lz = list->z; - int dim = list->dim; + long min = scheduler->min_cpu(); + long max = scheduler->max_cpu(); + long id = scheduler->id; + long lx = list->x; + long ly = list->y; + long lz = list->z; - int cpu=min; + x=y=z=0; + + long cpu=min; for (;;cpu++) { if (cpu>max) cpu = min; if (cpu==id) { - if (dim>0) atask->set_param(0,(memaddr)x); - if (dim>1) atask->set_param(1,(memaddr)y); - if (dim>2) atask->set_param(2,(memaddr)z); run(this, read,write); } if (++x>=lx) {
--- a/TaskManager/kernel/schedule/SchedTaskBase.h Thu Jul 18 10:35:40 2013 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskBase.h Thu Jul 18 11:20:51 2013 +0900 @@ -107,6 +107,10 @@ */ void *readbuf; void *writebuf; + + /* multi demention parmeter */ + long x,y,z; + #define DefaultBoundSize (8) int din[DefaultBoundSize]; int dout[DefaultBoundSize];
--- a/example/basic/ppe/Twice.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/basic/ppe/Twice.cc Thu Jul 18 11:20:51 2013 +0900 @@ -4,10 +4,10 @@ #include "Func.h" /* これは必須 */ -SchedDefineTask(Twice); +SchedDefineTask1(Twice,twice); static int -run(SchedTask *s,void *rbuf, void *wbuf) +twice(SchedTask *s,void *rbuf, void *wbuf) { int *i_data; int *o_data; @@ -15,8 +15,9 @@ i_data = (int*)s->get_input(rbuf, 0); o_data = (int*)s->get_output(wbuf, 0); - i = (long)s->get_param(0); + i = s->x; o_data[i] = i_data[i] * 2; + if ( s->scheduler->id % 2 != i % 2) printf("i= %04ld ,id=%d,mincpu=%d,maxcpu=%d,lx=%ld,ly=%ld\n" ,i,s->scheduler->id,s->scheduler->min_cpu(),s->scheduler->max_cpu() ,s->list->x,s->list->y);
--- a/example/basic/spe/Twice.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/basic/spe/Twice.cc Thu Jul 18 11:20:51 2013 +0900 @@ -4,10 +4,10 @@ #include "Func.h" /* これは必須 */ -SchedDefineTask(Twice); +SchedDefineTask1(Twice,twice); static int -run(SchedTask *s, void *rbuf, void *wbuf) +twice(SchedTask *s, void *rbuf, void *wbuf) { int *i_data; int *o_data; @@ -15,11 +15,10 @@ i_data = (int*)s->get_input(rbuf, 0); o_data = (int*)s->get_output(wbuf, 0); - length = (long)s->get_param(0); + // length = (long)s->get_param(0); + i = s->x; - for (int i = 0; i < length; i++) { - o_data[i] = i_data[i] * 2; - } + o_data[i] = i_data[i] * 2; return 0; }
--- a/example/fft/ppe/bitReverse.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/bitReverse.cc Thu Jul 18 11:20:51 2013 +0900 @@ -14,8 +14,8 @@ cl_float2* src = (cl_float2*)s->get_inputAddr(0); cl_float2* dst = (cl_float2*)s->get_outputAddr(0); - unsigned long gid = (unsigned long)s->get_param(0); - unsigned long nid = (unsigned long)s->get_param(1); + unsigned long gid = s->x; // (unsigned long)s->get_param(0); + unsigned long nid = s->y; // (unsigned long)s->get_param(1); unsigned long m = (unsigned long)s->get_param(3); unsigned long n = (unsigned long)s->get_param(4);
--- a/example/fft/ppe/butterfly.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/butterfly.cc Thu Jul 18 11:20:51 2013 +0900 @@ -15,8 +15,8 @@ cl_float2* x_out = (cl_float2*)s->get_outputAddr(0); - unsigned long gid = (unsigned long)s->get_param(0); - unsigned long nid = (unsigned long)s->get_param(1); + unsigned long gid = s->x; // (unsigned long)s->get_param(0); + unsigned long nid = s->y; // (unsigned long)s->get_param(1); long n = (long)s->get_param(3); unsigned long direction_flag = (unsigned long)s->get_param(4);
--- a/example/fft/ppe/highPassFilter.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/highPassFilter.cc Thu Jul 18 11:20:51 2013 +0900 @@ -14,8 +14,8 @@ cl_float2* image = (cl_float2*)s->get_outputAddr(0); - unsigned long xgid = (unsigned long)s->get_param(0); - unsigned long ygid = (unsigned long)s->get_param(1); + unsigned long xgid = s->x; // (unsigned long)s->get_param(0); + unsigned long ygid = s->y; // (unsigned long)s->get_param(1); long n = (long)s->get_param(3); long radius = (long)s->get_param(4);
--- a/example/fft/ppe/norm.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/norm.cc Thu Jul 18 11:20:51 2013 +0900 @@ -14,8 +14,8 @@ cl_float2* out_x = (cl_float2*)s->get_outputAddr(0); - unsigned long gid = (unsigned long)s->get_param(0); - unsigned long nid = (unsigned long)s->get_param(1); + unsigned long gid = s->x; // (unsigned long)s->get_param(0); + unsigned long nid = s->y; //(unsigned long)s->get_param(1); long n = (long)s->get_param(3); if(nid == 100) {
--- a/example/fft/ppe/spinFact.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/spinFact.cc Thu Jul 18 11:20:51 2013 +0900 @@ -17,7 +17,7 @@ { cl_float2* w = (cl_float2*)s->get_outputAddr(0); - unsigned long i = (unsigned long)s->get_param(0); + unsigned long i = s->x; // (unsigned long)s->get_param(0); long n = (long)s->get_param(3);
--- a/example/fft/ppe/transpose.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/fft/ppe/transpose.cc Thu Jul 18 11:20:51 2013 +0900 @@ -15,8 +15,8 @@ cl_float2* dst = (cl_float2*)s->get_outputAddr(0); - unsigned long xgid = (unsigned long)s->get_param(0); - unsigned long ygid = (unsigned long)s->get_param(1); + unsigned long xgid = s->x; // (unsigned long)s->get_param(0); + unsigned long ygid = s->y; // (unsigned long)s->get_param(1); long n = (long)s->get_param(3);
--- a/example/multiply/ppe/Multi.cc Thu Jul 18 10:35:40 2013 +0900 +++ b/example/multiply/ppe/Multi.cc Thu Jul 18 11:20:51 2013 +0900 @@ -16,7 +16,7 @@ B = (float*)s->get_input(rbuf, 1); C = (float*)s->get_output(wbuf, 0); - long i = (long)s->get_param(0); + long i = s->x; long a = (long)s->get_param(3); long b = (long)s->get_param(4); if (a==256 && b==512) {