Mercurial > hg > Gears > GearsAgda
annotate src/parallel_execution/CUDAtwice.cbc @ 302:8e7926f3e271
fix CUDAWorker
author | ikkun |
---|---|
date | Mon, 13 Feb 2017 17:58:04 +0900 |
parents | src/parallel_execution/GPUtwice.cbc@06dab015a54d |
children | 1dbaef86593b |
rev | line source |
---|---|
92 | 1 #include <stdio.h> |
2 | |
3 #include "context.h" | |
4 #include "origin_cs.h" | |
5 | |
257 | 6 __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, struct Context* workerContext) { |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
7 int i = loopCounter->i; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
8 if (i < prefix) { |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
9 array[i+index*prefix] = array[i+index*prefix]*2; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
10 loopCounter->i++; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
11 |
193 | 12 goto meta(context, C_twice); |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
13 } |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
14 |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
15 loopCounter->i = 0; |
248
1ede5390cda2
Fix segmentation fault but not multi thread running
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
247
diff
changeset
|
16 goto meta(workerContext, workerContext->next); |
92 | 17 } |
18 | |
19 __code twice_stub(struct Context* context) { | |
257 | 20 struct Context* workerContext = context->worker->worker->CPUWorker.context; |
275 | 21 //入力のDataGearをGPUにbuffer経由で送る |
22 //twiceカーネルが定義されてなければそれをロードする | |
23 //結果を取ってくるコマンドを入力する | |
24 //コマンドの終了待ちを行う | |
25 //continationにそってGPUworkerに戻る | |
248
1ede5390cda2
Fix segmentation fault but not multi thread running
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
247
diff
changeset
|
26 goto twice(context, Gearef(context, LoopCounter), 0, 0, NULL, workerContext); |
92 | 27 } |