16.2. Povray

The Persistence of Vision Raytracer – это высококачественный, абсолютно свободный инструмент для создания ошеломляющей трёхмерной графики.

Трассировка лучей – это техника визуализации, которая вычисляет картинку сцены посредством симуляции того, как луч света движется в реальном мире. Тем не менее, она делает работу наоборот. В реальном мире лучи света испускаются из источников света и иллюминирующих объектов. Этот отражённый свет попадает в наши глаза или, возможно, в объектив камеры. Поскольку подавляющее большинство лучей никогда не попадают к обозревателю, это бы заняло вечность протрассировать сцену.

Этот тип приложений может легко быть распараллелен используя pvmpovray. Ожидается, что pvmpovray работает на кластере в стиле Beowulf и распределяет его нагрузку по другим узлам кластера используя PVM. Способ openMosix выполнения этого точно такой же, хотя мы просто делаем всё на одной машине, и у нас есть openMosix, который производит распределение нагрузки за вас!

Великолепный HOWTO по PVM Povray покажет вам, как установить PVMPovray. Ниже – краткое изложение.

$ 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 $

Теперь скомпилируйте с помощью aimk, который является скриптом-обёрткой, предоставляемый PVM .rpm, но который, вероятно, не окажется в вашем PATH (некоторые читатели могут вспомнить aimk из других платформ/приложений).

Если вы под RedHat 8.0, я бы поместил libpng и zlib в .notused… Это нужно, чтобы предотвратить проблемы версий с другими версиями libpng и zlib.

export PATH=$PATH:/usr/share/pvm3/lib export PVMROOT=/usr/share/pvm3

После этого я выполнил aimk newunix. Затем мы запускаем pvm и выходим из него. Демон остаётся активным…

И последняя вещь, которая не известна начинающему пользователю PVM, это то, что PVM использует свои пути, и вы должны либо поместить pvmpov в свои пути, либо запускать её, задавая полный путь.

[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)

Как вы можете видеть, приложение было разбито на различные части и выполнялось раздельно, после этого openMosix выполнил работу по балансировке нагрузки по отношению к другим машинами.

У меня получились хорошие результаты при значении в два-три раза большим числа CPU, которые у меня были доступны.