Mercurial > hg > GearsTemplate
annotate src/parallel_execution/context.h @ 379:2744cb933ebc
Fix compile error for bitonicSort but not work
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 23 Jul 2017 07:01:14 +0900 |
parents | ad44fdb11433 |
children | b81492c74d2b |
rev | line source |
---|---|
86 | 1 /* Context definition for llrb example */ |
132 | 2 #ifndef CONTEXT_H |
3 #define CONTEXT_H | |
207
7470b8382672
Fix compile error to stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
194
diff
changeset
|
4 #include <stdlib.h> |
86 | 5 #include <pthread.h> |
304
9755206813cb
helper_string.h for ANSI C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
302
diff
changeset
|
6 #ifdef USE_CUDAWorker |
98 | 7 #include <cuda.h> |
101 | 8 #endif |
86 | 9 |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
10 #define ALLOCATE_SIZE 20000000 |
101 | 11 #define NEW(type) (type*)(calloc(1, sizeof(type))) |
12 #define NEWN(n, type) (type*)(calloc(n, sizeof(type))) | |
13 | |
133 | 14 #define ALLOC_DATA(context, dseg) ({\ |
15 struct Meta* meta = (struct Meta*)context->heap;\ | |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
147
diff
changeset
|
16 meta->type = D_##dseg;\ |
236 | 17 meta->size = 1;\ |
133 | 18 context->heap += sizeof(struct Meta);\ |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
147
diff
changeset
|
19 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct dseg); (struct dseg *)context->data[D_##dseg]; }) |
101 | 20 |
133 | 21 #define ALLOC_DATA_TYPE(context, dseg, t) ({\ |
22 struct Meta* meta = (struct Meta*)context->heap;\ | |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
147
diff
changeset
|
23 meta->type = D_##t;\ |
236 | 24 meta->size = 1;\ |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
25 context->heap += sizeof(struct Meta);\ |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
147
diff
changeset
|
26 context->data[D_##dseg] = context->heap; context->heap += sizeof(struct t); (struct t *)context->data[D_##dseg]; }) |
86 | 27 |
132 | 28 #define ALLOCATE(context, t) ({ \ |
133 | 29 struct Meta* meta = (struct Meta*)context->heap;\ |
30 context->heap += sizeof(struct Meta);\ | |
31 union Data* data = context->heap; \ | |
32 context->heap += sizeof(struct t); \ | |
148
473b7d990a1f
fix data gears type enum
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
147
diff
changeset
|
33 meta->type = D_##t; \ |
236 | 34 meta->size = 1; \ |
133 | 35 data; }) |
132 | 36 |
233 | 37 #define ALLOC(context, t) (&ALLOCATE(context, t)->t) |
38 | |
237 | 39 #define ALLOC_ARRAY(context, dseg, len) ({\ |
236 | 40 struct Meta* meta = (struct Meta*)context->heap;\ |
41 context->heap += sizeof(struct Meta);\ | |
42 union Data* data = context->heap; \ | |
244 | 43 context->heap += sizeof(struct dseg *)*len; \ |
236 | 44 meta->type = D_##dseg; \ |
237 | 45 meta->size = len; \ |
236 | 46 data; }) |
47 | |
327
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
48 #define ALLOCATE_DATA_GEAR(context, t) ({ \ |
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
49 union Data* data = ALLOCATE(context, t); \ |
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
50 struct Meta* meta = GET_META(data); \ |
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
51 meta->wait = createSingleLinkedQueue(context); \ |
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
52 data; }) |
534601ed8c50
Running dependency example for single thread and single task
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
326
diff
changeset
|
53 |
288 | 54 #define GET_META(dseg) ((struct Meta*)(((void*)dseg) - sizeof(struct Meta))) |
55 #define GET_TYPE(dseg) (GET_META(dseg)->type) | |
352
3e01e963eb2d
Fix compile error for calc example but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
344
diff
changeset
|
56 #define GET_SIZE(dseg) (GET_META(dseg)->size) |
288 | 57 #define GET_WAIT_LIST(dseg) (GET_META(dseg)->wait) |
132 | 58 |
149 | 59 #define Gearef(context, t) (&(context)->data[D_##t]->t) |
186 | 60 |
232 | 61 // (struct SingleLinkedStack *)context->data[D_Stack]->Stack.stack->Stack.stack |
62 | |
63 #define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name) | |
64 | |
186 | 65 #include "c/enumCode.h" |
86 | 66 |
67 enum Relational { | |
68 EQ, | |
69 GT, | |
70 LT, | |
71 }; | |
72 | |
186 | 73 #include "c/enumData.h" |
86 | 74 |
75 struct Context { | |
76 enum Code next; | |
230 | 77 struct Worker* worker; |
78 struct TaskManager* taskManager; | |
86 | 79 int codeNum; |
80 __code (**code) (struct Context*); | |
81 void* heapStart; | |
82 void* heap; | |
83 long heapLimit; | |
87 | 84 int dataNum; |
236 | 85 int idgCount; //number of waiting dataGear |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
86 int idg; |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
87 int maxIdg; |
282
a3448b0f0a56
Add input data gear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
278
diff
changeset
|
88 int odg; |
288 | 89 int maxOdg; |
242 | 90 int workerId; |
308 | 91 #ifdef USE_CUDAWorker |
92 int num_exec; | |
93 CUmodule module; | |
94 CUfunction function; | |
309 | 95 #endif |
86 | 96 union Data **data; |
372
d6ce4273e7d1
Add dimension task spawn
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
369
diff
changeset
|
97 |
d6ce4273e7d1
Add dimension task spawn
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
369
diff
changeset
|
98 /* multi dimension parameter */ |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
99 int iterate; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
100 struct Iterator* iterator; |
86 | 101 }; |
102 | |
103 union Data { | |
133 | 104 struct Meta { |
105 enum DataType type; | |
236 | 106 long size; |
176 | 107 struct Queue* wait; // tasks waiting this dataGear |
133 | 108 } meta; |
259
195518ab62fc
fix type gathering pattern match in generate_stub.pl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
254
diff
changeset
|
109 struct Context Context; |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
110 struct Time { |
364
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
111 union Data* time; |
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
112 enum Code start; |
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
113 enum Code end; |
102 | 114 enum Code next; |
364
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
115 } Time; |
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
116 struct TimeImpl { |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
117 double time; |
364
a0a3301bac4d
Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
362
diff
changeset
|
118 } TimeImpl; |
86 | 119 struct LoopCounter { |
120 int i; | |
217
c34e6aa10967
Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
207
diff
changeset
|
121 } LoopCounter; |
176 | 122 struct TaskManager { |
320
f730761bb044
non CUDA case clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
316
diff
changeset
|
123 #ifdef USE_CUDA_MAIN_THREAD |
f730761bb044
non CUDA case clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
316
diff
changeset
|
124 volatile |
f730761bb044
non CUDA case clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
316
diff
changeset
|
125 #endif |
f730761bb044
non CUDA case clean up
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
316
diff
changeset
|
126 union Data* taskManager; |
234 | 127 enum Code spawn; // start NEW context on the worker |
353
b07078bd1f2c
Add spawn Tasks to TaskManagerImpl
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
352
diff
changeset
|
128 enum Code spawnTasks; // start NEW contexts on the worker |
176 | 129 enum Code shutdown; |
184 | 130 enum Code next; |
353
b07078bd1f2c
Add spawn Tasks to TaskManagerImpl
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
352
diff
changeset
|
131 enum Code next1; |
233 | 132 enum Code task; |
133 struct Context* context; | |
352
3e01e963eb2d
Fix compile error for calc example but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
344
diff
changeset
|
134 struct Context** contexts; |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
135 union Data* data; |
233 | 136 int worker; |
137 int cpu; | |
138 int gpu; | |
139 int io; | |
237 | 140 int maxCPU; |
184 | 141 } TaskManager; |
182 | 142 struct TaskManagerImpl { |
233 | 143 int numWorker; |
242 | 144 int sendWorkerIndex; |
239 | 145 pthread_mutex_t mutex; |
184 | 146 struct Queue* activeQueue; |
147 struct Queue* taskQueue; | |
244 | 148 struct Worker** workers; |
352
3e01e963eb2d
Fix compile error for calc example but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
344
diff
changeset
|
149 struct LoopCounter* loopCounter; |
184 | 150 } TaskManagerImpl; |
86 | 151 struct Worker { |
232 | 152 union Data* worker; |
222
77faa28128b4
Add taskSend for TaskManager
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
218
diff
changeset
|
153 enum Code taskReceive; |
176 | 154 enum Code shutdown; |
230 | 155 enum Code next; |
244 | 156 struct Queue* tasks; |
288 | 157 struct TaskManager* taskManager; |
184 | 158 } Worker; |
232 | 159 struct CPUWorker { |
233 | 160 pthread_t thread; |
242 | 161 pthread_mutex_t mutex; |
162 pthread_cond_t cond; | |
232 | 163 struct Context* context; |
164 int id; | |
165 } CPUWorker; | |
302 | 166 #ifdef USE_CUDAWorker |
167 struct CUDAWorker { | |
316
54d203daf06b
CUDAtwice.cbc is called.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
309
diff
changeset
|
168 CUdevice device; |
54d203daf06b
CUDAtwice.cbc is called.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
309
diff
changeset
|
169 CUcontext cuCtx; |
233 | 170 pthread_t thread; |
232 | 171 struct Context* context; |
172 int id; | |
173 struct Queue* tasks; | |
174 int runFlag; | |
175 enum Code next; | |
305 | 176 int num_stream; |
177 CUstream *stream; | |
178 } CUDAWorker; | |
187 | 179 #else |
302 | 180 struct CUDAWorker { |
305 | 181 } CUDAWorker; |
101 | 182 #endif |
177 | 183 struct Main { |
184 enum Code code; | |
185 enum Code next; | |
186 struct Queue* args; | |
185 | 187 } Main; |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
168
diff
changeset
|
188 // Queue Interface |
90 | 189 struct Queue { |
136 | 190 union Data* queue; |
167 | 191 union Data* data; |
192 enum Code whenEmpty; | |
193 enum Code clear; | |
194 enum Code put; | |
195 enum Code take; | |
196 enum Code isEmpty; | |
130 | 197 enum Code next; |
184 | 198 } Queue; |
167 | 199 struct SingleLinkedQueue { |
200 struct Element* top; | |
201 struct Element* last; | |
184 | 202 } SingleLinkedQueue; |
282
a3448b0f0a56
Add input data gear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
278
diff
changeset
|
203 struct SynchronizedQueue { |
a3448b0f0a56
Add input data gear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
278
diff
changeset
|
204 struct Element* top; |
a3448b0f0a56
Add input data gear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
278
diff
changeset
|
205 struct Element* last; |
a3448b0f0a56
Add input data gear
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
278
diff
changeset
|
206 } SynchronizedQueue; |
132 | 207 // Stack Interface |
130 | 208 struct Stack { |
132 | 209 union Data* stack; |
130 | 210 union Data* data; |
133 | 211 union Data* data1; |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
168
diff
changeset
|
212 enum Code whenEmpty; |
145
cc071cf1ba85
add stack clear interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
144
diff
changeset
|
213 enum Code clear; |
130 | 214 enum Code push; |
215 enum Code pop; | |
133 | 216 enum Code pop2; |
130 | 217 enum Code isEmpty; |
134
2eccf4564efe
fix stack call in rb_tree
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
218 enum Code get; |
133 | 219 enum Code get2; |
130 | 220 enum Code next; |
194 | 221 } Stack; |
132 | 222 // Stack implementations |
223 struct SingleLinkedStack { | |
224 struct Element* top; | |
194 | 225 } SingleLinkedStack; |
132 | 226 struct ArrayStack { |
227 int size; | |
228 int limit; | |
229 struct Element* array; | |
194 | 230 } ArrayStack; |
132 | 231 // Stack implementation end |
90 | 232 struct Element { |
113
d05b9937aa95
Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
233 union Data* data; |
90 | 234 struct Element* next; |
194 | 235 } Element; |
86 | 236 struct Array { |
379
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
237 union Data* Array; |
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
238 union Data* data; |
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
239 enum Code get; |
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
240 enum Code set; |
194 | 241 } Array; |
86 | 242 struct Tree { |
166 | 243 union Data* tree; |
244 struct Node* node; | |
152 | 245 enum Code put; |
246 enum Code get; | |
247 enum Code remove; | |
171 | 248 enum Code clear; |
152 | 249 enum Code next; |
166 | 250 } Tree; |
172 | 251 struct RedBlackTree { |
152 | 252 struct Node* root; |
122 | 253 struct Node* current; // reading node of original tree |
138 | 254 struct Node* previous; // parent of reading node of original tree |
124 | 255 struct Node* newNode; // writing node of new tree |
143
34a7a21edc36
recude stack get using traverse field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
138
diff
changeset
|
256 struct Node* parent; |
34a7a21edc36
recude stack get using traverse field
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
138
diff
changeset
|
257 struct Node* grandparent; |
132 | 258 struct Stack* nodeStack; |
86 | 259 int result; |
172 | 260 } RedBlackTree; |
147 | 261 struct RotateTree { |
262 enum Code next; | |
172 | 263 struct RedBlackTree* traverse; |
147 | 264 struct Tree* tree; |
217
c34e6aa10967
Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
207
diff
changeset
|
265 } RotateTree; |
86 | 266 struct Node { |
267 int key; // comparable data segment | |
90 | 268 union Data* value; |
86 | 269 struct Node* left; |
270 struct Node* right; | |
271 // need to balancing | |
272 enum Color { | |
273 Red, | |
274 Black, | |
275 } color; | |
217
c34e6aa10967
Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
207
diff
changeset
|
276 } Node; |
286 | 277 struct Semaphore { |
278 union Data* semaphore; | |
279 enum Code p; | |
280 enum Code v; | |
281 enum Code next; | |
282 } Semaphore; | |
283 struct SemaphoreImpl { | |
284 int value; | |
285 pthread_mutex_t mutex; | |
286 pthread_cond_t cond; | |
287 } SemaphoreImpl; | |
86 | 288 struct Allocate { |
289 enum Code next; | |
290 long size; | |
217
c34e6aa10967
Fix DataGear access name
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
207
diff
changeset
|
291 } Allocate; |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
292 struct Integer { |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
293 int value; |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
320
diff
changeset
|
294 } Integer; |
358 | 295 struct SortArray {//そもそもこれは必要なのか? |
360
ba5959d7901d
add bitonic_sort but not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
296 struct SortArray *sortArray; |
358 | 297 struct Integer **array;//Array arrayじゃできない? |
379
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
298 int loopCounter; |
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
299 int loopCounter2; |
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
300 int loopCounter3; |
366
136ce3537438
bitonic_sort's loop is work, but bitonic_sort is not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
360
diff
changeset
|
301 int sort_finish; |
358 | 302 enum Code make_array; |
303 enum Code print; | |
360
ba5959d7901d
add bitonic_sort but not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
304 enum Code bitonic_sort; |
ba5959d7901d
add bitonic_sort but not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
305 enum Code kernel; |
366
136ce3537438
bitonic_sort's loop is work, but bitonic_sort is not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
360
diff
changeset
|
306 enum Code kernel2; |
360
ba5959d7901d
add bitonic_sort but not work
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
307 enum Code swap; |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
308 } SortArray; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
309 struct Iterator { |
375
ad44fdb11433
Fix compile error but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
374
diff
changeset
|
310 union Data* iterator; |
ad44fdb11433
Fix compile error but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
374
diff
changeset
|
311 struct Context* task; |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
312 enum Code exec; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
313 enum Code barrier; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
314 enum Code whenWait; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
315 enum Code next; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
316 } Iterator; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
317 struct OneDimIterator { |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
318 int x; |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
319 int count; |
375
ad44fdb11433
Fix compile error but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
374
diff
changeset
|
320 struct LoopCounter *loopCounter; |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
372
diff
changeset
|
321 } OneDimIterator; |
254 | 322 }; // union Data end this is necessary for context generator |
113
d05b9937aa95
Change element data from Task to Data
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
323 |
259
195518ab62fc
fix type gathering pattern match in generate_stub.pl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
254
diff
changeset
|
324 typedef union Data Data; |
195518ab62fc
fix type gathering pattern match in generate_stub.pl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
254
diff
changeset
|
325 |
186 | 326 #include "c/typedefData.h" |
278 | 327 |
328 #include "c/extern.h" | |
329 | |
330 extern __code start_code(struct Context* context); | |
331 extern __code exit_code(struct Context* context); | |
332 extern __code meta(struct Context* context, enum Code next); | |
333 extern void initContext(struct Context* context); | |
334 | |
132 | 335 #endif |