Povray Rendering Cluster System 구축하기

### Povray Rendering System 구축하기###

작성일 : 2005-07-13
                                 수정일 : 2009-12-31
작성자 : 서진우 ( alang@syszone.co.kr )


povray 는 multiplatform, freeware raytracer 벤치마킹 툴이다.
PVMPOV 벤치 마크는 Ray Tracing 작업으로 성능을 측정하고 PVM으로 프로세스
메세지 패싱을 하기 위해 사용됩니다.

이 테스트를 하기 위해서는 LINUX Cluster 기본 환경이 구축 되어져 있어야 한다.
먼저 Cluster 노드간의 rsh, rlogin 설정을 하고 난뒤 PVM 설정을 한다.

PVM 은 기본적으로 Redhat 에서 제공하는 RPM 패키징을 그대로 사용하면 된다.

설치를 하고 나면..

/usr/share/pvm3 에 설치가 된다.
위 경로가 PVM_ROOT 로서 정의가 되어져야 한다.

# cd /usr/share/pvm3/lib  
# vi bashrc.stub
——————————————————————————–

#
# append this file to your .bashrc to set path according to machine
# type.  you may wish to use this for your own programs (edit the last
# part to point to a different directory f.e. ~/bin/_$PVM_ARCH.
#
# PVM_ROOT를 정의 한다.
PVM_ROOT=/usr/share/pvm3
export PVM_ROOT
##

if [ -z $PVM_ROOT ]; then
    if [ -d ~/pvm3 ]; then
        export PVM_ROOT=~/pvm3
    else
        echo “Warning – PVM_ROOT not defined”
        echo “To use PVM, define PVM_ROOT and rerun your .bashrc”
    fi
fi

if [ -n $PVM_ROOT ]; then
    export PVM_ARCH=`$PVM_ROOT/lib/pvmgetarch`
#
# uncomment one of the following lines if you want the PVM commands
# directory to be added to your shell path.
#
# 아래 PATH 에 lib, pvm_arch 경로를 추가 하는 설정의 주석을 제거한다.

       export PATH=$PATH:$PVM_ROOT/lib            # generic
       export PATH=$PATH:$PVM_ROOT/lib/$PVM_ARCH  # arch-specific
#
# uncomment the following line if you want the PVM executable directory
# to be added to your shell path.
#
#       export PATH=$PATH:$PVM_ROOT/bin/$PVM_ARCH
fi
———————————————————————————

위 수정된 내용을 클러스터 모든 노드의 /root/.bashrc 마지막에 모두 추가한다.

# cat bashrc.stub >> /root/.bashrc
# . /root/.bashrc

이제 PVM nodelist 를 만든다.

# vi pvm.host
——————————————————————————–
arhfw
arhdev
arh01
arh02
arh05
arh06
arh07
arh08
——————————————————————————-

PVM 을 실행하도록 한다.

# pvm pvm.host
pvm> conf
——————————————————————————
8 hosts, 1 data format
                    HOST     DTID     ARCH   SPEED       DSIG
                   arhfw    40000 LINUXI386    1000 0x00408841
                  arhdev    80000 LINUXI386    1000 0x00408841
                   arh01    c0000 LINUXI386    1000 0x00408841
                   arh02   100000 LINUXI386    1000 0x00408841
                   arh05   140000 LINUXI386    1000 0x00408841
                   arh06   180000 LINUXI386    1000 0x00408841
                   arh07   1c0000 LINUXI386    1000 0x00408841
                   arh08   200000 LINUXI386    1000 0x00408841
pvm>
——————————————————————————

이제 pvmpovray 를 설치 한다.

pvmpovray는 http://www.povray.org 에서 패키지를 찾을 수 있다.

# cd /usr/local
# mkdir -p povray/pvm
# cd povray/pvm

# wget -q http://prdownloads.sourceforge.net/pvmpov/pvmpov-3.1g2.tgz
# wget -q ftp://ftp.povray.org/pub/povray/Old-Versions/Official-3.1g/Unix/povuni_s.tgz
# wget -q ftp://ftp.povray.org/pub/povray/Old-Versions/Official-3.1g/Unix/povuni_d.tgz          
압축을 푼다.

# tar xzvf pvmpov-3.1g2.tgz
# cd pvmpov3_1g_2/
# tar xzvf ../povuni_d.tgz
# tar xzvf ../povuni_s.tgz
# cd povray31/source/

관련 Library 를 컴파일 한다.

# cd libpng
# cp scripts/makefile.lnx Makefile
# make
# cd ../zlib
# ./configure && make
# cd ../pvm
# aimk newunix
# aimk newxwin
-> aimk 는 PVM 에서 사용하는 make tool로 PVM을 설치하면 /usr/share/pvm3/lib 밑에 존재한다.

/usr/local/povray/pvm/ 밑에 있는 모든 데이터를 클러스터 노드에 동기화 시킨다.
그런후 각 노드에서 aimk install 을 실행한다.

# aimk install

# cd /usr/local/povray/pvm/pvmpov3_1g_2/povray31/scenes/advanced
# x-pvmpov +iskyvase.pov +h600 +w800 +FT +v1 -x -d +a0.300 -q9 -mv2.0 -b1000 -nw32 -nh32 -nt16 -L/usr/local/povray/pvm/pvmpov3_1g_2/povray31/include

————————————————————————————-ㅣㄴ

  PVM Slave…… x-pvmpov
  PVM WorkingDir. /usr/local/povray/pvm/pvmpov3_1g_2/povray31/scenes/advanced
  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 arhfw successfully started.
 Slave 2 at arhdev successfully started.
 Slave 3 at arh01 successfully started.
 Slave 4 at arh05 successfully started.
 Slave 5 at arh06 successfully started.
 Slave 6 at arh07 successfully started.
  -:–:–  1.05 of blocks complete. Slave 7 at arh08 successfully started.
  -:–:–  1.26 of blocks complete. Slave 8 at arh01 successfully started.
 Slave 9 at arh02 successfully started.
 Slave 10 at arhdev successfully started.
 Slave 11 at arh02 successfully started.
 Slave 12 at arh05 successfully started.
 Slave 13 at arh07 successfully started.
 Slave 14 at arh06 successfully started.
 Slave 15 at arh08 successfully started.
  0:00:05 93.89 of blocks complete.Not using arhfw for reassignment (64%)e 0).
  0:00:05 94.53 of blocks complete.Not using arh07 for reassignment (73%)
Not using arhfw for reassignment (67%)
Not using arh07 for reassignment (60%)
  0:00:05 95.58 of blocks complete.Not using arh06 for reassignment (77%)
  0:00:05 95.79 of blocks complete.Not using arh08 for reassignment (49%)
  0:00:05 96.42 of blocks complete.Not using arh08 for reassignment (59%)

Slave at arh07 has exited.
Not using arh05 for reassignment (79%)

Slave at arhfw has exited.

Slave at arhfw has exited.
Not using arh05 for reassignment (83%)
  0:00:05 97.47 of blocks complete.Not using arh06 for reassignment (65%)
  0:00:05 97.68 of blocks complete.
Slave at arh08 has exited.
  0:00:05 97.68 of blocks complete.
Slave at arh07 has exited.
  0:00:05 98.11 of blocks complete.   520 of  600 lines finished (in frame 0).
Slave at arh05 has exited.
  0:00:05 98.26 of blocks complete.   528 of  600 lines finished (in frame 0).
Slave at arh05 has exited.
  0:00:06 98.53 of blocks complete.
Slave at arh06 has exited.
  0:00:06 98.58 of blocks complete.   536 of  600 lines finished (in frame 0).
Slave at arh06 has exited.
  0:00:06 98.68 of blocks complete.   600 of  600 lines finished (in frame 0).
Finishing frame 0…rtw. 600
Waiting for remaining slave stats.


PVM Task Distribution Statistics:
           host name  [ done ] [ late ]           host name  [ done ] [ late ]
               arh08  [ 3.20%] [ 0.00%]               arh08  [ 3.79%] [ 0.00%]
               arhfw  [ 4.05%] [ 0.00%]               arhfw  [ 4.27%] [ 0.00%]
              arhdev  [ 5.87%] [ 0.24%]              arhdev  [ 5.97%] [ 0.60%]
               arh01  [11.84%] [ 1.87%]               arh01  [10.67%] [ 1.79%]
               arh02  [11.95%] [ 1.87%]               arh02  [10.45%] [ 1.67%]
               arh05  [ 5.33%] [ 0.00%]               arh05  [ 5.07%] [ 0.00%]
               arh06  [ 4.27%] [ 0.00%]               arh06  [ 4.85%] [ 0.00%]
               arh07  [ 3.84%] [ 0.00%]               arh07  [ 4.59%] [ 0.00%]


POV-Ray statistics for finished frames:
skyvase.pov Statistics (Partial Image Rendered), Resolution 800 x 600
—————————————————————————-
Pixels:          214144   Samples:          272232   Smpls/Pxl: 1.27
Rays:           1150367   Saved:              8422   Max Level: 0/5
—————————————————————————-
Ray->Shape Intersection          Tests       Succeeded  Percentage
—————————————————————————-
CSG Intersection               3703914          330451      8.92
Plane                         22223484        11875070     53.43
Quadric                        3703914         1567155     42.31
Sphere                         3703914          565252     15.26
—————————————————————————-
Calls to Noise:            1191556   Calls to DNoise:        2243806
—————————————————————————-
Shadow Ray Tests:          4260072   Succeeded:               100697
Reflected Rays:             878135
—————————————————————————-
Smallest Alloc:                 14 bytes   Largest:            16028
Peak memory used:          2112704 bytes
—————————————————————————-
Time For Trace:    0 hours  0 minutes  10.0 seconds (10 seconds)
    Total Time:    0 hours  0 minutes  10.0 seconds (10 seconds)

————————————————————————————–

그럼 위와 같이 서버당 자원 활용 현황과 렌더링 시간이 나오게 된다.

만일 렌더링중 그래픽 결과를 보고 싶다면.. +v +D 옵션을 붙여서 실행하면 된다.

#  x-pvmpov +iskyvase.pov +h600 +w800 +FT +v1 -x -d +a0.300 -q9 -mv2.0 -b1000 -nw32 -nh32 -nt16 -L/usr/local/povray/pvm/pvmpov3_1g_2/povray31/include +v +D


##### Povray 설치 및 사용 방법 #############3

povary 사이트에서 최신 povary를 다운 받는다.
povary 는 pvmpovary 와 달리 단일 시스템에서만 동작을 하는 것이다. 클러스터 시스템과
비교용 벤치 마킹 툴로 사용하면 편리하다.

설치 방법은 매우 간단하다.

# tar xzvf povlinux-3.6.tgz
# cd povray-3.6/
# ./install
————————————————————————————
POV-Ray 3.6 installation
==========================

installing POV-Ray in default location (/usr/local)
——————————————————
Copying files…
  creating supplementary files directory (/usr/local/share/povray-3.6)…
  copying include files…
  copying sample scenes…
  copying ini files…
  copying script files…
  copying icon files…
  copying POV-Ray man page…
  copying POV-Ray executable…
    – creating backup from old POV-Ray executable as povray.old.2005-07-13

  creating backup of /usr/local/share/doc/povray-3.6
  as /usr/local/share/doc/povray-3.6.bak
  copying POV-Ray documentation…
Finished copying files
——————————————————
updating system level configuration…
  creating backup of old povray.ini file as povray.ini.old.2005-07-13
  updating main POV-Ray ini file…
  checking ini file /usr/local/etc/povray/3.6/povray.ini
    – file does not need to be modified
  a system povray.conf file already exists.
  copying the default version as povray.conf.new
Finished updating configuration
——————————————————

POV-Ray 3.6 has seemingly already been installed on this
system before.  The installation has updated the existing
povray.ini file.

You should check if the new ini file:

  /usr/local/etc/povray/3.6/povray.ini

correctly reflects your configuration.

An existing povray.conf file has been found and was left
as it is.  The default file has been copied as:

  /usr/local/etc/povray/3.6/povray.conf.new

for reference.

——————————————————

  The install script will now run a short test render
  to check if POV-Ray is correctly configured.
  This test render will be without display since this
  is will often not work correctly in superuser mode.

  Type ‘R’ to run the test
  Type ‘S’ to skip it.

Your choice ([R]/S):  R  <-  R을 입력하면 바로 테스트가 진행된다.

Support libraries used by POV-Ray:
  ZLib 1.2.1, Copyright 1995-1998 Jean-loup Gailly and Mark Adler
  LibPNG 1.2.5, Copyright 1998-2002 Glenn Randers-Pehrson
  LibJPEG 6b, Copyright 1998 Thomas G. Lane
  LibTIFF 3.6.1, Copyright 1988-1997 Sam Leffler, 1991-1997 SGI
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
Parsing Options
  Input file: scenes/advanced/biscuit.pov (compatible to version 3.61)
  Remove bounds……..On
  Split unions………Off
  Library paths:
    /usr/local/share/povray-3.6
    /usr/local/share/povray-3.6/ini
    /usr/local/share/povray-3.6/include
Output Options
  Image resolution 320 by 240 (rows 1 to 240, columns 1 to 320).
  Graphic display……Off
  Mosaic preview…….Off
  CPU usage histogram..Off
  Continued trace……Off
Tracing Options
  Quality:  9
  Bounding boxes…….On   Bounding threshold: 3
  Light Buffer………On
  Vista Buffer………On   Draw Vista Buffer….Off
  Antialiasing………On  (Method 1, Threshold 0.300, Depth 3, Jitter 1.00)
  Clock value:    0.000  (Animation off)

  0:00:01 Parsing 157K tokens
  0:00:01 Creating bounding slabs
  0:00:01 Creating vista buffer
  0:00:01 Creating light buffers 333K tokens
Scene Statistics
  Finite objects:          292
  Infinite objects:          0
  Light sources:             2
  Total:                   294

  0:00:05 Rendering line 28 of 240, 4730 supersamples

———————————————————————————–

이제 실제 그래픽 랜더링을 해 보도록 하자.

# cd /usr/local/povray/povray-3.6/scenes/advanced
# povray +iskyvase.pov +w640 +h480
———————————————————————————–
.
.
  0:00:18 Rendering line 466 of 480
  0:00:18 Done Tracing
Render Statistics
Image Resolution 640 x 480
—————————————————————————-
Pixels:           307200   Samples:          307200   Smpls/Pxl: 1.00
Rays:            1275206   Saved:              8964   Max Level: 13/20
—————————————————————————-
Ray->Shape Intersection          Tests       Succeeded  Percentage
—————————————————————————-
CSG Intersection               1059055          300654     28.39
Plane                          9479604         4509844     47.57
Quadric                         961516          429675     44.69
Sphere                         1721659          969145     56.29
Bounding Object                 763421          578297     75.75
Bounding Box                   4805685         1761936     36.66
Light Buffer                   5382427         3360289     62.43
Vista Buffer                   1754733         1550093     88.34
—————————————————————————-
Calls to Noise:             1336133   Calls to DNoise:         2373988
—————————————————————————-
Shadow Ray Tests:           1355504   Succeeded:                108113
Reflected Rays:              968006
—————————————————————————-
Smallest Alloc:                   9 bytes
Largest  Alloc:             1228808 bytes
Peak memory used:           1523163 bytes
Total Scene Processing Times
  Parse Time:    0 hours  0 minutes  1 seconds (1 seconds)
  Photon Time:   0 hours  0 minutes  0 seconds (0 seconds)
  Render Time:   0 hours  0 minutes 18 seconds (18 seconds)
  Total Time:    0 hours  0 minutes 19 seconds (19 seconds)
————————————————————————————-

#### MPI 환경에서 Povray 를 설치 후 테스트 #####

pvmpovray 소스에서 mpi 관련 패치를 하면 mpi 환경에서 Povray 를 사용할 수 있다.
관련 정보는 아래 사이트에서 얻을 수 있다.

http://www.verrall.demon.co.uk/mpipov/

설치에 사용되는 소스와 방법은 Pvmpovray 와 유사하다.

# mkdir /usr/local/povray/mpi
# cd /usr/local/povray/mpi

Pvmpovray 에서 사용된 povuni_s.tgz 의 압축을 푼다.
patch 파일은 위 사이트에서 구할 수 있다.

# tar xzvf povuni_s.tgz
# cd povray31
# gzip -d mpi-povray-1.0.patch.gz
# patch -p1 < mpi-povray-1.0.patch
# cd source/libpng
# cp scripts/makefile.lnx Makefile
# make
# cd ../zlib
# ./configure && make
# cd ../mpi-unix/

여기에서 시스템 스펙에 맞게 Makefile의 CFLAGS 를 수정하도록 한다.
기본적으로 Pentium II-III 환경에 맞게 설정이 되어져 있다.

mpich 의 PATH 와 같은 기본 환경 설정을 해준 뒤 make 를 실행하다.

# make newxwin

그럼 mpi-x-povray 란 실행 파일이 생성이 되어져 있을 것이다.
이것을 모든 클러스터 노드에 동기화 시킨다.

그런 후 mpirun 으로 실행 하면 된다.  sample pov 파일과 라이브러리는 앞서컴파일
한 pvmpovray 것을 사용하면 된다.

# mpirun -np 8 ./mpi-x-povray +i/usr/local/povray/pvm/pvmpov3_1g_2/povray31/scenes/advanced/skyvase.pov +h600 +w800 +FT +v1 -x -d +a0.300 -q9 -mv2.0 -b1000 -nw32 -nh32 -nt16 -L/usr/local/povray/pvm/pvmpov3_1g_2/povray31/include +v +D
——————————————————————————-
.
.
PE Distribution Statistics:
            Slave PE  [ done ]            Slave PE  [ done ]
                   1  [17.81%]
                   2  [16.48%]                   3  [16.48%]
                   4  [14.35%]                   5  [12.59%]
                   6  [12.00%]                   7  [10.29%]


POV-Ray statistics for finished frames:
/usr/local/povray/pvm/pvmpov3_1g_2/povray31/scenes/advanced/skyvase.pov Statistics (Partial Image Rendered), Resolution 800 x 600
—————————————————————————-
Pixels:           62336   Samples:           77464   Smpls/Pxl: 1.24
Rays:            325184   Saved:              2579   Max Level: 0/5
—————————————————————————-
Ray->Shape Intersection          Tests       Succeeded  Percentage
—————————————————————————-
CSG Intersection               1045842          100780      9.64
Plane                          6275052         3374865     53.78
Quadric                        1045842          456770     43.67
Sphere                         1045842          148355     14.19
—————————————————————————-
Calls to Noise:             352825   Calls to DNoise:         634100
—————————————————————————-
Shadow Ray Tests:          1201896   Succeeded:                29076
Reflected Rays:             247720
—————————————————————————-
Smallest Alloc:                 48 bytes   Largest:            16028
Peak memory used:           988429 bytes
—————————————————————————-
Time For Trace:    0 hours  0 minutes  10.0 seconds (10 seconds)
    Total Time:    0 hours  0 minutes  10.0 seconds (10 seconds)

——————————————————————————-

동일 모델에 대한 PVM 과 MPI 의 성능 차이는 PVM 이 15초 처리, MPI 가 10초 처리로
MPI 가 우수한 걸로 나타난다.


Povray-3.6.1+mpi 구성하기

http://comp.uark.edu/~ewe/dvc/MPI-POVRay.html 사이트에서 MPI-povray.patch 파일을 다운 받는다.

 MPI-povray.patch 파일을 povray-3.6.1 source 디렉토리에 복사한 후

patch -p1 < MPI-povray.patch 수행

그런 후

# export CC=/engrid/enhpc/mpich/gcc/bin/mpicc
# export CXX=/engrid/enhpc/mpich/gcc/bin/mpicxx
# export CFLAGS=”-DHAVE_MPI”
# export CXXFLAGS=”-DHAVE_MPI”

./configure –prefix=…. COMPILED_BY=”Jinwoo Seo <alang@clunix.com>”

# make && make install

# mpirun -np 2 povray xxx.pov
 

RHEL5 에 설치 시 ..
render.h:62 line (extern DBL maxclr;)을 주석처리하거나, render.c:108 의 maxclr staic type을 제거함
(static DBL maxclr -> DBL maxclr)

애니메이션 만들기

povray +i<input.pov> +w<width> +h<height> +kfi<start frame> +kff<end frame>

애니메이션 povray source를 가지고 rendering 할때 +kfi 와 +kff 옵션을 사용한다.

+kfi 에 start frame 번호를, +kff 에 end frame 번호를 입력한 후 render을 하면 자동으로 각 프레임별
이미지(png) 파일을 만든다.

이것을 ffmpeg 혹은 별도의 encoding 프로그램으로 동영상 파일을 만들면 된다.

Povray Source 제공 사이트

http://local.wasp.uwa.edu.au/~pbourke/exhibition/scc5/final.html

http://www.oyonale.com/modeles.php?lang=en&format=POV

http://www.shipbrook.com/jeff/raytrace/

http://lib.povray.org/searchcollection/index.php

http://www.dylanbeattie.net//starwars/starwars.html

http://www-graphics.stanford.edu/~tolis/toli/research/shuttle.html

http://runevision.com/3d/anims/

Povray Image rendering 결과


Povray Animation rendering 결과

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

2 Responses

  1. 서진우 말해보세요:

    ffmpeg -r 25 -i splinefollow%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p splinefollow.mp4

  2. 서진우 말해보세요:

    animation frame 중 특정 frame 만을 선택해서 rendering을 하기 위해서는
    +kfi +kff +sf +ef 옵션을 이용해야 한다.

서진우 에 응답 남기기 응답 취소