<CHAPTER ID="imaging">
<!--
<TITLE>Imaging with  openMosix</TITLE>
-->
<TITLE>openMosix を利用した画像処理</TITLE>
<!--
<SECT1><TITLE>Introduction</TITLE>
-->
<SECT1><TITLE>はじめに</TITLE>
<!--
<PARA><emphasis>This Section is a Work in Progress</emphasis>
-->
<PARA><emphasis>このセクションは作成中です</emphasis>
</para>
<para>

<!--
Computer Graphics have always been applications that required a lot of CPU power, this hasn't changed.  
Within this chapter I wil demonstrate with some practical examples how Computer Graphics can benefit from
openMosix.
-->
コンピュータグラフィックは、たくさんの CPU パワーを必要とし続けていました。
今でもその通りです。
この章では openMosix がコンピュータグラフィックにどれだけ効果があるのか、
実例をあげて示したいと思います。

</PARA>
</SECT1>
<SECT1><TITLE>Povray</TITLE>
<PARA>
<!--
The Persistence of Vision Raytracer is a high-quality, totally free tool for creating stunning 
three-dimensional graphics. 
-->
Persistence of Vision Raytracer(Povray)は、高品質で完全にフリーな素晴らしい 3D 
グラフィックツールです。
</para>
<para>
<!--
Ray-tracing is a rendering technique that calculates an image of a scene by simulating the way rays of 
light travel in the real world. However it does its job backwards. In the real world, rays of light are 
emitted from a light source and illuminate objects. The light reflects off of the objects or passes 
through transparent objects. This reflected light hits our eyes or perhaps a camera lens. Because the vast 
majority of rays never hit an observer, it would take forever to trace a scene. 
-->
レイトレーシングはレンダリング技術の一つで、現実の世界で光線がやってくる
過程をシミュレートし、その場面の画像を計算します。しかしこの処理は現実とは逆
方向に行うことになります。現実世界では光線は光源から放たれ、対象を照らします。
光は対象で反射するか、光を通す対象に対しては透過していきます。この反射した光
を眼やカメラのレンズが捕らえます。光線の大部分は観察者には届きませんので、
観察者は場面をトレースするのに時間がかかります。
</para>
<para>
<!--
These kind of applications can be easily made parrallel by using pvmpovray.
Pvmpovray expects to working on a Beowulf style cluster and spread it's load to other nodes using pvm.  
The openMosix way of doing this is the same, however we just do this on  1 machine and have 
openMosix do the load spreading work fo you ! 
-->
この種のアプリケーションは pvmpovray を使えば簡単に並列処理ができます。
pvmpovray は Beowulf タイプのクラスタ上で動作することを前提にしており、pvm 
を使って負荷を他のノードに割り振ります。
openMosix は同じ方法でこれを行いますが、たった 1 台のマシンで実行し、
openMosix が負荷分散を行ってくれます。
</PARA>
<PARA>
<!--
<ulink url="http://pvmpov.sourceforge.net/PVMPOV-HOWTO.html"><CITETITLE>
A GREAT Howto on PVM Povray </CITETItLE></ulink> will show you how to setup 
PVMPovray.
-->
<ulink url="http://pvmpov.sourceforge.net/PVMPOV-HOWTO.html"><CITETITLE>
A GREAT Howto on PVM Povray </CITETItLE></ulink> を読めば pvmpovray の設定
方法がわかります。

<!--
Below is a small summary.
-->
下記がちょっとした要約です。
</PARA>
<para>
      
<programlisting>
$ cd pvmpov3_1g_2
$ tar xfz ../povuni_s.tgz
$ tar xfz ../povuni_d.tgz                                                      
$ ./inst-pvm
Trying to apply the patch.
Searching for rejected files
$
</programlisting>

<!--
Now compile with aimk ( which is a wrapper script provided by the pvm rpm , buth which probably 
won't be in your path.(some of the readers might remember aimk from other platforms / applications ) 
-->
aimk でコンパイルしてください(このスクリプトは pvm の rpm が用意している
ラッパー)。どちらにも恐らくパスは通っていないでしょう(aimk が他のプラット
フォームのアプリケーションであることを覚えている方もいるかもしれません)。
</para>
<para>
<!--
If you are on a RH 8.0 box id moved libpng and zlib to .notused .. 
This in order to prevent version issues .. with other libpng and zlib versions.
-->
RH 8.0 を使っているなら、libpng と zlib は .notused のような場所に移動した方
が良いでしょう。
libpng と zlib のバージョンが異なることで生じるバージョン問題を避けるためです。
<programlisting>
export PATH=$PATH:/usr/share/pvm3/lib
export PVMROOt=/usr/share/pvm3
</programlisting>

<!--
I then run aimk newunix. Then we start pvm and quit it. The daemon stays active..
-->
ここで aimk newunix を実行します。そして pvm を起動して、そのままにします。
これでデーモンがアクティブになったままになります。
</para>
<para>
<!--
And a last thing that is not known by a novice pvm user is that pvm does use its own paths, and you have
to put pvmpov either in that path or launch it with the complete pathname.
-->
最後に pvm の初心者ユーザが知らないことを。pvm は独自のパスを使うので、pvmpov 
をパスに含めるか絶対パスを使って起動してください。
</para>
<para>
<programlisting>
[root@dhcp71 povray31]# /usr/local/bin/pvmpov -L 
/usr/src/povray/pvmpov3_1g_2/povray31/include/ +Iskyvase.pov  
+Oskyvase.tga +NT16 +NW64 +NH64 +v +w1024 +h768
Persistence of Vision(tm) Ray Tracer Version 3.1g.Linux.gcc
  This is an unofficial version compiled by:
  Jakob Flierl  - PVMPOV Version 3.1g.2
  The POV-Ray Team(tm) is not responsible for supporting this version.
Copyright 1999 POV-Ray Team(tm)
Never found section  in file 
/usr/src/povray/pvmpov3_1g_2/povray31/include/.
Initializing PVMPOV
  Spawning /usr/local/bin/pvmpov with 16 PVM tasks on 1 hosts...
  ...16 PVM tasks successfully spawned.
  Waiting up to 120s for first slave to start...
  Slave 0 successfully started.
Parsing Options
  Input file: skyvase.pov (compatible to version 3.1)
  Remove bounds........On  Split unions........Off
  Library paths: /usr/local/lib/povray31 /usr/local/lib/povray31/include
Output Options
  Image resolution 1024 by 768 (rows 1 to 768, columns 1 to 1024).
  Output file: skyvase.tga, 24 bpp PNG
  Graphic display.....Off
  Mosaic preview......Off
  CPU usage histogram.Off
  Continued trace.....Off  Allow interruption...On  Pause when 
done.....Off
  Verbose messages.....On
Tracing Options
  Quality:  9
  Bounding boxes.......On  Bounding threshold: 25
  Light Buffer.........On  Vista Buffer.........On
  Antialiasing........Off
  Radiosity...........Off
Animation Options
  Clock value....   0.000  (Animation off)
PVM Options
  Block Width....      64  Block Height...      64
  PVM Tasks......      16
  PVM Nice.......       5
  PVM Arch.......
  PVM Slave...... /usr/local/bin/pvmpov
  PVM WorkingDir. /usr/src/povray/pvmpov3_1g_2/povray31
Redirecting Options
  All Streams to console..........On
  Debug Stream to console.........On
  Fatal Stream to console.........On
  Render Stream to console........On
  Statistics Stream to console....On
  Warning Stream to console.......On

Starting frame 0...
 Slave 1 at dhcp71.office.be.stone-it.com successfully started.
 Slave 2 at dhcp71.office.be.stone-it.com successfully started.
 Slave 3 at dhcp71.office.be.stone-it.com successfully started.
 Slave 4 at dhcp71.office.be.stone-it.com successfully started.
 Slave 5 at dhcp71.office.be.stone-it.com successfully started.
 Slave 6 at dhcp71.office.be.stone-it.com successfully started.
 Slave 7 at dhcp71.office.be.stone-it.com successfully started.
 Slave 8 at dhcp71.office.be.stone-it.com successfully started.
 Slave 9 at dhcp71.office.be.stone-it.com successfully started.
 Slave 10 at dhcp71.office.be.stone-it.com successfully started.
 Slave 11 at dhcp71.office.be.stone-it.com successfully started.
 Slave 12 at dhcp71.office.be.stone-it.com successfully started.
 Slave 13 at dhcp71.office.be.stone-it.com successfully started.
 Slave 14 at dhcp71.office.be.stone-it.com successfully started.
 Slave 15 at dhcp71.office.be.stone-it.com successfully started.
  0:00:53 86.46 of blocks complete.Not using dhcp71.office.be.stone-it.com 
for reassignment (77%)
  0:00:53 86.98 of blocks complete.Not using dhcp71.office.be.stone-it.com 
for reassignment (67%)
Not using dhcp71.office.be.stone-it.com for reassignment (86%)
Not using dhcp71.office.be.stone-it.com for reassignment (85%)
  0:00:55 89.06 of blocks complete.   640 of  768 lines finished (in frame 
0).Not using dhcp71.office.be.stone-it.com for reassignment (65%)
  0:00:56 91.67 of blocks complete.Not using dhcp71.office.be.stone-it.com 
for reassignment (72%)
  0:00:56 92.71 of blocks complete.Not using dhcp71.office.be.stone-it.com 
for reassignment (80%)
  0:00:57 93.75 of blocks complete.
Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:57 94.79 of blocks complete.
Slave at dhcp71.office.be.stone-it.com has exited.

Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:58 95.83 of blocks complete.
Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:58 96.35 of blocks complete.   672 of  768 lines finished (in frame 
0).Not using dhcp71.office.be.stone-it.com for reassignment (77%)

Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:58 97.14 of blocks complete.   688 of  768 lines finished (in frame 
0).
Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:59 97.92 of blocks complete.
Slave at dhcp71.office.be.stone-it.com has exited.
  0:00:60 98.44 of blocks complete.   704 of  768 lines finished (in frame 
0).
Slave at dhcp71.office.be.stone-it.com has exited.
  0:01:03 100.00 of blocks complete.   768 of  768 lines finished (in 
frame 0).
Finishing frame 0...rtw. 768


Waiting for remaining slave stats.


PVM Task Distribution Statistics:
           host name  [ done ] [ late ]           host name  [ done ] [ 
late ]
dhcp71.office.be.stone-it.com  [ 5.21%] [ 
0.00%]dhcp71.office.be.stone-it.com  [ 7.81%] [ 0.07%]
dhcp71.office.be.stone-it.com  [ 8.85%] [ 
1.17%]dhcp71.office.be.stone-it.com  [ 4.69%] [ 0.00%]
dhcp71.office.be.stone-it.com  [ 8.85%] [ 
0.98%]dhcp71.office.be.stone-it.com  [ 4.17%] [ 0.00%]
dhcp71.office.be.stone-it.com  [ 5.21%] [ 
0.00%]dhcp71.office.be.stone-it.com  [ 8.33%] [ 0.52%]
dhcp71.office.be.stone-it.com  [ 5.21%] [ 
0.00%]dhcp71.office.be.stone-it.com  [ 5.73%] [ 0.72%]
dhcp71.office.be.stone-it.com  [ 7.29%] [ 
2.73%]dhcp71.office.be.stone-it.com  [ 4.17%] [ 0.00%]
dhcp71.office.be.stone-it.com  [ 5.21%] [ 
0.00%]dhcp71.office.be.stone-it.com  [ 6.77%] [ 0.13%]
dhcp71.office.be.stone-it.com  [ 4.69%] [ 
0.00%]dhcp71.office.be.stone-it.com  [ 7.81%] [ 0.00%]


POV-Ray statistics for finished frames:
skyvase.pov Statistics (Partial Image Rendered), Resolution 1024 x 768
----------------------------------------------------------------------------
Pixels:          303104   Samples:          303104   Smpls/Pxl: 1.00
Rays:           1192710   Saved:                 0   Max Level: 0/5
----------------------------------------------------------------------------
Ray->Shape Intersection          Tests       Succeeded  Percentage
----------------------------------------------------------------------------
Cone/Cylinder                  1842227          900504     48.88
CSG Intersection               2742731          323346     11.79
CSG Union                      1801008          521692     28.97
Plane                         20223278        11233348     55.55
Quadric                        1801008         1196533     66.44
Sphere                         1801008          461786     25.64
Bounding Object                1842227          900504     48.88
----------------------------------------------------------------------------
Calls to Noise:            1201944   Calls to DNoise:        2108954
----------------------------------------------------------------------------
Shadow Ray Tests:          2856188   Succeeded:                85620
Reflected Rays:             889606
----------------------------------------------------------------------------
Smallest Alloc:                  9 bytes   Largest:            20508
Peak memory used:          5643343 bytes
----------------------------------------------------------------------------
Time For Trace:    0 hours  1 minutes   7.0 seconds (67 seconds)
    Total Time:    0 hours  1 minutes   7.0 seconds (67 seconds)
</programlisting>


<!--
As you can see the application was splitted into differen parts and run 
separatly, openMosix then did the job of balancing the load to other 
machines.
-->
見ての通りアプリケーションが複数に分割され、個々に動くことがわかります。
openMosix は他のマシンに対して、負荷の均衡を取る処理を行っています。
</para>
<!--
<para> I had good results with 2 to 3 times the 
the number of cpu's I had available
-->
<para>利用できる CPU 数の 2、3 倍の効果という素晴らしい結果になりました。
</para>
</sect1>
</chapter>
