annotate TaskManager/test/SetCpuTest/README @ 1643:6c0b6947c231 draft

fix fft
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Sat, 22 Jun 2013 18:10:55 +0900
parents b3edf26734f5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1628
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
1 /*
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
2 * $Id: README,v 1.5 2008/10/20 10:02:01 gongo Exp $
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
3 */
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
4
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
5 - 概要
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
6
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
7 int の配列を送り、タスク(Twice) で、配列の要素を2倍にして送り返します。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
8
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
9 PPE->SPE の DMA 転送は main.cc の twice_init に
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
10 書いてるのでわかってもらえるかなと信じて、タスク側で
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
11 そのデータの受け取り方を説明する。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
12
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
13 -------------------------------------
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
14 PPE から送られてきたデータの受け取り
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
15 -------------------------------------
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
16
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
17 void *get_input(void *p, int index) を使う。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
18
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
19 p には rbuf が入ります。今のところ確定なのでわざわざ書かせる必要も無いか。。。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
20 index は、create task 時に add_inData したと思うけど、その順番になります。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
21
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
22 add_inData(data1, size1);
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
23 add_inData(data2, size2);
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
24
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
25 の順番で記述した場合、
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
26
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
27 data1 = get_input(rbuf, 0);
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
28 data2 = get_input(rbuf, 0);
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
29
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
30 で取れます。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
31
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
32 -------------------------------------
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
33 PPE へデータを送る
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
34 -------------------------------------
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
35
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
36 void *get_output(void *p, int index) を使う。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
37
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
38 p は wbuf, index は input と同じ感じでいいです。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
39 get_output で受け取った領域でデータを書けば、
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
40 このタスクが終了した後に、add_outData で指定したアドレスに書き込まれます。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
41
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
42
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
43 - 実行方法
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
44
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
45 ./twice [-cpu spe_num] [-length data_length]
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
46
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
47 -cpu 使用する SPU の数
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
48 // 今回はあまり意味の無いオプションです。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
49 // 巨大な配列の場合、複数に振り分けてそれぞれで 2 倍させるっていう
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
50 // 処理を入れれば意味のあるものになります。誰か(ry
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
51
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
52 -length 配列の要素の数
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
53
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
54
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
55 - 実行例
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
56
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
57 % ./twice
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
58 before ---
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
59 0 1 2 3 4 5 6 7 8 9 10 11
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
60 after ---
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
61 0 2 4 6 8 10 12 14 16 18 20 22
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
62
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
63 % ./twice -length 20
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
64 before ---
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
65 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
66 after ---
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
67 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
68
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
69 % ./twice -length 15
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
70 before ---
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
71 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
72 zsh: bus error ./twice -length 15
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
73
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
74 上の場合、PS3上(SPE使った場合)では bus error が出ます。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
75 この理由は length にあって、送るデータのバイト数が
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
76 4バイト(int) x 15 = 60 バイト だからです。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
77 PPE <-> SPE での DMA 転送のサイズは
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
78 1,2,4,8バイト, もしくは 16バイト倍数と決まっています。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
79 このサイズに誤りがある場合、上のように bus error が出ます。
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
80 この辺の詳しい仕様は、
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
81
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
82 Game_project/ps3/docs にある PDF や
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
83
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
84 Fixstars のサイト
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
85 http://cell.fixstars.com/ps3linux/index.php/3.3 DMA転送によるデータの受け渡し
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
86
b3edf26734f5 add SetCpuTest
shohei kokubo
parents:
diff changeset
87 とか見ればわかると思います