Mercurial > hg > Papers > 2012 > yutaka-master
view paper/chapter3.tex @ 4:6cf0f731cbde draft
fix
author | Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 08 Feb 2012 21:49:40 +0900 |
parents | 5dbcea03717e |
children | 20d87c5e225a |
line wrap: on
line source
\chapter{TaskManagerを使った例題} 本章では、TaskManager を使った例題を紹介する \section{WordCount} 例題としTaskManagerを使ったWordCountを実装した。Taskの構成は以下のである。 \begin{enumerate} \item WordCountTask \item PrintTask \end{enumerate} WordCountTaskは、input された data を word count し、単語数と行数を output に指定された data 領域に書きこむTaskである。 分割されたデータが送られてくるため、分割された前後のテキストがどうなっているかはわからない。そのため担当範囲であるデータの先頭と末尾のパラメータを単語数と行数の他に付け加える。後にそのデータを他のword count 結果と照らし合わせ、分割されたテキストを正しく整合する。 PrintTask は WordCountTask によって書き出された単語数と行数を集計し、出力するTaskである。WordCountTask を wait する設定で、すべてのWordCountTaskが終了したあとに、動作する。 word count 対象として入力されたファイルは、mmapを用いてメモリに展開する。その後データを16kbyteの大きさに分割しながら、WordCountTaskに割り当てていく。(\figref{wc-graf}) \begin{figure}[htb] \begin{center} \includegraphics[scale=0.70]{./images/wc_graf1.pdf} \end{center} \caption{wordcount flow} \label{fig:wc-graf} \end{figure} サイズを 100MB, 200MB としたテキストファイルを対象に、速度の測定を行った。Linux wc は PS3上の Linux のが提供するwcコマンドを用いた結果で PPE 1基を利用したものである。Cerium wc は SPE 6基 を用い今回実装した word count の計測結果である。(\tabref{wc_speed}) \begin{table}[!htb] \begin{center} \caption{speed of WordCount} \label{tab:wc_speed} \hbox to\hsize{\hfil \begin{tabular}{|c|c|c|c|} \hline wc & file size(MB) & time(sec) \\ \hline Linux & 100 & 30.9 \\ \hline Linux & 200 & 62.8 \\ \hline Cerium & 100 & 2.2 \\ \hline Cerium & 200 & 12.8 \\ \hline \end{tabular}\hfil} \end{center} \end{table} 100MBのテキストを扱う場合には、Linux と比べ15倍ほどの差が見られた。200MB の場合は約5倍ほどであるのは、PPE のメモリ容量が256MBとなっており、200MBのファイルを扱う場合には、頻繁にスワップなどが起きているため、ファイルのIOの部分でのオーバヘッドが高いと考えられる。通常のwcコマンドよりも Cerium を用いた wc が高い性能を示した。 \section{Sort} \section{Prime}