changeset 1608:8841d97c37e5 draft

debug CpuThreads::spawn_task
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 16 Apr 2013 18:27:38 +0900
parents b09f44c7c052
children 5d0b20373d95
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/ppe/CpuThreads.h TaskManager/kernel/ppe/HTask.cc example/word_count/a.txt
diffstat 6 files changed, 31 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Apr 16 12:12:27 2013 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Apr 16 18:27:38 2013 +0900
@@ -175,11 +175,6 @@
 
 }
 
-int
-CellTaskManagerImpl::max_cpu() {
-    return machineNum;
-}
-
 static void loop_check(HTask *p, HTask *me, int depth) {
     if (p == me)
         printf("*%lx ", (long) p); // loop
@@ -229,7 +224,7 @@
     memaddr data;
 
     // SPE Scheduler からの mail check
-    while (speThreads->has_mail(id, 1, &data)) {
+    while (speThreads->has_mail(id,1,&data)) {
         if (data == (memaddr) MY_SPE_STATUS_READY) {
             //  MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了
             // freeAll する前に循環リストに戻す
@@ -339,7 +334,10 @@
     tmp->getLast()->next = 0;
     TaskListPtr p = tmp->getFirst();
     // printf("SPE %d task list sending\n",id);
+
+    // speThreads->send_mail(id, 1, p);
     speThreads->spawn_task(id, p);
+
     // printf("SPE %d task list sent\n",id);
 }
 
--- a/TaskManager/Cell/CellTaskManagerImpl.h	Tue Apr 16 12:12:27 2013 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.h	Tue Apr 16 18:27:38 2013 +0900
@@ -43,7 +43,6 @@
     void polling();
     void debug_check_spe_idle(QueueInfo<HTask> * activeTaskQueue, int spe_running_);
     void print_arch();
-    int max_cpu();
 private:
     void send_taskList(int id);
     void show_dead_lock_info();
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Tue Apr 16 12:12:27 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Tue Apr 16 18:27:38 2013 +0900
@@ -102,16 +102,17 @@
 }
 
 void
-CpuThreads::spawn_task(int cpu_num, TaskListPtr p) {
+CpuThreads::spawn_task(int id, TaskListPtr p) {
     if (p->dim>0) {
-        int dim_count = (p->x+1)*(p->y+1)*(p->z+1);
+        int dim_count = (p->x)*(p->y)*(p->z);
         if (cpu_num < dim_count)
-            p->self->flag.dim_count = cpu_num;
-        for (int i = 0; i < cpu_num; i++) {
+            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()
         }
     } else {
-        send_mail(cpu_num,1,(memaddr*)&p);
+        send_mail(id, 1, (memaddr*)&p);
     }
 }
 
--- a/TaskManager/kernel/ppe/CpuThreads.h	Tue Apr 16 12:12:27 2013 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.h	Tue Apr 16 18:27:38 2013 +0900
@@ -36,6 +36,7 @@
     virtual int is_gpu(int cpuid);
     virtual void set_NDRange(void *ndr);
     virtual void spawn_task(int cpu_num,TaskListPtr p);
+
 private:
     /* variables */
     pthread_t *threads;
--- a/TaskManager/kernel/ppe/HTask.cc	Tue Apr 16 12:12:27 2013 +0900
+++ b/TaskManager/kernel/ppe/HTask.cc	Tue Apr 16 18:27:38 2013 +0900
@@ -31,10 +31,12 @@
 HTask::iterate(long x) {
     this->flag.dim_count = 0;
     TaskList *tl = (TaskList*)rbuf;
+    tl->self = this;
+    tl->set_last(last);
     tl->dim=1;
     tl->x=x;
-    tl->self = this;
-    tl->set_last(last);
+    tl->y=1;
+    tl->z=1;
     mimpl->spawn_task(this);
 }
 
@@ -42,11 +44,13 @@
 HTask::iterate(long x, long y) {
     this->flag.dim_count = 0;
     TaskList *tl = (TaskList*)rbuf;
+    tl->self = this;
+    tl->set_last(last);
+
     tl->dim=2;
     tl->x=x;
     tl->y=y;
-    tl->self = this;
-    tl->set_last(last);
+    tl->z=1;
     mimpl->spawn_task(this);
 }
 
@@ -54,12 +58,13 @@
 HTask::iterate(long x, long y, long z) {
     this->flag.dim_count = 0;
     TaskList *tl = (TaskList*)rbuf;
+    tl->self = this;
+    tl->set_last(last);
+
     tl->dim=3;
     tl->x=x;
     tl->y=y;
     tl->z=z;
-    tl->self = this;
-    tl->set_last(last);
     mimpl->spawn_task(this);
 }
 
--- a/example/word_count/a.txt	Tue Apr 16 12:12:27 2013 +0900
+++ b/example/word_count/a.txt	Tue Apr 16 18:27:38 2013 +0900
@@ -4,3 +4,12 @@
 aaa
 aaa
 aaa
+
+
+
+
+
+
+
+
+