changeset 1611:6c8f9791262e draft

fix min_cpu and max_cpu
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Thu, 09 May 2013 20:04:26 +0900
parents da6835e6d306
children 42f260639cc0
files TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h example/basic/main.cc example/basic/ppe/Twice.cc example/multiply/Func.h
diffstat 6 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Tue Apr 30 18:38:32 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Thu May 09 20:04:26 2013 +0900
@@ -19,7 +19,7 @@
     gpu = new GpuThreads(useRefDma);
 #endif
     threads = new pthread_t[cpu_num];
-    args    = new cpu_thread_arg_t[cpu_num];
+    args    = new cpu_thread_arg_t[cpu_num+id_offset];
     wait    = new Sem(0);
 
 }
@@ -56,7 +56,8 @@
     TaskManagerImpl *manager = new SpeTaskManagerImpl();
     c_scheduler->init(manager,argt->useRefDma);
     c_scheduler->id = (int)argt->cpuid;
-
+    c_scheduler->mincpu = id_offset;
+    c_scheduler->maxcpu = cpu_num + id_offset;
     manager->set_scheduler(c_scheduler);
     SchedRegister(ShowTime);
     SchedRegister(StartProfile);
@@ -109,7 +110,7 @@
             dim_count = cpu_num;
         p->self->flag.dim_count = dim_count;
         for (int i = 0; i < dim_count; i++) {
-            send_mail(i+SPE_0,1,(memaddr*)&p); // i+min_cpu()
+            send_mail(i+id_offset,1,(memaddr*)&p); // i+min_cpu()
         }
     } else {
         send_mail(id, 1, (memaddr*)&p);
--- a/TaskManager/kernel/schedule/Scheduler.cc	Tue Apr 30 18:38:32 2013 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Thu May 09 20:04:26 2013 +0900
@@ -417,13 +417,13 @@
 int
 Scheduler::max_cpu()
 { // todo
-    return task_list[0].cpu_type + manager->machineNum-1;
+    return maxcpu;
 }
 
 int
 Scheduler::min_cpu()
 { // todo
-    return task_list[0].cpu_type;
+    return mincpu;
 }
 
 MemorySegment *
--- a/TaskManager/kernel/schedule/Scheduler.h	Tue Apr 30 18:38:32 2013 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Thu May 09 20:04:26 2013 +0900
@@ -75,6 +75,7 @@
 
     /* variables */
     int id;
+    int mincpu,maxcpu;
     virtual int min_cpu();
     virtual int max_cpu();
     MemHash *hash;
--- a/example/basic/main.cc	Tue Apr 30 18:38:32 2013 +0900
+++ b/example/basic/main.cc	Thu May 09 20:04:26 2013 +0900
@@ -75,7 +75,7 @@
      */
     // twice->set_param(0,(memaddr)&length);
     twice->set_inData(0,data, sizeof(int)*length);
-    
+   
     /**
      * Set of OutPut area
      *   add_outData(address of output area, size of output area);
@@ -86,15 +86,16 @@
      * Set 32bits parameter
      *   add_param(32bit parameter);
      */
-    twice->set_param(0,(memaddr)length);
+    //twice->set_param(0,(memaddr)length);
 
     /*
      * set_post() で ppe task を渡せるようにしたい
      */
-    twice->set_post(twice_result, (void*)data, 0);
+    //    twice->set_post(twice_result, (void*)data, 0);
 
     // add Active Queue
-    twice->spawn();
+    twice->iterate(length);
+    
 }
 
 int
--- a/example/basic/ppe/Twice.cc	Tue Apr 30 18:38:32 2013 +0900
+++ b/example/basic/ppe/Twice.cc	Thu May 09 20:04:26 2013 +0900
@@ -11,15 +11,13 @@
 {
     int *i_data;
     int *o_data;
-    long length;
+    long i;
 
     i_data = (int*)s->get_input(rbuf, 0);
     o_data = (int*)s->get_output(wbuf, 0);
-    length = (long)s->get_param(0);
+    i = (long)s->get_param(0);
     
-    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/multiply/Func.h	Tue Apr 30 18:38:32 2013 +0900
+++ b/example/multiply/Func.h	Thu May 09 20:04:26 2013 +0900
@@ -3,4 +3,4 @@
     MULTIPLY_TASK,
 };
 
-#define DATA_NUM 2
+#define DATA_NUM 100