annotate paper/chapter2.tex @ 76:e13727d01f7a

fix slide
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Wed, 26 Feb 2014 19:24:11 +0900
parents 17c93faef65b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
5e67750b1c4f write chapter label
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
1 \chapter{Cerium}
0
9bf2694ed231 add some files
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 \label{chap:concept}
9bf2694ed231 add some files
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
62
4fdfc9cd72e0 suspended to write chapter 2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
4 \section{Cerium Task Manager の概要}
4fdfc9cd72e0 suspended to write chapter 2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
5 Cerium Task Manager は並列プログラミングフレームワークであり、内部では C や C++ で実装されている。
4fdfc9cd72e0 suspended to write chapter 2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
6 Cerium Task Manager は、User が並列処理を Task 単位で記述し、関数やサブルーチンを Task として扱い、その Task に対して Input Data、Output Data 及び依存関係を設定する。
4fdfc9cd72e0 suspended to write chapter 2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
7 そして、それに基づいた設定の元で Task Manager にて管理し実行される。
73
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 69
diff changeset
8 Cerium Task Manager は PlayStation 3/Cell、Mac OS X 及び Linux 上で利用することが可能である。
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
9
62
4fdfc9cd72e0 suspended to write chapter 2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
10 図\ref{fig:createTask} では、 User が Task を生成して、CPU や GPU の各デバイスに Task が割り振られる様子を表している。
63
ea337d86686c add images
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 62
diff changeset
11 User が設定を行った Task は Task Manager にて生成される。その生成した Task に HTask にて Input Data 、Output Data や依存関係などを設定して Task の集合体である TaskList に Set する。
ea337d86686c add images
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 62
diff changeset
12 そして TaskList を各デバイスに割り振って、各 Scheduler に管理をさせたあとにそれぞれの Task を起動する。
0
9bf2694ed231 add some files
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
12
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
14 \begin{figure}[htbp]
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
15 \begin{center}
63
ea337d86686c add images
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 62
diff changeset
16 \includegraphics[width=0.7\textwidth]{fig/ceriumtaskmanager.pdf}
12
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
17 \end{center}
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
18 \caption{Cerium Task Manager}
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
19 \label{fig:createTask}
c623c0453fc1 add createTask fig
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
20 \end{figure}
39
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
21
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
22
64
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
23 \section{Cerium Task Manager の利用方法}
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
24
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
25 input Data で格納して 2 つの数を乗算し、output data に格納する multiply という例題がある。
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
26 その例題の Task 生成部分を以下に示す。
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
27 \\
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
28 \begin{breakbox}
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
29 \begin{verbatim}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
30 multi_init(TaskManager *manager)
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
31 {
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
32 float *A, *B, *C;
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
33 HTaskPtr multiply = manager->create_task(MULTIPLY_TASK);
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
34 multiply->set_cpu(SPE_ANY);
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
35 multiply->set_inData(0, (memaddr)A, sizeof(float)*length);
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
36 multiply->set_inData(1, (memaddr)B, sizeof(float)*length);
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
37 multiply->set_outData(0, (memaddr)C, sizeof(float)*length);
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
38 multiply->set_param(0,(long)length);
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
39 multiply->spawn();
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
40 }
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
41 \end{verbatim}
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
42 \end{breakbox}
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
43
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
44 \begin{tiny}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
45 \begin{table}[ht]
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
46 \begin{center}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
47 \label{table:create_taskAPI}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
48 \small
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
49 \begin{tabular}[t]{c|l}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
50 \hline
44
cd95400bcaec write BM search (not finish)
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
51 create\_task& Task を生成する \\
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
52 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
53 set\_inData & Task への入力データのアドレスを追加 \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
54 \hline
64
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
55 set\_outData & Task への出力データのアドレスを追加 \\
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
56 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
57 set\_param & Task へ値を一つ渡す。ここでは length \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
58 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
59 set\_cpu & Task を実行するデバイスの設定 \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
60 \hline
15
9b071b32e3de add some files and write slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
61 spawn & 生成した Task を TaskList に set \\
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
62 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
63 \end{tabular}
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
64 \caption{Task 生成における API}
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
65 \end{center}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
66 \end{table}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
67 \end{tiny}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
68
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
69 \newpage
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
70
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
71 Task の記述は以下のようになる。
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
72 \\
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
73
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
74 \begin{breakbox}
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
75 \begin{verbatim}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
76 static int
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
77 run(SchedTask *s,void *rbuf, void *wbuf)
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
78 {
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
79 float *A, *B, *C;
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
80 A = (float*)s->get_input(rbuf,0);
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
81 B = (float*)s->get_input(rbuf,1);
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
82 C = (float*)s->get_output(wbuf,0);
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
83 long length=(long)s->get_param(0);
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
84 for (int i=0;i<length;i++) {
35
d5b9addca752 add OUTLINE chapter2
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
85 C[i]=A[i]*B[i];
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
86 }
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
87 return 0;
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
88 }
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
89 \end{verbatim}
69
3988365f6f03 add eclbkbox.sty
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 64
diff changeset
90 \end{breakbox}
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
91
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
92 \begin{tiny}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
93 \begin{table}[ht]
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
94 \begin{center}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
95 \caption{Task 側で使用する API}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
96 \label{table:taskAPI}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
97 \small
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
98 \begin{tabular}[t]{c|l}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
99 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
100 get\_input & Scheduler から input data を取得 \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
101 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
102 get\_output & Scheduler から output data を取得 \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
103 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
104 get\_param & set\_param した値を取得 \\
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
105 \hline
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
106 \end{tabular}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
107 \end{center}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
108 \end{table}
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 12
diff changeset
109 \end{tiny}