Mercurial > hg > Game > Cerium
changeset 1671:6b34346cf23a draft
SPE
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 18 Jul 2013 10:35:40 +0900 |
parents | 56eb3babc8b9 |
children | 32bc4ea3557f |
files | TaskManager/Cell/SpeThreads.cc TaskManager/kernel/schedule/SchedTask.cc |
diffstat | 2 files changed, 27 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/SpeThreads.cc Thu Jul 18 07:54:45 2013 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Thu Jul 18 10:35:40 2013 +0900 @@ -104,16 +104,20 @@ } void -SpeThreads::spawn_task(int cpu_num, TaskListPtr p) { - if (p->dim>0) { - int dim_count = (x+1)*(y+1)*(z+1); +SpeThreads::spawn_task(int id, TaskListPtr p) { + + p->self->flag.dim_count = 1; // always dim_count set min cpu. min cpu is 1. + if (p->dim>0 && id >= SPE_0) { + int dim_count = (p->x)*(p->y)*(p->z); if (cpu_num < dim_count) - p->tasks[0].self->dim_count = cpu_num; - for (int i = 0; i < cpu_num; i++) { + dim_count = cpu_num; + } + p->slef->flag.dim_count = dim_count; + for (int i = 0; i < dim_count; i++) { send_mail(i+SPE_0,1,(memaddr*)p); } } else { - send_mail(cpu_num,1,(memaddr*)p); + send_mail(id ,1,(memaddr*)p); } }
--- a/TaskManager/kernel/schedule/SchedTask.cc Thu Jul 18 07:54:45 2013 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Thu Jul 18 10:35:40 2013 +0900 @@ -131,20 +131,28 @@ void SchedTask::multi_dimension(TaskListPtr list, void* read, void* write,TaskObjectRun run) { int x=0,y=0,z=0; - int cpu=scheduler->min_cpu(); + 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; + + int cpu=min; for (;;cpu++) { - if (cpu>scheduler->max_cpu()) cpu = scheduler->min_cpu(); - if (cpu==scheduler->id) { - if (list->dim>0) atask->set_param(0,(memaddr)x); - if (list->dim>1) atask->set_param(1,(memaddr)y); - if (list->dim>2) atask->set_param(2,(memaddr)z); + 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>=list->x) { + if (++x>=lx) { x=0; - if (++y>=list->y) { + if (++y>=ly) { y=0; - if (++z>=list->z) { + if (++z>=lz) { break; } }