changeset 1582:046695c73cb0 draft

add min_cpu(), max_cpu() (Who implements these?)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 Mar 2013 23:34:59 +0900
parents 8ee897303cd0
children 40a3504126a4
files TaskManager/Cell/SpeThreads.cc TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/Scheduler.h
diffstat 4 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/SpeThreads.cc	Sat Mar 30 18:29:54 2013 +0900
+++ b/TaskManager/Cell/SpeThreads.cc	Sat Mar 30 23:34:59 2013 +0900
@@ -107,10 +107,10 @@
 SpeThreads::spawn_task(int cpu_num, TaskListPtr p) {
     if (p->dim>0) {
       int dim_count = (x+1)*(y+1)*(z+1);
-      if (cpu_num > dim_count)
+      if (cpu_num < dim_count)
         p->tasks[0].self->dim_count = cpu_num;
         for (int i = 0; i < cpu_num; i++) {
-	  send_mail(i+1,1,(memaddr)&p);
+	  send_mail(i+SPE_0,1,(memaddr)&p);
 	}
     } else {
         send_mail(cpu_num,1,(memaddr)&p);
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Sat Mar 30 18:29:54 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Sat Mar 30 23:34:59 2013 +0900
@@ -105,10 +105,10 @@
 CpuThreads::spawn_task(int cpu_num, TaskListPtr p) {
     if (p->dim>0) {
         int dim_count = (p->x+1)*(p->y+1)*(p->z+1);
-        if (cpu_num > dim_count)
+        if (cpu_num < dim_count)
             p->self->flag.dim_count = cpu_num;
         for (int i = 0; i < cpu_num; i++) {
-            send_mail(i+1,1,(memaddr*)p);
+            send_mail(i+SPE_0,1,(memaddr*)p); // i+min_cpu()
 	}
     } else {
         send_mail(cpu_num,1,(memaddr*)p);
--- a/TaskManager/kernel/schedule/SchedTask.cc	Sat Mar 30 18:29:54 2013 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Sat Mar 30 23:34:59 2013 +0900
@@ -130,12 +130,12 @@
 
 void
 SchedTask::multi_dimension(TaskListPtr list, void* read, void* write,TaskObjectRun run) {
-    // 自分のidはSchedulerがわかる
     int x=0,y=0,z=0;
-    int cpu=0;
-    for (;;) {
+    int cpu=scheduler->min_cpu();
+    for (;;cpu++) {
+        if (cpu>scheduler->max_cpu()) cpu = scheduler->min_cpu();
         if (cpu==scheduler->id) {
-            if (list->dim>0) atask->set_param(1,(memaddr)x);
+            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);
             run(this, read,write);
@@ -148,7 +148,6 @@
                     break;		
                 }
             }
-            cpu++;
         }
     }
 }
--- a/TaskManager/kernel/schedule/Scheduler.h	Sat Mar 30 18:29:54 2013 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Sat Mar 30 23:34:59 2013 +0900
@@ -75,6 +75,8 @@
 
     /* variables */
     int id;
+    virtual int min_cpu();
+    virtual int max_cpu();
     MemHash *hash;
 
     // double buffering