annotate example/dependency_task/README @ 839:1001c4bea1a0 draft

if unnecessary
author Yutaka_Kinjyo
date Fri, 28 May 2010 03:24:52 +0900
parents 028ffc9c0375
children
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 /*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 * $Id: README,v 1.3 2008/10/20 08:49:52 gongo Exp $
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
3 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
4
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
5 - 概要
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 Task の依存関係を設定する例題
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8 タスクは二種類あって
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 配列 idata があるとする (サイズは length*2)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
11
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12 Exec: idata を length の前後に分けて受け取り、各要素に値を加算
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 半分に分けるため、今回はこのタスクを 2 つに固定。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14 まあ3つ以上でもいいんだけどね。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 Print: idata を表示する。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 依存関係としては、まずは Exec を先に実行しないといけないので
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21 ------------> 時間
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 Exec 1
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 \
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 Print
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 /
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 Exec 2
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 みたいな感じ。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 この依存を設定しないと、Print は Exec1,2 が計算する前の
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 idata を詠んでしまう可能性がある。
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 - 実行方法
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 % ./dependency [-cpu spe_num] [-nodepend]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
39 -cpu SPU の数
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
40 -nodepend Exec と Print に依存を設定しない
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
41
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
42
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 - 実行例
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 %./dependency
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 [TASK_PRINT]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 13 13 13 13 13 13 13 13 13 13 13 13 26 26 26 26 26 26 26 26 26 26 26 26
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 %./dependency -nodepend
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50 [TASK_PRINT]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
52
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 上の場合、Exec 1, 2 の処理結果が PPE の idata に書き込まれる前に
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 Print が idata から DMA でデータを取ってきて表示しているために
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 全て 0 になっている。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 このタスクが全て同じ SPE 上で実行されているとして、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 Exec 1, 2 のあと、Print の DMA read が実行される前に
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58 Exec 1, 2 の DMA write が済んでいればもしかしたらデータが取れるかもしれない。
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 しかし「もしかしたら」では使いものにならないので、依存を設定するわけです。