Mercurial > hg > Gears > GearsAgda
annotate src/parallel_execution/worker.c @ 170:ee7134f3bef1
Fix
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Nov 2016 10:36:45 +0900 |
parents | ea7b11f3e717 |
children | 8260b230dc2f |
rev | line source |
---|---|
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 #include <libkern/OSAtomic.h> |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 #include "context.h" |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 #include "origin_cs.h" |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
6 __code getTask1(struct Context* context, struct Queue* queue) { |
170 | 7 queue->next = C_getTask2 |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
8 goto meta(context, queue->take); |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
9 } |
109
059b26a250cc
Change put_queue process
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
10 |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
11 __code getTask1_stub(struct Context* context) { |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
12 goto getTask1(context, &context->data[D_ActiveQueue]->queue); |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 } |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
15 __code getTask2(struct Context* context, struct Task* task, struct Node* node) { |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
16 node->key = task->key; |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
17 |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
18 struct Traverse *t = &context->data[D_Traverse]->Traverse; |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
19 t->next = task->code; |
170 | 20 context->next = C_getTask1 |
169
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
21 goto meta(context, C_get); |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
22 } |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
23 |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
24 __code getTask2_stub(struct Context* context) { |
ea7b11f3e717
Using Queue Interface
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
149
diff
changeset
|
25 goto getTask2(context, &(context->data[D_ActiveQueue]->queue.data->task), &context->data[D_Node]->node); |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 } |
101 | 27 |
28 #ifdef USE_CUDA | |
98 | 29 __code twiceGpu(struct Context* context) { |
30 cuMemcpyHtoDAsync(context,context,context,context->stream); | |
31 cuLaunchkanel(); | |
32 cuMemcpyDtoHAsync(); | |
33 } | |
101 | 34 #endif |