annotate example/HelloWorld/main.cc @ 1716:c12df61ded45 draft

fix gpu profile. not work yet
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 15 Oct 2013 17:21:10 +0900
parents 55f92ed3f244
children cd2ef2861eb1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
1 #include <stdio.h>
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include <stdlib.h>
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 #include <string.h>
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4 #include "TaskManager.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 #include "Func.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 extern void task_init(void);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9 static int count = 1;
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
10 static int spe_num = 1;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 extern TaskManager *manager;
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
13 int use_task_creater = 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14
253
0c9c9906d777 usr_help_str is nessesary for example
tkaito@localhost.localdomain
parents: 109
diff changeset
15 const char *usr_help_str = "Usage: ./hello [-cpu spe_num] [-count N]\n\
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 -cpu Number of SPE (default 1) \n\
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 -count Number of task is print \"Hello, World!!\"";
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 int
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20 init(int argc, char **argv)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 for (int i = 1; argv[i]; ++i) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 if (strcmp(argv[i], "-count") == 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 count = atoi(argv[++i]);
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
25 } else if (strcmp(argv[i], "-cpu") == 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
26 spe_num = atoi(argv[i+1]);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
27 } else if (strcmp(argv[i], "-t") == 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
28 use_task_creater = 1;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
29 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
30
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
31
253
0c9c9906d777 usr_help_str is nessesary for example
tkaito@localhost.localdomain
parents: 109
diff changeset
32
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
35 return 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
38
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
39 static void simple_task_creater(int in_total_size, int out_total_size,
1457
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
40 int command, int in_data_size, int out_data_size,
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
41 void *in_data, void *out_data, TaskManager *manager,
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
42 HTask *wait_i, HTask *wait_me) {
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
43
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
44
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
45 int in_task_size = 0;
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
46 int out_task_size = 0;
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
47
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
48 if (in_total_size != 0) {
1457
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
49 in_task_size = in_total_size / in_data_size;
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
50 if (in_total_size != in_task_size * in_data_size) {
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
51 printf("mismatch of in_total_size and in_data_size\n");
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
52 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
53 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
54
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
55 if (out_total_size != 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
56 out_task_size = out_total_size / out_data_size;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
57 if (out_total_size != out_task_size * out_data_size) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
58 printf("mismatch of out_total_size and out_data_size\n");
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
59 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
60 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
61
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
62 /*in, out の大きい方に合わせるのがいいかな? Taskの数は1Task分に使うデータの大きいほうを取るような仕様がいいかな*/
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
63 int task_num = (in_task_size > out_task_size) ? in_task_size : out_task_size;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
64
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
65 if (task_num == 0) task_num = 1;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
66
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
67 /*spe分あればいいのかな?*/
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
68
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
69 int array_num = spe_num;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
70 if (task_num < array_num) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
71 array_num = task_num;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
72 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
73
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
74
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
75 int array_length = task_num / array_num;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
76 int rest = task_num % array_num;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
77
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
78 HTaskPtr *task_array = (HTask**)manager->allocate(sizeof(HTask*)*array_num);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
79 TaskPtr *t_exec = (Task**)manager->allocate(sizeof(Task*)*array_length*array_num);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
80
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
81 int index = 0;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
82
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
83 for (int k = 0; k < array_num; k++) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
84
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
85 task_array[k] = manager->create_task_array(command,array_length,0,1,1);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
86 t_exec[k] = 0;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
87
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
88 if (wait_me != 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
89 wait_me->wait_for(task_array[k]);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
90 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
91 if (wait_i != 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
92 task_array[k]->wait_for(wait_i);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
93 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
94
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
95 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
96
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
97 for (int j = 0; j < array_length; j++) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
98 for (int k = 0; k < array_num; k++) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
99
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
100 t_exec[k] = task_array[k]->next_task_array(command,t_exec[k]);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
101 t_exec[k]->set_inData(0,(char*)in_data + index*in_data_size, in_data_size);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
102 t_exec[k]->set_outData(0,(char*)out_data + index*out_data_size, out_data_size);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
103
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
104 index++;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
105
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
106 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
107 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
108
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
109 for (int k = 0; k < array_num; k++) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
110 task_array[k]->spawn_task_array(t_exec[k]->next());
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
111 task_array[k]->set_cpu(SPE_ANY);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
112 task_array[k]->spawn();
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
113 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
114
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
115 for (int k = 0; k < rest; k++) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
116 HTaskPtr t_exec = manager->create_task(command);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
117
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
118 t_exec->set_inData(0,(char*)in_data + index*in_data_size, in_data_size);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
119 t_exec->set_outData(0,(char*)out_data + index*out_data_size, out_data_size);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
120
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
121 index++;
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
122
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
123 if (wait_me != 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
124 wait_me->wait_for(t_exec);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
125 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
126 if (wait_i != 0) {
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
127 t_exec->wait_for(wait_i);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
128 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
129
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
130 t_exec->set_cpu(SPE_ANY);
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
131 t_exec->spawn();
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
132
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
133 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
134
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
135
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
136 }
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
137
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
138 void
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
139 hello_init(TaskManager *manager)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
140 {
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 625
diff changeset
141
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
142 for (int i = 0; i < count; i++) {
1457
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
143 /**
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
144 * Create Task
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
145 * create_task(Task ID);
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
146 */
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
147
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
148
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
149 if (use_task_creater) {
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
150
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
151 simple_task_creater(0,0,Hello,0,0,0,0,manager,0,0);
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
152
55f92ed3f244 create GpuRunTest
Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
parents: 1039
diff changeset
153 } else {
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
154
1012
0e6c59377ef4 fix HelloWorld
one@zeus.cr.ie.u-ryukyu.ac.jp
parents: 786
diff changeset
155 HTask *hello = manager->create_task(Hello);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
156
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
157 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
158 * Select CPU
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
159 * SPE_0, SPE_1, SPE_2, SPE_3, SPE_4, SPE_5, SPE_ANY
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
160 * if you do not call this, execute PPE.
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
161 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
162 hello->set_cpu(SPE_ANY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
163
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
164 /**
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
165 * Set 32bits parameter
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
166 * add_param(32bit parameter);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
167 */
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 625
diff changeset
168 hello->set_param(0,(memaddr)i);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
169
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
170 hello->spawn();
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
171 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
172 }
1039
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
173
e8ef7f5f22f6 add TaskCreater test funciton..
yutaka@localhost.localdomain
parents: 1012
diff changeset
174
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
175 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
176
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
177 int
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
178 TMmain(TaskManager *manager, int argc, char *argv[])
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
179 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
180 if (init(argc, argv) < 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
181 return -1;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
182 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
183
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
184 // Task Register
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
185 // ppe/task_init.cc
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
186 task_init();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
187
400
984e7890db0c Fix examples.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 253
diff changeset
188 hello_init(manager);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
189
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
190 return 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
191 }