annotate slide/index.html @ 86:ae8b239b527c default tip

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