POV-Ray : Newsgroups : povray.general : using a quad core linux box to speed up povray Server Time
31 Jul 2024 02:20:31 EDT (-0400)
  using a quad core linux box to speed up povray (Message 1 to 10 of 10)  
From: Rahul
Subject: using a quad core linux box to speed up povray
Date: 5 Mar 2008 18:25:00
Message: <web.47cf2bbb789d489659eba08c0@news.povray.org>
Hi,

I have a script that each time has to render batches of 8 povray images. It
usually takes me about  a minute to do it. Its not a lot but the wait time is
getting irritating especially since it is a part of a quasi-interactive
render-tweak-render cycle for my users.

Now, we just got a new quad-core Red Hat Box and I was wondering if that opens
possibilities to speed up my script? Any suggestions?

The options that came to my mind:

1. At shell script level call povray serially in the background so that each
successive call is rendered on a different core. (Although, how does one do
this! ANy tips? Or will each call automatically go to a different core?)

2. Somehow get povray setup so that it can take advantage of all 4 cores.

I have an advantage in that each of my 8 images is essentially a seperate
render. In that sense my problem is embarrassingly parallel. So if I could just
set it up so that each povray call was routed to a different core it ought to
speed it up.

But that's just my naive idea. Maybe I'm totally wrong. Feel free to correct me
guys.

-Rahul


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: using a quad core linux box to speed up povray
Date: 5 Mar 2008 18:31:35
Message: <47cf2d57@news.povray.org>

> 2. Somehow get povray setup so that it can take advantage of all 4 cores

Just get the POV-Ray 3.7 beta which has multithreading support.


Post a reply to this message

From: Rahul
Subject: Re: using a quad core linux box to speed up povray
Date: 5 Mar 2008 19:55:00
Message: <web.47cf3fcba2f2860c59eba08c0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:

> > 2. Somehow get povray setup so that it can take advantage of all 4 cores
>
> Just get the POV-Ray 3.7 beta which has multithreading support.

Thanks Nicholas! I will try to upgrade to that one although I'm not too sure I
want to go to a beta version on my production system.

I am using Version 3.6.1 right now.  With this version if I start 4 independent
povray processes in quick succession and backgrounded will each one run on a
different core? How does one control that?

-Rahul


Post a reply to this message

From: Nicolas Calimet
Subject: Re: using a quad core linux box to speed up povray
Date: 5 Mar 2008 20:12:56
Message: <47cf4518$1@news.povray.org>
> I am using Version 3.6.1 right now.  With this version if I start 4 independent
> povray processes in quick succession and backgrounded will each one run on a
> different core?

	In short, yes.

> How does one control that?

	The operating system does it for you.  That's the whole idea of multitasking.

	- NC


Post a reply to this message

From: Rahul
Subject: Re: using a quad core linux box to speed up povray
Date: 5 Mar 2008 20:55:00
Message: <web.47cf4e42a2f2860c59eba08c0@news.povray.org>
Nicolas Calimet <pov### [at] freefr> wrote:
> > I am using Version 3.6.1 right now.  With this version if I start 4 independent
> > povray processes in quick succession and backgrounded will each one run on a
> > different core?
>
>  In short, yes.
>
> > How does one control that?
>
>  The operating system does it for you.  That's the whole idea of multitasking.
>
>  - NC

Thanks Nicolas. I suspected the OS would; just wanted to make sure I get an
expert opinion. I'll try to time four backgrounded povray renders now just to
make sure I am getting the performance enhancement we'd expect.

-Rahul


Post a reply to this message

From: Nicolas George
Subject: Re: using a quad core linux box to speed up povray
Date: 7 Mar 2008 04:15:26
Message: <47d107ae$1@news.povray.org>
"Rahul"  wrote in message
<web.47cf2bbb789d489659eba08c0@news.povray.org>:
> 1. At shell script level call povray serially in the background so that each
> successive call is rendered on a different core.

Instead of using a shell script, you can use a Makefile: with the -j option,
you can tell make to run n tasks in parallel; each time a task is completed,
a new is started, as long as there is work to do.


Post a reply to this message

From: Rahul
Subject: Re: using a quad core linux box to speed up povray
Date: 7 Mar 2008 13:15:00
Message: <web.47d1860aa2f2860c59eba08c0@news.povray.org>
Nicolas George <nicolas$george@salle-s.org> wrote:
> "Rahul"  wrote in message
> <web.47cf2bbb789d489659eba08c0@news.povray.org>:
> > 1. At shell script level call povray serially in the background so that each
> > successive call is rendered on a different core.
>
> Instead of using a shell script, you can use a Makefile: with the -j option,
> you can tell make to run n tasks in parallel; each time a task is completed,
> a new is started, as long as there is work to do.

Hmm...that might be something new for me to try. I have only used Make files for
compilation before this. How does one integrate it into a "script"?

Let me describe my setup. We have co-ordinate files that we render "on-the-fly"
by parsing into suitable .pov files and then calling povray. All this is
currently done within a wrapper shell script.

Any more guidance?

-Rahul


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: using a quad core linux box to speed up povray
Date: 7 Mar 2008 13:25:34
Message: <47d1889e$1@news.povray.org>

> Hmm...that might be something new for me to try. I have only used Make files for
> compilation before this. How does one integrate it into a "script"?
> 
> Let me describe my setup. We have co-ordinate files that we render "on-the-fly"
> by parsing into suitable .pov files and then calling povray. All this is
> currently done within a wrapper shell script.
> 
> Any more guidance?

If your pov files are generated, make becomes even more useful. I'll 
write a sample makefile for you; but first I need more info. Does a 
single program call convert all the coordinates into all the .pov files, 
or do you need to run it repeatedly to convert each coordinate file into 
a single .pov file?


Post a reply to this message

From: Rahul
Subject: Re: using a quad core linux box to speed up povray
Date: 7 Mar 2008 21:10:01
Message: <web.47d1f48ba2f2860c59eba08c0@news.povray.org>
> If your pov files are generated, make becomes even more useful. I'll
> write a sample makefile for you; but first I need more info. Does a
> single program call convert all the coordinates into all the .pov files,
> or do you need to run it repeatedly to convert each coordinate file into
> a single .pov file?


Thanks for offering to help! Here's more details. There's looping at two levels.
One over a variable  number (say 6 to 20) of coordinate files.
Second, over two views (front and top).

The existing parser and povray-invoker is written in python. Here's some pseudo
code:

python code:

foreach coordinate_file
 parse coordinate_file into  frontview.pov
 povray call to produce frontview.ppm
 parse coordinate_file into topview.pov
 povray call to produce topview.ppm
 montage call to combine frontview.ppm and topview.ppm -> image.jpeg

Right now I mangaed to speed it up by using a shell script to call the python
code over and over again but in the background. This allows me to split the
background processes each over  different cores. And that does speed up things!
Luckily each image render is independent so that was easy.

shell wrapper:

for each coordinate_file
 call python_code &


On the other hand both front and top views must be rendered prior to the montage
call for each image. So that's not so straightforward to parallelize within a
single python call. Its only the povray calls that take time; the parsing is
quick.

Does this answer your question? If not just let me know.

Thanks again and I'm really curious to see how you use "make" here!

-Rahul


Post a reply to this message

From: Nicolas George
Subject: Re: using a quad core linux box to speed up povray
Date: 8 Mar 2008 10:13:57
Message: <47d2ad35@news.povray.org>
"Rahul"  wrote in message
<web.47d1f48ba2f2860c59eba08c0@news.povray.org>:
> foreach coordinate_file
>  parse coordinate_file into  frontview.pov
>  povray call to produce frontview.ppm
>  parse coordinate_file into topview.pov
>  povray call to produce topview.ppm
>  montage call to combine frontview.ppm and topview.ppm -> image.jpeg

With GNU-make-isms, you can do that with something like (untested):

%-front.pov: %.coords
	coords2front $< > $@

%-top.pov: %.coords
	coords2top $< > $@

%.pgm: %.pov:
	povray +I$<

%.jpg: %-front.pgm %-top.pgm
	montage ... $^ $@

Then "make -j 4 pretty.jpg ugly.jpg" should do the necessary work to build
two images using up to 4 processes in parallel.


Post a reply to this message

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