annotate slide/index.html @ 74:ec6ddf37a60b

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