Mercurial > hg > Papers > 2016 > masa-master
annotate cerium.tex @ 6:7a67daa0d39f
add createTask images
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 11 Jan 2016 11:39:37 +0900 |
parents | 515e18cdb197 |
children | 16d34f730a6d |
rev | line source |
---|---|
5
515e18cdb197
rename files
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
1 \chapter{Cerium} |
6
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
2 Cerium は、Cell 向けに開発された並列プログラミングフレームワークである。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
3 Cell は Sony Computer Entertainment 社が販売した PlayStation3 に搭載されているヘテロジニアスマルチコア・プロセッサである。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
4 本章では Cerium の実装について説明する。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
5 |
5
515e18cdb197
rename files
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
6 \section{Cerium の概要} |
6
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
7 Cerium は当初 Cell 向けに開発され、C/C++ で実装されている。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
8 現在では Linux、 MacOS X 上で動作する並列プログラミングフレームワークである。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
9 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
10 Cerium は TaskManager、SceneGraph、Rendering Engine の3要素から構成されている。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
11 本研究では汎用計算フレームワークである TaskManager を利用して文字列の並列計算を行なった。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
12 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
13 図\ref{fig:TaskManager}は Cerium が Task の生成/実行する場合のクラス構成図である。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
14 TaskManager で依存関係が解消され、実行可能になった Task は ActiveTaskList に格納される。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
15 ActiveTaskList に格納された Task は、依存関係が解消されているのでどのような順番で実行されても問題はない。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
16 Task は転送を行いやすい TaskList に変換され、CpuType に対応した Scheduler に転送される。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
17 なお、転送はSynchronozed Queue である mail を通して行われる。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
18 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
19 \begin{figure}[htpb] |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
20 \begin{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
21 \includegraphics[scale=0.7]{images/createTask.pdf} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
22 \end{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
23 \caption{Task Manager} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
24 \label{fig:TaskManager} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
25 \end{figure} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
26 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
27 \newpage |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
28 |
5
515e18cdb197
rename files
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
29 \section{Cerium TaskManager} |
6
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
30 Cerium TaskManager では、処理の単位を Task として記述していく。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
31 関数やサブルーチンを Task として取り扱い、その Task にて Input Data/Output Data 及び Task の依存関係を設定する。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
32 そして Task は設定された依存関係を考慮しながら実行される。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
33 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
34 Input Data で格納した 2 つの数を乗算し、Output Data に演算結果を格納する multiply という例題のソースコード\ref{src:createTask}を以下に示す。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
35 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
36 また、Task の生成時に用いる API 一覧を表\ref{table:TaskCreateAPI}に示す。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
37 \begin{lstlisting}[frame=lrbt,label=src:createTask,caption=Task の生成,numbers=left] |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
38 multi_init(TaskManager *manager) |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
39 { |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
40 float *A, *B, *C; |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
41 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
42 // create Task |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
43 HTaskPtr multiply = manager->create_task(MULTIPLY_TASK); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
44 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
45 // set device |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
46 multiply->set_cpu(SPE_ANY); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
47 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
48 // set inData |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
49 multiply->set_inData(0, (memaddr)A, sizeof(float)*length); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
50 multiply->set_inData(1, (memaddr)B, sizeof(float)*length); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
51 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
52 // set outData |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
53 multiply->set_outData(0, (memaddr)C, sizeof(float)*length); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
54 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
55 // set parameter |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
56 multiply->set_param(0,(long)length); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
57 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
58 // spawn task |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
59 multiply->spawn(); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
60 } |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
61 \end{lstlisting} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
62 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
63 \begin{tiny} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
64 \begin{table}[ht] |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
65 \begin{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
66 \label{table:TaskCreateAPI} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
67 \small |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
68 \begin{tabular}[t]{c|l} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
69 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
70 create\_task& Task を生成する \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
71 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
72 set\_inData & Task への入力データのアドレスを追加 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
73 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
74 set\_outData & Task への出力データのアドレスを追加 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
75 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
76 set\_param & Task へ値を一つ渡す。ここでは length \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
77 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
78 set\_cpu & Task を実行するデバイスの設定 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
79 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
80 spawn & 生成した Task を TaskList に set \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
81 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
82 \end{tabular} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
83 \caption{Task 生成における API} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
84 \end{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
85 \end{table} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
86 \end{tiny} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
87 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
88 次に、デバイス側で実行される Task のソースコードを\ref{src:task}に示す。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
89 \begin{lstlisting}[frame=lrbt,label=src:task,caption=Task,numbers=left] |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
90 static int |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
91 run(SchedTask *s) { |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
92 // get input |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
93 float *i_data1 = (float*)s->get_input(0); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
94 float *i_data2 = (float*)s->get_input(1); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
95 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
96 // get output |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
97 float *o_data = (float*)s->get_output(0); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
98 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
99 // get parameter |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
100 long length = (long)s->get_param(0); |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
101 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
102 // calculate |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
103 for (int i=0; i<length; i++) { |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
104 o_data[i] = i_data1[i] * i_data2[i]; |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
105 } |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
106 return 0; |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
107 } |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
108 \end{lstlisting} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
109 また表\ref{table:taskAPI}は Task 側で利用する API である。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
110 Task 生成時に設定した Input Data や parameter を取得することができる。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
111 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
112 \begin{tiny} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
113 \begin{table}[ht] |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
114 \begin{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
115 \caption{Task 側で使用する API} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
116 \label{table:taskAPI} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
117 \small |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
118 \begin{tabular}[t]{c|l} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
119 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
120 get\_input & Scheduler から input data を取得 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
121 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
122 get\_output & Scheduler から output data を取得 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
123 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
124 get\_param & set\_param した値を取得 \\ |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
125 \hline |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
126 \end{tabular} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
127 \end{center} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
128 \end{table} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
129 \end{tiny} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
130 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
131 Task 生成時に設定できる要素を以下に列挙する。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
132 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
133 \begin{itemize} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
134 \item Input Data |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
135 \item Output Data |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
136 \item Parameter |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
137 \item CpuType |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
138 \item Dependency |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
139 \end{itemize} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
140 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
141 Input/Output Data、Parameter は関数の引数に相当する。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
142 Cpu Type は Task を動作させるデバイスを設定することができ、Dependency は他の Task との依存関係を設定することができる。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
143 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
144 \section{並列処理向け I/O} |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
145 ファイル読み込みなどの I/O を含むプログラムは、読み込み時間が Task の処理時間と比較してオーバーヘッドになることが多い。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
146 計算処理の並列化を図ったとしても I/O がボトルネックになってしまい処理全体が高速にならない。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
147 本項では Cerium に実装した並列処理用 I/O を行ない、I/O 部分の高速化を図った。 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
148 |
7a67daa0d39f
add createTask images
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
149 Cerium の例題ではファイル読み込みを mmap にて実装していた。しかし、mmap だとファイルを読み込んでから Task を実行するので、読み込んでいる間は他の CPU が動作せず並列度が落ちる。そこで、I/O 部分も Task と並列に動作するように実装した。 |