annotate TaskManager/Cell/CellTaskManagerImpl.cc @ 1479:163220e54cc0 draft

remove hard code for TaskLog
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 24 Jul 2012 17:15:15 +0900
parents 5ca4e9469c65
children f2512fb94223
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
1 #define DEBUG
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
2 #include "error.h"
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
3 #include <stdio.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
4 #include <stdlib.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
5 #include <string.h>
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
6 #include "CellTaskManagerImpl.h"
956
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
7 #include "HTask.h"
197b7e19a345 unified queue worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
8 #include "QueueInfo.h"
1428
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
9 #include "ExportTaskLog.h"
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 620
diff changeset
10 #include "SchedTask.h"
635
c56f6847fb87 SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 631
diff changeset
11 #include "MainScheduler.h"
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
12 #include "types.h"
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
13 #include "SysFunc.h"
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
14
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
15 static void send_alloc_reply(CellTaskManagerImpl *tm, int id,
1185
26dea600d4cd fix CellTaskManagerImpl
Daichi TOMA <amothic@cr.ie.u-ryukyu.ac.jp>
parents: 1179
diff changeset
16 Threads *speThreads);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
17
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
18 CellTaskManagerImpl::~CellTaskManagerImpl() {
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
19
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
20 delete speThreads;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
21 delete[] speTaskList;
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
22
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
23 delete ppeManager;
67
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
24 }
7d2874fb0671 *** empty log message ***
gongo
parents: 66
diff changeset
25
1479
163220e54cc0 remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1477
diff changeset
26 void CellTaskManagerImpl::init(int spuIdle_,int useRefDma,int export_task_log) {
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
27 spe_running = 0;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
28 spuIdle = spuIdle_;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
29
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
30 // 実行される Task 用の パイプライン用のダブルバッファ
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
31 speTaskList = new QueueInfo<TaskList>*[machineNum]; // spe上の走っている Task の配列
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
32 taskListInfo = new QueueInfo<TaskList>*[machineNum]; // 次に走る Task の配列
476
5fc79ff9c257 CellBufferManager removed
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 380
diff changeset
33
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
34
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
35 for (int i = 0; i < machineNum; i++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
36 taskListInfo[i] = new QueueInfo<TaskList> (taskListPool);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
37 speTaskList[i] = new QueueInfo<TaskList> (taskListPool);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
38 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
39
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
40 // PPE 側の管理をする Manager
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
41 ppeManager = new FifoTaskManagerImpl(machineNum);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
42 // 大半のTaskQueueInfoは、共有される
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
43 MainScheduler *mscheduler = new MainScheduler;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
44 set_scheduler(mscheduler);
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1185
diff changeset
45 ppeManager->init(mscheduler, this, useRefDma); // ここで HTaskInfo が共有される。
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
46
1362
6b4a0846afcb Spe Threads Init moved
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1229
diff changeset
47 speThreads->init();
6b4a0846afcb Spe Threads Init moved
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1229
diff changeset
48
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
49 // 実行可能な HTask のリスト。 FifoTaskManager と共有される
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
50 activeTaskQueue = ppeManager->activeTaskQueue;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
51 // HTask の factory。 HTaskInfo ならなんでもいい。
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
52 htaskImpl = activeTaskQueue; // any HTaskInfo
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
53
1077
325b6c6d7d65 use one activeTaskQueue
yutaka@localhost.localdomain
parents: 1070
diff changeset
54
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
55 ppeManager->get_scheduler()->set_manager(this);
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
56
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
57 // Task 内からManager->task_create() とかするときに必要なTaskManager。
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
58 // 現状では ppe 側からしか動かない
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
59 // spe 側から Task create できない
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
60 schedTaskManager = new SchedTask();
1464
3f2230d79eba TaskList no compile errors
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1462
diff changeset
61 schedTaskManager->init(0, 0, ppeManager->get_scheduler(), 0);
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
62 ppeManager->schedTaskManager = schedTaskManager;
1479
163220e54cc0 remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1477
diff changeset
63
163220e54cc0 remove hard code for TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1477
diff changeset
64 _export_task_log = export_task_log;
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
65 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
66
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
67 void CellTaskManagerImpl::append_activeTask(HTaskPtr task) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
68 if (task->cpu_type == CPU_PPE) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
69 ppeManager->append_activeTask(task);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
70 } else {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
71 activeTaskQueue->addLast(task);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
72 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
73 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
74
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
75 // SPE_ANY が指定されていた時に
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
76 // これをインクリメントしつつ呼ぶことにする。
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
77 unsigned int cur_anySpeid = 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
78
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
79 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
80 * ActiveTaskQueue から Task を
938
20beb83a5a22 dead lock still remains. zombi problem?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 937
diff changeset
81 * 各 SPE に渡す (backgound) TaskList に入れる
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
82 *
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
83 * ここの activeTaskQueue は FifoTaskManagerImpl のと意味が違い、
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
84 * spe に渡される Task だけ入っている
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
85 */
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
86 void CellTaskManagerImpl::set_runTaskList(QueueInfo<HTask> *activeTaskQueue) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
87 int speid;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
88 HTaskPtr htask = activeTaskQueue->getFirst();
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
89 while (htask != NULL) {
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
90
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
91 if (htask->cpu_type == CPU_PPE) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
92
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
93 htask = activeTaskQueue->getNext(htask);
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
94
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
95 } else {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
96 if (htask->cpu_type == SPE_ANY) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
97 speid = cur_anySpeid++;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
98 } else {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
99 // -1 してるのは
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
100 // htask->cpu_type - CPU_SPE で
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
101 // SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
102 // 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
103 speid = htask->cpu_type - CPU_SPE - 1;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
104 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
105
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
106 speid %= machineNum;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
107 set_taskList(htask, taskListInfo[speid]);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
108
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
109 HTaskPtr next = activeTaskQueue->getNext(htask);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
110 activeTaskQueue->remove(htask);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
111 htask = next;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
112
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
113 }
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
114 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
115 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
116
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
117 void CellTaskManagerImpl::sendTaskList() {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
118 for (int id = 0; id < machineNum; id++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
119 mail_check(id);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
120 if (!speTaskList[id]->empty()) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
121 continue; // まだ、走ってる
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
122 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
123 if (!taskListInfo[id]->empty()) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
124 // SPE に送る TaskList の準備
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
125 send_taskList(id);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
126 spe_running++;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
127 }
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
128 }
721
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
129 }
a0cfe7b28882 cleanups..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 720
diff changeset
130
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
131 void CellTaskManagerImpl::poll() {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
132 set_runTaskList(activeTaskQueue);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
133 // TaskList 待ちの SPE に TaskList を送る
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
134 sendTaskList();
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
135 }
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
136
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
137 void CellTaskManagerImpl::debug_check_spe_idle(
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
138 QueueInfo<HTask> * activeTaskQueue, int spe_running_) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
139 printf("spu_idle! spe_running = %d : activeTaskQueue->length = %d \n",
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
140 spe_running_, activeTaskQueue->length());
1116
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
141 HTaskPtr task = activeTaskQueue->getFirst();
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
142 int tmp_i = 0;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
143 do {
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
144 printf("task_name = %s ,", ppeManager->get_task_name(task));
1116
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
145 printf("cpu = [%d], count = %d", task->cpu_type, tmp_i);
8e818d8fa36b It's changed so that CreateSpan may move in the SPE.
tkaito@henri
parents: 1082
diff changeset
146 tmp_i++;
1057
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
147 } while ((task = activeTaskQueue->getNext(task)) != 0);
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
148 printf("\n");
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
149 }
8cd123d2f3ca debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents: 972
diff changeset
150
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
151 void CellTaskManagerImpl::run() {
1437
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
152 int spu_limit = spuIdle;
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
153 if (machineNum == 0) {
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
154 ppeManager->run();
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
155 return;
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
156 }
1125
b733c7903d07 remove old code
yutaka@localhost.localdomain
parents: 1123
diff changeset
157
1437
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
158 do {
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
159 // PPE side
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
160 ppeManager->poll();
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
161 // SPE side
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
162 do {
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
163 poll();
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
164 } while (ppeManager->activeTaskQueue->empty() && spe_running > 0);
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
165
1437
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
166 if (spe_running < spu_limit) {
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
167 debug_check_spe_idle(ppeManager->activeTaskQueue, spe_running);
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
168 }
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
169
1437
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
170 } while (!ppeManager->activeTaskQueue->empty() || !activeTaskQueue->empty() || spe_running > 0);
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
171 if (!waitTaskQueue->empty()) {
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
172 show_dead_lock_info();
fa6723e7d329 fix GpuTaskManagerImpl
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1429
diff changeset
173 }
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
174
937
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
175 }
ecafd19a1d83 Sort working on spu cpu == 1 or -a case
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 936
diff changeset
176
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
177 static void loop_check(HTask *p, HTask *me, int depth) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
178 if (p == me)
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
179 printf("*%lx ", (long) p); // loop
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
180 if (depth == 0)
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
181 return;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
182 QueueInfo<TaskQueue> *w = p->wait_i;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
183 if (w) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
184 for (TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
185 loop_check(q->task, me, depth - 1);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
186 }
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
187 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
188 }
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
189
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
190 void CellTaskManagerImpl::show_dead_lock_info() {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
191 get_scheduler()-> printf("Dead lock detected\n ppe queue %d\n",
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
192 ppeManager->activeTaskQueue->length());
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
193 // 確か waitQueue は共通...
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
194 // get_scheduler()-> printf(" wait queue %d\n",ppeManager->waitTaskQueue->length());
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
195 get_scheduler()-> printf(" wait queue %d\n", waitTaskQueue->length());
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
196 for (HTask *p = waitTaskQueue->getFirst(); p; p = waitTaskQueue->getNext(p)) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
197 printf(" Waiting task%d %lx", p->command, (long) p);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
198 QueueInfo<TaskQueue> *w = p->wait_i;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
199 if (w) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
200 for (TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
201 printf(" waiting task%d %lx", q->task->command,
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
202 (long) q->task);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
203 if (!waitTaskQueue->find(q->task)) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
204 printf("!"); // stray task
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
205 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
206 loop_check(q->task, p, 10);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
207 }
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
208 }
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
209 printf("\n");
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 938
diff changeset
210 }
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
211 get_scheduler()-> printf(" spe queue %d\n", activeTaskQueue->length());
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
212 for (int i = 0; i < machineNum; i++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
213 get_scheduler()-> printf(" spe %d send %d wait %d\n", i,
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
214 speTaskList[i]->length(), taskListInfo[i]->length());
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
215 }
70
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
216 }
178459e03f5c *** empty log message ***
gongo
parents: 67
diff changeset
217
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 61
diff changeset
218 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
219 * SPE からのメールをチェックする
640
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
220 */
ecf056ddd21a SimpeTask on Cell worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 638
diff changeset
221
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
222 void CellTaskManagerImpl::mail_check(int id) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
223 memaddr data;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
224
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
225 // SPE Scheduler からの mail check
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
226 while (speThreads->has_mail(id, 1, &data)) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
227 if (data == (memaddr) MY_SPE_STATUS_READY) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
228 // MY_SPE_STATUS_READY: SPE が持ってた Task 全て終了
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
229 // freeAll する前に循環リストに戻す
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
230 speTaskList[id]->getLast()->next = speTaskList[id];
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
231 speTaskList[id]->freeAll();
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
232 spe_running--;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
233 // printf("SPE %d status ready, %d running\n",id, spe_running);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
234 } else if (data == (memaddr) MY_SPE_COMMAND_MALLOC) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
235 // MY_SPE_COMMAND_MALLOC SPE からのmain memory request
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
236 send_alloc_reply(this, id, speThreads);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
237 } else if (data > (memaddr) MY_SPE_NOP) {
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
238 #ifdef TASK_LIST_MAIL
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
239 TaskListPtr list = (TaskListPtr)data;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
240 check_task_list_finish(schedTaskManager, list, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
241 #else
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
242 // 終了したタスク(PPEにあるのでアドレス)
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
243 HTaskPtr task = (HTaskPtr) data;
1151
kaito@dolphins
parents: 1150
diff changeset
244 #if 0
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
245 if (task->cpu_type != CPU_SPE) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
246 const char *name = get_task_name(task);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
247 if (name != NULL) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
248 printf("[SPE] ");
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
249 printf("Task id : %d, ", task->command);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
250 printf("Task name : %s\n", name);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
251 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
252 }
1150
d014639cbdc7 add test code.
kaito@dolphins
parents: 1147
diff changeset
253 #endif
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
254 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
255
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
256 if (task != NULL) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
257 //SPE で処理された Task が返ってくるはず。それがもし、type PPE なら・・・
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
258 if (task->cpu_type == CPU_PPE) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
259 printf("attention : PPE task run on SPE\n");
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
260 printf("Task id : %d\n", task->command);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
261 const char *name = get_task_name(task);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
262 if (name != NULL) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
263 printf("Task name : %s\n", name);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
264 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
265 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
266 }
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
267
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1125
diff changeset
268 #endif
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
269
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
270 task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
271 check_task_finish(task, waitTaskQueue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 812
diff changeset
272 #endif
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
273 }
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
274 // MY_SPE_NOP: 特に意味のないコマンド
719
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
275 }
cc1b7333de92 clean up scheduler main loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 718
diff changeset
276 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
277
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
278 void CellTaskManagerImpl::polling() {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
279 // may call recursively check_task_list_finish()
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
280 // we need fifo here
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
281 for (int i = 0; i < machineNum; i++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
282 mail_check(i);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
283 }
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
284 }
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
285
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
286 static void send_alloc_reply(CellTaskManagerImpl *tm, int id,
1185
26dea600d4cd fix CellTaskManagerImpl
Daichi TOMA <amothic@cr.ie.u-ryukyu.ac.jp>
parents: 1179
diff changeset
287 Threads *speThreads) {
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
288
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
289 /**
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
290 * info[0] = alloc_id; (CellScheduler::mainMem_alloc 参照)
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
291 * info[1] = alloc_addr;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
292 */
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
293 memaddr alloc_info[2];
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
294 long alloc_size;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
295 long command;
275
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 273
diff changeset
296
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
297 speThreads->get_mail(id, 2, alloc_info);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
298 command = (long) alloc_info[0];
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
299 alloc_size = (long) alloc_info[1];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
300
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
301 alloc_info[1] = (memaddr) tm->allocate(alloc_size);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
302 //__debug_ppe("[PPE] MALLOCED 0x%lx from [SPE %d]\n", alloc_info[1],id);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
303 // 今のところ何もしてない。どうも、この allocate を free
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
304 // するのは、SPE task が返した値を見て行うらしい。それは、
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
305 // 忘れやすいのではないか?
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
306 speThreads->add_output_tasklist(command, alloc_info[1], alloc_size);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
307
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
308 speThreads->send_mail(id, 2, alloc_info);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
309 }
66
1034077dd217 *** empty log message ***
gongo
parents: 65
diff changeset
310
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
311 /**
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
312 * 条件を満たしたら SPE に TaskList を送信する
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
313 * 条件1. SPE が持ってた TaskList を終了して、次の TaskList を待ってる
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
314 * 条件2. SPE に送る TaskList に Task がある
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
315 *
808
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
316 * SPE で実行終了した speTaskList と
3c404a32719c TaskListInfo version
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 806
diff changeset
317 * これから実行する taskListInfo のバッファを入れ替える
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
318 */
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
319 void CellTaskManagerImpl::send_taskList(int id) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
320 // speTaskList は走り終わった ppe の Task の List.
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
321 // taskListInfo はこれから走る Task の List.
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
322 // 交換して実行する
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
323 QueueInfo<TaskList> *tmp = taskListInfo[id];
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
324 taskListInfo[id] = speTaskList[id];
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
325 speTaskList[id] = tmp;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
326
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
327 // speTaskList は本来は循環リストなのだけど、実行中は線形リストである。
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
328 // spe の Task が終了した時点でなおす。
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
329 tmp->getLast()->next = 0;
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
330 TaskListPtr p = tmp->getFirst();
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
331 // printf("SPE %d task list sending\n",id);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
332 speThreads->send_mail(id, 1, (memaddr *) &p);
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
333 // printf("SPE %d task list sent\n",id);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
334 }
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
335
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
336 void CellTaskManagerImpl::show_profile() {
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
337 for (int id = 0; id < machineNum; id++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
338 HTaskPtr t = schedTaskManager->create_task(ShowTime, 0, 0, 0, 0);
1477
5ca4e9469c65 remove GpuTaskManagerImpl
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1468
diff changeset
339 t->set_cpu((CPU_TYPE) (id + SPE_0));
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
340 t->spawn();
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
341 }
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
342 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
343
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
344 void CellTaskManagerImpl::start_profile() {
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
345 for (int id = 0; id < machineNum; id++) {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
346 HTaskPtr t = schedTaskManager->create_task(StartProfile, 0, 0, 0, 0);
1477
5ca4e9469c65 remove GpuTaskManagerImpl
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1468
diff changeset
347 t->set_cpu((CPU_TYPE) (id + SPE_0));
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
348 t->spawn();
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
349 }
672
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
350 }
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
351
1428
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
352 void CellTaskManagerImpl::export_task_log() {
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
353 ExportTaskLog _export(taskLogQueue);
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
354 _export.printOut();
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
355 }
af2adce9752e add to export TaskLog
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
356
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
357 void CellTaskManagerImpl::print_arch() {
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
358 printf("CellTaskManager\n");
1067
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
359 }
5ad8fb1dc70f print_arch add.
tkaito
parents: 1066
diff changeset
360
1427
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
361 TaskListPtr CellTaskManagerImpl::createTaskList()
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
362 {
1462
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
363 TaskListPtr tl = taskListInfo[0]->create();
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
364 bzero(tl->tasks,sizeof(Task)*TASK_MAX_SIZE);
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1427
diff changeset
365 return tl;
1427
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
366 }
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
367
db5c022d871c task array uses TaskList. (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1362
diff changeset
368
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
369 #ifdef __CERIUM_CELL__
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
370 TaskManagerImpl*
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1185
diff changeset
371 create_impl(int num, int useRefDma)
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
372 {
1185
26dea600d4cd fix CellTaskManagerImpl
Daichi TOMA <amothic@cr.ie.u-ryukyu.ac.jp>
parents: 1179
diff changeset
373 Threads *cpus = new SpeThreads(num);
1179
5393bebe0956 CpuThreads update
Daichi TOMA
parents: 1151
diff changeset
374 return new CellTaskManagerImpl(num,cpus);
57
1f8a23cdeec3 *** empty log message ***
gongo
parents:
diff changeset
375 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
376 #endif // __CERIUM_CELL