# HG changeset patch # User mir3636 # Date 1492613409 -32400 # Node ID fd019b8f27818c592dc12bb135e0f80455cd63fe # Parent f126e8e89573c6b274a163fcac6ea46126f8315e update diff -r f126e8e89573 -r fd019b8f2781 paper/.DS_Store Binary file paper/.DS_Store has changed diff -r f126e8e89573 -r fd019b8f2781 paper/pic/.DS_Store Binary file paper/pic/.DS_Store has changed diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.aux --- a/paper/sigos.aux Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.aux Wed Apr 19 23:50:09 2017 +0900 @@ -1,12 +1,22 @@ \relax +\newlabel{fig:cs}{{1}{1}} +\newlabel{fig:gearsos}{{2}{2}} +\newlabel{src:interface}{{1}{2}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}interface}{2}} +\newlabel{gearef1}{{2}{2}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}Gearef1}{2}} +\newlabel{gearef2}{{3}{2}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Gearef2}{2}} +\newlabel{src:stack_c}{{4}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}stub}{3}} +\newlabel{src:context}{{5}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}context}{3}} \citation{*} \bibstyle{ipsjunsrt} \bibdata{sigos} -\bibcite{cerium}{1} -\bibcite{alice}{2} -\bibcite{segment}{3} -\bibcite{opencl}{4} -\bibcite{cuda}{5} -\bibcite{gears}{6} -\bibcite{cbc-lola}{7} -\gdef\ipsj@lastpage{3} +\bibcite{segment}{1} +\bibcite{gears}{2} +\bibcite{cbc-lola}{3} +\newlabel{src:init_context}{{6}{4}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}initcontext}{4}} +\gdef\ipsj@lastpage{4} diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.bbl --- a/paper/sigos.bbl Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.bbl Wed Apr 19 23:50:09 2017 +0900 @@ -1,25 +1,9 @@ \begin{thebibliography}{1} -\bibitem{cerium} -宮國 渡,河野真治,神里 晃,杉山千秋\:Cell 用の Fine-grain Task Manager - の実装,情報処理学会 - システムソフトウェアとオペレーティング・システム研究会(OS) (2008). - -\bibitem{alice} -照屋のぞみ,河野真治\:分散フレームワークAliceのPC画面配信システムへの応用,第57回プログラミング・シンポジウム - (2016). - \bibitem{segment} 河野真治,杉本 優\:Code Segment と Data Segment によるプログラミング手法,第54回プログラミング・シンポジウム (2013). -\bibitem{opencl} -{Aaftab Munshi, Khronos OpenCL Working Group}: {\em {The OpenCL Specification - Version 1.0}} (2007). - -\bibitem{cuda} -: {CUDA}, {https://developer.nvidia.com/category/zone/cuda-zone/}. - \bibitem{gears} 小久保翔平,伊波立樹,河野真治\:Monad に基づくメタ計算を基本とする Gears OS の設計,情報処理学会システムソフトウェアとオペレーティング・システム研究会(OS) diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.bib --- a/paper/sigos.bib Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.bib Wed Apr 19 23:50:09 2017 +0900 @@ -1,21 +1,3 @@ -@article{ - cerium, - author = "宮國 渡 and 河野 真治 and 神里 晃 and 杉山 千秋", - title = "Cell 用の Fine-grain Task Manager の実装", - journal = "情報処理学会 システムソフトウェアとオペレーティング・システム研究会(OS)", - month = "April", - year = 2008 -} - -@article{ - alice, - author = "照屋 のぞみ and 河野 真治", - title = "分散フレームワークAliceのPC画面配信システムへの応用", - journal = "第57回プログラミング・シンポジウム", - month = "Jan", - year = 2016 -} - @article{ segment, author = "河野 真治 and 杉本 優", @@ -25,18 +7,6 @@ year = 2013 } - -@manual{opencl, -author = "{Aaftab Munshi, Khronos OpenCL Working Group}", -title ="{The OpenCL Specification Version 1.0}", -year = 2007 -} - -@misc{cuda, - title = "{CUDA}", - howpublished = "{https://developer.nvidia.com/category/zone/cuda-zone/}" -} - @article{ gears, author = "小久保 翔平 and 伊波 立樹 and 河野 真治", diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.blg --- a/paper/sigos.blg Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.blg Wed Apr 19 23:50:09 2017 +0900 @@ -3,57 +3,52 @@ The top-level auxiliary file: sigos.aux The style file: ipsjunsrt.bst Database file #1: sigos.bib -Warning--there's no number and/or volumecerium -Warning--Missing required argument pages in cerium -Warning--there's no number and/or volumealice -Warning--Missing required argument pages in alice Warning--there's no number and/or volumesegment Warning--Missing required argument pages in segment -Warning--Missing required argument author in cuda Warning--there's no number and/or volumegears Warning--Missing required argument pages in gears Warning--there's no number and/or volumecbc-lola Warning--Missing required argument pages in cbc-lola -You've used 7 entries, +You've used 3 entries, 2207 wiz_defined-function locations, - 563 strings with 4942 characters, -and the built_in function-call counts, 1207 in all, are: -= -- 63 -> -- 60 + 546 strings with 4497 characters, +and the built_in function-call counts, 580 in all, are: += -- 30 +> -- 29 < -- 0 -+ -- 21 -- -- 14 -* -- 91 -:= -- 183 -add.period$ -- 7 -call.type$ -- 7 ++ -- 10 +- -- 7 +* -- 48 +:= -- 94 +add.period$ -- 3 +call.type$ -- 3 change.case$ -- 0 chr.to.int$ -- 0 -cite$ -- 18 -duplicate$ -- 85 -empty$ -- 122 -format.name$ -- 20 -if$ -- 272 +cite$ -- 9 +duplicate$ -- 39 +empty$ -- 55 +format.name$ -- 10 +if$ -- 127 int.to.chr$ -- 0 -int.to.str$ -- 7 -missing$ -- 5 -newline$ -- 24 -num.names$ -- 6 -pop$ -- 25 +int.to.str$ -- 3 +missing$ -- 3 +newline$ -- 12 +num.names$ -- 3 +pop$ -- 9 preamble$ -- 1 purify$ -- 0 quote$ -- 0 -skip$ -- 48 +skip$ -- 23 stack$ -- 0 substring$ -- 0 -swap$ -- 2 -text.length$ -- 11 +swap$ -- 1 +text.length$ -- 5 text.prefix$ -- 0 top$ -- 0 type$ -- 0 -warning$ -- 11 -while$ -- 6 -width$ -- 8 -write$ -- 49 -is.kanji.str$ -- 41 -(There were 11 warnings) +warning$ -- 6 +while$ -- 3 +width$ -- 4 +write$ -- 23 +is.kanji.str$ -- 20 +(There were 6 warnings) diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.dvi Binary file paper/sigos.dvi has changed diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.log --- a/paper/sigos.log Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.log Wed Apr 19 23:50:09 2017 +0900 @@ -1,4 +1,4 @@ -This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4) 18 APR 2017 18:06 +This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4) 19 APR 2017 22:11 entering extended mode restricted \write18 enabled. %&-line parsing enabled. @@ -186,24 +186,70 @@ (Font) Font shape `JY1/gt/m/n' tried instead on input line 87. LaTeX Font Info: External font `cmex10' loaded for size (Font) <7> on input line 87. +File: ./pic/codesegment.pdf Graphic file (type pdf) + <./pic/codesegment.pdf> +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <7> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 110. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <7> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 110. [1 -] [2] (./sigos.bbl -Overfull \hbox (58.50209pt too wide) in paragraph at lines 21--22 -[]\OT1/cmr/m/n/9 : CUDA, https://developer.nvidia.com/category/zone/cuda- +] +File: ./pic/gears_structure.pdf Graphic file (type pdf) + +<./pic/gears_structure.pdf> +LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <7> not available +(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 175. + +Overfull \hbox (71.64214pt too wide) in paragraph at lines 175--175 +[]\OT1/cmr/m/n/9 interface + [] + + +Overfull \hbox (68.36577pt too wide) in paragraph at lines 186--186 +[]\OT1/cmr/m/n/9 Gearef1 + [] + +[2] +Overfull \hbox (68.36577pt too wide) in paragraph at lines 187--187 +[]\OT1/cmr/m/n/9 Gearef2 [] -) [3 +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <9> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 208. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <9> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 208. + +LaTeX Warning: Reference `stack_c' on page 3 undefined on input line 208. + + +Overfull \hbox (54.70755pt too wide) in paragraph at lines 210--210 +[]\OT1/cmr/m/n/9 stub + [] -] (./sigos.aux) ) +[3] +Overfull \hbox (66.99287pt too wide) in paragraph at lines 216--216 +[]\OT1/cmr/m/n/9 context + [] + + +Overfull \hbox (80.86778pt too wide) in paragraph at lines 232--232 +[]\OT1/cmr/m/n/9 initcontext + [] + +(./sigos.bbl) [4] (./sigos.aux) + +LaTeX Warning: There were undefined references. + + ) Here is how much of TeX's memory you used: - 2870 strings out of 493683 - 39672 string characters out of 6149654 - 138711 words of memory out of 5000000 - 6447 multiletter control sequences out of 15000+600000 - 16567 words of font info for 64 fonts, out of 8000000 for 9000 + 3171 strings out of 493683 + 43607 string characters out of 6149654 + 311711 words of memory out of 5000000 + 6729 multiletter control sequences out of 15000+600000 + 17521 words of font info for 68 fonts, out of 8000000 for 9000 929 hyphenation exceptions out of 8191 - 30i,10n,49p,213b,230s stack positions out of 5000i,500n,10000p,200000b,80000s + 30i,10n,49p,213b,1569s stack positions out of 5000i,500n,10000p,200000b,80000s -Output written on sigos.dvi (3 pages, 19104 bytes). +Output written on sigos.dvi (4 pages, 40964 bytes). diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.pdf Binary file paper/sigos.pdf has changed diff -r f126e8e89573 -r fd019b8f2781 paper/sigos.tex --- a/paper/sigos.tex Tue Apr 18 18:06:39 2017 +0900 +++ b/paper/sigos.tex Wed Apr 19 23:50:09 2017 +0900 @@ -101,15 +101,15 @@ Code Gear から次の Code Gear への遷移は goto による継続で処理を行い、次の Code Gear へ引数として出力を与える。 図は Code Gear 間の処理の流れを表している。 -%図\ref{fig:cs}は Code Gear 間の処理の流れを表している。 -% -%\begin{figure}[ht] -% \begin{center} -% \scalebox{0.7}{\includegraphics{fig/codesegment.pdf}} -% \end{center} -% \caption{goto による code gear 間の継続} -% \label{fig:cs} -%\end{figure} +図\ref{fig:cs}は Code Gear 間の処理の流れを表している。 + +\begin{figure}[ht] + \begin{center} + \includegraphics[width=70mm]{./pic/codesegment.pdf} + \end{center} + \caption{goto による code gear 間の継続} + \label{fig:cs} +\end{figure} goto の後に Code Gear 名と引数を並べて、次の Code Gear への遷移を記述する。 この goto の行き先を継続と呼ぶ。 @@ -133,14 +133,38 @@ CbC は Code Gear を処理の単位として用いたプログラミング言語であるため、Gears OS の Code Gear を記述するのに適している。 -%図\ref{fig:gearsos} に Gears OS の構成図を示す。 +\section{Gears OS の構成} +Gears OS は以下の要素で構成される。 + +\begin{itemize} + \item Context + \item TaskQueue + \item TaskManager + \item Worker +\end{itemize} + +図\ref{fig:gearsos} に Gears OS の構成図を示す。 + +\begin{figure}[ht] + \begin{center} + \includegraphics[width=70mm]{./pic/gears_structure} + \end{center} + \caption{Gears OS の構成図} + \label{fig:gearsos} +\end{figure} Gears OS には Context と呼ばれる接続可能な Code Gear、Data Gear のリスト、Temporal Data Gear のためのメモリ空間等を持っている Meta Data Gear がある。 Gears OSは必要なCode Gear、Data Gearに参照したい場合、このContext を通す必要がある。 Temporal Data Gear のためのメモリ空間は Context 毎に異なり、互いに干渉することはできない。 -Context は Task でもあり、TaskManager によって Context が生成され CPUWorker へ送られる。 -Worker に渡された Task である Context の Input/Output Data Gear の依存関係が解決されたものから並列実行される。 +Context は Task でもあり、TaskManager によって Context が生成され Task Queue へ挿入する。 +Gears OS における Task Queue は Synchronized Queue で実現される。 +Worker は TaskQueue から Task である Context を取得し、 Input/Output Data Gear の依存関係が解決されたものから並列実行される。 + +\section{CbC による Gears OS 記述の問題} + +Gears OS を CbC で実装する上でメタ計算の記述が煩雑であることがわかった。 +これらのメタ計算を自動生成することにより Gears OS を記述する上においてより良い構文をユーザーに提供することにした。 \section{interface の記述} interface は呼び出しの引数になる Data Gear の集合であり、そこで呼び出される Code Gear のエントリである。 @@ -149,20 +173,25 @@ %create は関数呼び出しで呼び出され、interface と impliment の初期化と Code Gear のポインタの設定を行う。 %return で interface を返し、その先で Code Gear や Data Gear へ継続できるようになる。 +\lstinputlisting[label=src:interface, caption=interface]{./src/Stack.cbc} + \section{Gearef、GearImpl} Context には Allocation 等で生成した Data Gear へのポインタが格納されている。 -Code Gear が Context にアクセスする際、ポインタを使用してデータを取り出すため、コードが煩雑になってしまう。 +Code Gear が Context にアクセスする際、ポインタを使用してデータを取り出すため、リスト\ref{gearef1} のようにコードが煩雑になってしまう。 そこで Code Gear がデータを参照するための Gearef というマクロを定義した。 Gearef に Context と型を渡すことでデータの参照が行える。 また impliment のデータを参照する際も、ポインタでの記述が複雑になってしまうため 同様に GearImpl を定義した。 GearImpl は Context と interface 名、interface の変数名を指定して参照する。 +Gearef と GearImpl を用いたコードがリスト\ref{gearef2}である。 + +\lstinputlisting[label=gearef1, caption=Gearef1]{./src/ex_code1} +\lstinputlisting[label=gearef2, caption=Gearef2]{./src/ex_code2} \section{stub Code Gear} Code Gear が必要とする Data Gear を取り出す際に Context を通す必要があるが、 Context を直接扱うのはセキュリティ上好ましくない。 そこで Context から必要なデータを取り出して Code Gear に接続する stub Code Gear を定義し、これを介して間接的に必要な Data Gear にアクセスする。 stub Code Gear は Code Gear 毎に生成され、次の Code Gear へと継続する間に挟まれる。 - \section{Context、stub Code Segment の自動生成} Gears OS では 通常の計算の他に Context や stub などのメタ計算を記述する必要があが、Gears OS を現在の CbC の機能のみを用いて記述するとこのメタ計算の記述を行わなくてはならず、これには多くの労力を要する。 @@ -177,12 +206,16 @@ generate\_stub は引数と interface を照らし合わせ、Gearef または GearImpl を決定する。 この時既に stub Code Gear が記述されている Code Gear は無視される。 -cbc ファイル から、生成した stub Code Gear を加えて stub を加えたコードに変換を行う。 +cbc ファイルから、生成した stub Code Gear を加えて stub を加えたコードに変換を行う。(\ref{stack_c}) + +\lstinputlisting[label=src:stack_c, caption=stub]{./src/ex_stub} \section{Context の生成} Context は Meta Data Gear に相当し、Code Gear や Data Gear を管理している。 Data Gear を取得するために generate context は context の定義を読み宣言されている Data Gear を取得する。 +\lstinputlisting[label=src:context, caption=context]{./src/context1.c} + Code Gear の取得は指定された stub を加えたコードから \_\_code 型を見て行う。 取得した Code/Data Gear の enum の定義は enumCode.h、enumData.h に生成される。 @@ -197,6 +230,8 @@ Context には Data Gear の Data Type の情報が格納されている。 この情報から確保される Data Gear のサイズなどを決定する。 +\lstinputlisting[label=src:init_context, caption=initcontext]{./src/context2.c} + \section{今後の課題} 本研究では LLVM/Clang のデバッグ、interface の記述、CbC ファイルから Gears OS の記述に必要な Context と stub の生成を行う perl スクリプトの生成を行なった。 これにより Gears OS のコードの煩雑さは改善され、ユーザーは Context への接続を意識する必要がなくなった。 @@ -206,9 +241,6 @@ 今後の課題は Code Gear からメタ計算を行う meta Code Gear を生成できるようにし、ユーザーがメタレベルの処理を意識せずにコードを記述できるようにする。 また、今回 perl スクリプトによって Context や stub の生成を行なったが、LLVM/clang 上で実装しコンパイラで直接 CbC を実行できるようにすることを目的とする。 - - - %\begin{figure}[ht] % \begin{center} % \includegraphics[width=70mm]{./pic/cbc_goto.pdf} @@ -219,7 +251,6 @@ %\lstinputlisting[label=src:initContext, caption=initContext]{./src/context.c} - \nocite{*} \bibliographystyle{ipsjunsrt} \bibliography{sigos}