annotate slide/index.html @ 81:c56ba6ec440a

fix
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Thu, 27 Feb 2014 12:15:07 +0900
parents b38e4f75351b
children a01aded24d3b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 <!DOCTYPE html>
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 <html>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
4 <head>
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 <title>Presentation</title>
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 <meta charset='utf-8'>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
7 <script src='./slides.js'></script>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
8 </head>
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
10 <style>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
11 /* Your individual styles here, or just use inline styles if that’s
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
12 what you want. */
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
14 </style>
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
16 <body style='display: none'>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
17 <section class='slides layout-regular template-default'>
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
19 <!--
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
20 Your slides (<article>s) go here. Delete or comment out the
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
21 slides below.
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
22 -->
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
23 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
24 <h1>Cerium による並列処理向け I/O の設計と実装</h1>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
25 <h3 class="title">Masataka Kohagura 27th, February</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
26 <div align="right">担当教官 : 河野 真治</div>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
27 </article>
19
36958c5e0b90 add slide pages 8-17
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
28
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
29 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
30 <h3>I/Oを含むアプリケーションの並列化</h3>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
31 <p>
80
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
32 Cerium : <br>
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
33 CellおよびLinux、 Mac OS X 上で動く並列プログラミングフレームワーク
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
34 </p>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
35 <img src='images/resources.png' style="height:170px" align="middle">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
36 <ul>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
37 <li><font color=red>ファイル読み込みとアプリケーションの分離</font> </li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
38 <li><font color=red>I/O専用の Threadを追加</font></li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
39 </ul>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
40 mmap 実装と比較して1.5倍の速度を得た
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
41 </article>
14
0e7c972b5ca1 write slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
42
27
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 26
diff changeset
43
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
44 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
45 <h3>Cerium Task Manager の構造</h3>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
46 <table border="0" cellpadding="0" cellspacing="0">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
47 <tbody>
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
48 <tr>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
49 <td><img src='images/ceriumtaskmanager.png' style="height:280px"></td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
50 <td>
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
51 <ol>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
52 <li>Taskを生成</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
53 <li>依存関係のチェック</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
54 <li>Schedulerに転送</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
55 <li>並列実行</li>
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
56 </ol>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
57 </td>
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
58 </tr>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
59 </tbody>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
60 </table>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
61 <p>
81
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 80
diff changeset
62 ファイルを読みながら、Word Count や grep などを<br>
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 80
diff changeset
63 並列実行したい
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
64 </p>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
65 </article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
66
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
67 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
68 <h3>Block 単位の読み込みと並列計算</h3>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
69 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
70 <img src='images/includeIOTask.png' style="height:270px" align="middle">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
71 <ol>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
72 <li>テキストファイルの読み込み後、ファイルをある一定の大きさに分割する</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
73 <li>分割したテキストファイルに対して、それぞれ計算を行う</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
74 <li>計算した結果を集計する</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
75 </ol>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
76 </article>
15
9b071b32e3de add some files and write slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
77
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
78 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
79 <h3>mmap の特徴</h3>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
80 従来では mmap を使って読み込んでいた
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
81 <table border="0" cellpadding="0" cellspacing="0">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
82 <tbody>
23
a452d8f104bd divede read rename to Block Read
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
83 <tr>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
84 <td><img src='images/mmap.png' style="height:350px" align="middle"></td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
85 <td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
86 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
87 <font size = 5>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
88 <li>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
89 mmap は、ファイルを直接メモリ空間に map する。<br>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
90 アクセスされたメモリ部分を OS が自動的に読み込む。<br>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
91 読み込みがおわるまでアクセスは任される。<br>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
92 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
93 <li>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
94 code がシンプルだが、読み込み終わるまで待たされる。 <br>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
95 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
96 </font>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
97 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
98 </td>
23
a452d8f104bd divede read rename to Block Read
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
99 </tr>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
100 </tbody>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
101 </table>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
102 </article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
103
16
56cd6800acb5 write slide No.11 & add images
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
104
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
105 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
106 <h3>読み込みながら計算を行う</h3>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
107 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
108 <img src='images/divide_read.png' style="height:250px" align="middle" >
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
109 <br>
16
56cd6800acb5 write slide No.11 & add images
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
110
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
111 <ul>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
112 <li> Read は 連続で動作しファイルを読み込む </li>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
113 <li> Read の待ちは CPU を消費しない </li>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
114 <li> 読み込み終わったブロックに対して、<br>並列 Task を起動する </li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
115 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
116 </article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
117
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
118 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
119 <h3>Blocked Read の実装</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
120 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
121 <img src='images/blockread.png' style="height:250px"align="middle">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
122 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
123
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
124 <ul>
33
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
125 <li>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
126 Task を一度に生成するとメモリを圧迫する。<br>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
127 Block 単位で徐々に起動していく。
33
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
128 </li>
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
129 <li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
130 Blocked Read Task が読み込み終わるまで、<br>Task Blockを待たせる
33
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
131 </li>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
132 <li>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
133 待ち合わせには Cerium の wait for を使用する。
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
134 </li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
135 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
136 </article>
23
a452d8f104bd divede read rename to Block Read
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 21
diff changeset
137
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
138 <!--
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
139 <article class = 'smaller'>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
140 <h3>I/O 専用の therad を追加 (1/2)</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
141 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
142 <img src='images/SPE_ANYblockread.png' style="height:350px"align="middle">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
143 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
144 <li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
145 Task 単位で使用するデバイスをセットすることができる。
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
146 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
147 <li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
148 SPE_ANY でセットすると、Cerium Task Manager 側で自動的に CPU を割り振る。
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
149 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
150 <li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
151 自動的に割り振るので、Blocked Read に 他のTask が割り込むおそれがある。
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
152 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
153 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
154 </article>
76
e13727d01f7a fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 74
diff changeset
155 -->
31
7d0f128836ab finish??
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
156
7d0f128836ab finish??
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 30
diff changeset
157
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
158 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
159 <h3>I/O 専用 thread での Blocked Read の実装</h3>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
160 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
161 <img src='images/IO_0blockread.png' style="height:350px">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
162 <ul>
80
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
163 <li>priority が最優先されるので、Blocked Read Task に割り込みが行われなくなる<br>
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
164 <li>pthread_setschedparam にて実装<br>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
165 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
166 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
167 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
168
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
169 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
170 <h3>I/O 専用の thread を使用しない場合</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
171 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
172 <img src='images/SPE_ANYblockread.png' style="height:350px">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
173 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
174 <li>Blocked Read は連続で行われなければならない。<br>しかし、Task が割り振られてしまう可能性がある。 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
175 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
176 </article>
77
5903492cd498 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 76
diff changeset
177
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
178 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
179 <h3>実験環境</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
180 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
181 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
182 <li> Mac OS X 10.9.1</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
183 <li> 2*2.66 GHz 6-Core Intel Xeon</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
184 <li> Memory 16GB 1333MHz DDR3</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
185 <li> HHD 1TB</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
186 <li> file size : 約 10 GB</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
187 <li> ファイルに対して Boyer-Moore String Seaech で文字列検索をかける </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
188 <li> ファイルの読み込みから結果までを測定</li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
189 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
190 </article>
19
36958c5e0b90 add slide pages 8-17
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
191
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
192 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
193 <h3>実験結果</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
194 <table border="2" cellpadding="0" cellspacing="0">
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
195 <tbody>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
196 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
197 <td>read mode</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
198 <td>CPU num</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
199 <td>ave time(s)</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
200 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
201 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
202 <td>mmap</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
203 <td>2</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
204 <td>106.2</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
205 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
206 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
207 <td bgcolor="#ffffcc">mmap</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
208 <td bgcolor="#ffffcc">12</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
209 <td bgcolor="#ffffcc">154.6</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
210 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
211 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
212 <td>一括Read</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
213 <td>12</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
214 <td>114.9</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
215 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
216 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
217 <td>Blocked Read(SPE_ANY)</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
218 <td>12</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
219 <td>106.0</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
220 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
221 <tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
222 <td bgcolor="#ffffcc">Blocked Read(IO_0)</td>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
223 <td bgcolor="#ffffcc">(I/O) 1 + (Task) 11</td>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
224 <td bgcolor="#ffffcc">99.2</td>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
225 </tr>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
226 </tbody>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
227 </table>
26
54591c145fec add experiment result
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 25
diff changeset
228
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
229 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
230 <li> Blocked Read & IO_0 が mmap より<font color=red>1.55倍</font>実行速度が向上した。<br> </li>
80
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
231 <!-- <li> mmap では 1つ1つの Task がファイルの読み込みを行ってしまうため、読み込み回数が多くなり実行速度が遅くなったと考えられる。 </li>
b38e4f75351b some fix
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 79
diff changeset
232 -->
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
233 <li> mmap で並列の Task で走らせると、ランダムアクセスとなってしまうため速度が遅くなってしまう。</li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
234 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
235 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
236
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
237 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
238 <h3>まとめ</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
239 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
240 <li> I/O と Task を分離し、同時に動くように改良した。 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
241 <li> I/O 専用の Thread の追加 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
242 <li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
243 I/O を含む Task をで並列実装するときに mmap では不向きであり、
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
244 Blocked Read で読み込みを制御したほうが効果的。
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
245 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
246 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
247 <h3 class="yellow">今後の課題</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
248 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
249 <li> Cerium の API として実装 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
250 <li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
251 様々な実装の試み<br>(I/O threads を 2つ、分割 mmap・・・)
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
252 </li>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
253 <li>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
254 grepの実装
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
255 </li>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
256 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
257 </article>
34
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
258
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
259 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
260 <h3>Cerium Task の生成の例(1)</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
261 <p>(例題) multiply : 2つの数を掛け算するプログラム</p>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
262 <h3 class="yellow">main.cc の記述</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
263 <pre>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
264 float* A, B, C;
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
265 // Task の宣言
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
266 HTaskPtr multiply = manager->create_task(MULTIPLY_TASK);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
267 // Task を実行する デバイスの設定
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
268 multiply->set_cpu(SPE_ANY);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
269 // Task に入力データのアドレスを追加
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
270 multiply->set_inData(0, (memaddr)A, sizeof(float)*length);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
271 multiply->set_inData(1, (memaddr)B, sizeof(float)*length);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
272 // Task に出力データのアドレスを追加
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
273 multiply->set_outData(0, (memaddr)C, sizeof(float)*length);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
274 // Task へ値を1つだけ渡す
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
275 multiply->set_param(0,length);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
276 // Task を TaskList に set する
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
277 multiply->spawn();
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
278 </pre>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
279 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
280
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
281 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
282 <h3> Cerium Task の生成(2)</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
283 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
284 <h3 class="yellow">Task の記述</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
285 <pre>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
286 static int
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
287 multiply(SchedTask *s,void *rbuf, void *wbuf)
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
288 {
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
289 float *A,*B,*C
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
290 // 登録した inData を取得
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
291 A = (float*)s->get_input(rbuf,0);
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
292 B = (float*)s->get_input(rbuf,1);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
293 // 登録した outData を取得
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
294 C = (float*)s->get_output(wbuf,0);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
295 // 登録した param を取得
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
296 long length=(long)s->get_param(0);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
297 for (int i=0;i &lt; length;i++) {
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
298 C[i] = A[i] * B[i];
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
299 }
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
300 return 0;
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
301 }
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
302 </pre>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
303 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
304
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
305 <article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
306 <h3>mmap での I/O の実装</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
307 <br>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
308 <h3 class="yellow">mmap の記述</h3>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
309 <pre>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
310 mmap(SchedTask *s, void *in, void *out)
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
311 {
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
312 // FileReadPtr : File情報などを格納している構造体
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
313 FileReadPtr fr = (FileReadPtr)in;
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
314 int map = MAP_PRIVATE;
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
315
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
316 fr->read_text =
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
317 (char*)mmap(NULL,fr->filesize,PROT_READ,map,fr->fd,(off_t)0);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
318 }
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
319 </pre>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
320
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
321 <ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
322 <li> PROT_READ : 読み込み可 </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
323 <li> MAP_PRIVATE : 読み込んだ領域に対して書き込みが起こると複製し、複製した領域に対して書き込みを行う </li>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
324 </ul>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
325 </article>
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
326
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
327 <article class='smaller'>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
328 <h3>Block Read の実装(1/2)</h3>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
329 <br>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
330 <h3 class="yellow">Block Read の実装</h3>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
331 <pre>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
332 HTaskPtr t_read = manager->create_task(READ_TASK);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
333 t_read->set_cpu(read_spe_cpu);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
334 // 読み出すファイルの格納場所を設定
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
335 t_read->set_outData(0,
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
336 w->file_mmap + w->task_spawned * w->division_size,
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
337 w->task_blocks * w->division_size);
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
338 // ファイルディスクリプタの受け渡し
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
339 t_read->set_param(0,w->fd);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
340 // ファイル読み込みの始点
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
341 t_read->set_param(1,w->task_spawned*w->division_size);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
342
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
343 // run_tasks(manager,w, w->task_blocks, t_read, t_next, w->division_size + w->extra_len);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
344 // ここで、ファイルに対して何らかの計算を掛けるような Task を設定する
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
345 run_tasks(manager,w, w->task_blocks,・・・ );
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
346
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
347 // ファイル読み込みの終点
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
348 t_read->set_param(2,w->task_spawned*w->division_size + w->extra_len);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
349
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
350 t_read->spawn();
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
351
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
352 </pre>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
353 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
354
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
355 <article>
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
356 <h3>Block Read の実装(2/2)</h3>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
357 <br>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
358 <h3 class="yellow"> Block Read の記述</h3>
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
359 <pre>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
360 static int
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
361 read_task(SchedTask *s, void *rbuf, void *wbuf)
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
362 {
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
363 long fd = (long)s->get_param(0);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
364 long start_read_position = (long)s->get_param(1);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
365 long end_read_position = (long)s->get_param(2);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
366 char *read_text = (char*)s->get_output(wbuf,0);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
367 long read_size = end_read_position - start_read_position;
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
368
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
369 pread(fd, read_text, read_size , start_read_position);
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
370 return 0;
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
371 }
79
74e64dea2b49 fix slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 78
diff changeset
372 </pre>
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
373 </article>
28
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 27
diff changeset
374
19
36958c5e0b90 add slide pages 8-17
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
375
78
0bf2c2ae2bf6 fix indent
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
376 </body>
13
ff5c2b4ca18a add slide
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 </html>