POV-Ray : Newsgroups : povray.programming : PovRay as server-client ? Server Time
23 Dec 2024 06:34:14 EST (-0500)
  PovRay as server-client ? (Message 1 to 9 of 9)  
From: Rafal 'Raf256' Maj
Subject: PovRay as server-client ?
Date: 13 Nov 2002 11:53:34
Message: <Xns92C5B556939Araf256com@204.213.191.226>
Hello,
I want to allow PovRAY to work in client-server mode.
Below I described +/- how should it work, and what are benefits from it, 
text is quite long but I wanted to explain it clearly :)

The idea is that main POV engine will be started once and stay in memory, 
communicating with clients via disc files (or shared-memory, pipes, LAN and 
other advanced methods - later).

This will allow to easly use POV in multi-procesors machines or clasters.

--- Example ---
We have some computers - 2 computers (single and 2-CPU) in work, and 2,5 
GHz machine in friend's house. We run PovHost on each computer (ofcourse we 
must ask friend to help us... or just use some trojan ;)

So :
PC-1 (work)
  CPU-1a 2 GHz running PovHost (instance 1a)
PC-2 (work)
  CPU-2a 1 GHz running PovHost (instance 2a)
  CPU-2a 1 GHz running PovHost (instance 2b)
PC-3 (friend)
  CPU-3a 2,5 GHz running Doom3 Alpha that tooks 2 GHz                  
                 running PovHost (instance 3a) - using 0.5 GHz in IDLE mode

--------

We sit comfortable in front of our computer in home (old 333 Hz) and run 
Pov-Client on it (and automaticly PovHost instantion 0a)

PovClient connects to all PC's, check if PovHosts are available on them.
(Connection details - LAN shared file, some TCP/IP are not important now, 
lets assume communication is via FTP file(s) accesed by all computers that 
work as data pipe).

PovClient ask Hosts how fast do they work answare is :
  0a  200 MHz  90 PhisicalRAM free +  512 virtual
  1a 1950 MHz 480 PhisicalRAM free + 2048 virtual
  2a  970 MHz 200 PhisicalRAM free + 2048 virtual
  2b  950 MHz -||-
  3a  450 MHz   5 PhisicalRAM free + 128 virtual
we decide that host 3a is low on free RAM, so we will not use it (we don't 
want friend to get mad at us for slowing down his Doom3 ;)

So we can use not only our ~200 MHz, but we can use about 4000 MHz :)
We opan test.pov on Main Computer (MC), in Pov Client and select render.

Now :
1) MC uploads test.pov file to FTP. (assume that scene do NOT use other 
files then main .pov). 
2) MC orders PovHosts (PH) 0a,1a,2a,2b to load scene from FTP (ofcourse 0a 
can just load it from local HDD).
3) all PH's reports their are ready (maybe scene CRC checking etc... will 
be added later)
4) MC orders PH's to render some parts of image basing on thier speed, 
i.e.:
  0a will render 10% of image (it is slowest)
  1a will render 40%
  2a will render 20%
  2b will render 20%
More about dividing images - below.
5) All PH's are rendering, and i.e. each 1..5 seconds (basing on connection 
speed, ping's etc) their are sending data (parts of rendered image) to MC.
6) PH 2a and 2b didn't responde for long time - probably computer #2 had 
crashed (or internet connection is broken etc...) - we give some parts of 
job assigned to 2a and 2b to other working PH (0a and 1a).
7) all rendering is completed - all data are on MC - several times faster 
that it would be if not using PH :)

--- Why this can be done alread without any path ?
- we can just email .pov to friend and ask him to render lines 0..300 of 
this image, and other friend - to render lines 300..640

--- Why this can NOT be done already ?
- we must send emails, and do all calculations "by hand" - with is NOT 
comfortable
- If we have large image and 10 computers with different speeds, and some 
of them may fail while rendering - assigning diffrent jobs to all computers 
manualy may be realy hard
- we can not use special image dividing methods - below.


---------- Image dividing -----------
This very simple idea helps to overcome some problems with dividing image.
Most primitive method, when we have two PC's with X MHz and Y MHz is to 
render :
PC-X MHz render lines 0%..X/(X+Y)%
PC-Y MHz render lines 0%..Y/(X+Y)%
i.e. for 1 GHz and 2 GHz it would be lines 0-.33% and .33-1.00%

(div-2) Image will be devided like :

xxxxxxx 
xxxxxxx
YYYYYYY
YYYYYYY
YYYYYYY
YYYYYYY

Problem will apear if i.e. in upper part we have some very complicated 
isosurface, and lowwer part is just checker plane.

(div-3) better idea is :
xxxxxxx
YYYYYYY
YYYYYYY
xxxxxxx  
YYYYYYY
YYYYYYY

(div-4) And imho best idea would be :
xYYxYYx
YYxYYxY
YxYYxYY
xYYxYYx
YYxYYxY
YxYYxYY

MC should alloc memory for entire image (with realy is't so big problem 
this days), and he will remember for each pixel - it's data plus - is it 
beeing rendered (and on with machine). Basing on this - MC will send orders 
to HC like :
  HC-1a please render line #100 columns 1..10


--- More about dividing ---


Method div-4 is after all not the best - it is good for complicated images 
where i.e. each pixel may render 5..10 seconds.

For animations where each frame renders few seconds it would be best to use 
"div-0" where i.e. HC-1a renders frames 0,1,2,3,4 HC-2a renders frames 
5,6,7,8 etc...

Ofcourse this algorithms for optimal dividing job (rendering) beetwen many 
different host's (other CPU,RAM and communication-speed) can be realy 
compilcated.

--- Begin ---

IMHO to achive interesting possibilites as described above we should start 
by separating rendering engine from editor / etc.
I want to try to implement it.
AFAIK currently POV works like :
  - Load ini
  - Parse scene
  For each pixel :  
     render pixel
  - Dealocate scene

And I want to chang it into :


CreateCommunicationPipe();
while (!order.cmd==ORDER_EXIT) {
  ReadOrdersFromPipe();
  if (order.cmd==ORDER_PING) SendDataToPipe( time() );
  if (order==ORDER_PARSE_SCENE) {
    if (scene_is_loaded) DeallocScene();
    ParseScene();
    scene_is_loaded=1;
   }
  if (order==ORDER_DEALLOC_SCENE) { DeallocScene(); scene_is_loaded=0; }
  if (order==ORDER_RENDER) {
    if (scene_is_loaded) {
      RenderScene(order.x1,order.y1,order.x2,order.y2);
      SendDataToPipe( ... );
    }
    else SendDataToPipe( ERROR_REPORT );
  }
}
DestroyCommunicationPipe();
if (scene_is_loaded) DeallocScene();
SendDataToPipe( GOODBY );


Ofcourse this is a very general template...
I will try to implement such mechanizm - as shell :

RenderScene(int x1 ...) {
  spawn("pvengine.exe","+.....");
}

so this program will just start PovRay (in current version).
If You will agree that program works good - maybe it would be a good idea 
to integrate this system into POV core

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: ABX
Subject: Re: PovRay as server-client ?
Date: 13 Nov 2002 12:02:03
Message: <0315tugbu3fqd4v2cbujv5hit299bn9mli@4ax.com>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
> Hello,
> I want to allow PovRAY to work in client-server mode.

http://www.it-berater.org/smpov.htm , http://www.imp.org/ ?

ABX


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: PovRay as server-client ?
Date: 13 Nov 2002 12:04:22
Message: <Xns92C5B72A63745raf256com@204.213.191.226>
ABX <abx### [at] abxartpl> wrote in 
news:0315tugbu3fqd4v2cbujv5hit299bn9mli@4ax.com

> http://www.it-berater.org/smpov.htm

Probaly yes :) it's hard to do something new... ;/

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: PovRay as server-client ?
Date: 13 Nov 2002 12:11:20
Message: <Xns92C5B8590471Draf256com@204.213.191.226>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in 
news:Xns### [at] 204213191226

>> http://www.it-berater.org/smpov.htm
> Probaly yes :) it's hard to do something new... ;/

I instaled it - looks like a more simply version of my idea.


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Tom Galvin
Subject: Re: PovRay as server-client ?
Date: 15 Nov 2002 02:49:41
Message: <Xns92C71CBF85FCBtomatimporg@204.213.191.226>
ABX <abx### [at] abxartpl> wrote in news:0315tugbu3fqd4v2cbujv5hit299bn9mli@
4ax.com:

> "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
>> Hello,
>> I want to allow PovRAY to work in client-server mode.
> 
> http://www.it-berater.org/smpov.htm , http://www.imp.org/ ?
> 
> ABX



http://sourceforge.net/projects/impfarm/

;)
Tom


Post a reply to this message

From: Rick [Kitty5]
Subject: Re: PovRay as server-client ?
Date: 15 Nov 2002 06:06:27
Message: <3dd4d533$1@news.povray.org>
Tom Galvin wrote:
> http://sourceforge.net/projects/impfarm/

 This Project Has Not Released Any Files

--

Rick

Kitty5 NewMedia http://Kitty5.co.uk
POV-Ray News & Resources http://Povray.co.uk
TEL : +44 (01270) 501101 - FAX : +44 (01270) 251105 - ICQ : 15776037

PGP Public Key
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x231E1CEA



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.419 / Virus Database: 235 - Release Date: 13/11/2002


Post a reply to this message

From: Tom Galvin
Subject: Re: PovRay as server-client ?
Date: 15 Nov 2002 08:41:45
Message: <Xns92C7586F6AB8Ftomatimporg@204.213.191.226>
"Rick [Kitty5]" <ric### [at] kitty5com> wrote in news:3dd4d533$1@news.povray.org:
>
>  This Project Has Not Released Any Files
> 
> --
> 
> Rick
> 

But the current source code is in cvs which you can also browse here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/impfarm/perl/


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: PovRay as server-client ?
Date: 15 Nov 2002 10:33:57
Message: <Xns92C7A7DC2B086raf256com@204.213.191.226>
Tom Galvin <tom### [at] imporg> wrote in 
news:Xns### [at] 204213191226

> http://sourceforge.net/projects/impfarm/

I hope to make better version :)

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Tom Galvin
Subject: Re: PovRay as server-client ?
Date: 15 Nov 2002 12:45:31
Message: <Xns92C781C308084tomatimporg@204.213.191.226>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in 
news:Xns### [at] 204213191226:

> Tom Galvin <tom### [at] imporg> wrote in 
> news:Xns### [at] 204213191226
> 
>> http://sourceforge.net/projects/impfarm/
> 
> I hope to make better version :)
> 

Or you could help to make this a better version.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.