POV-Ray : Newsgroups : povray.programming : How does povray distribute jobs? : Re: How does povray distribute jobs? Server Time
19 Apr 2024 08:57:48 EDT (-0400)
  Re: How does povray distribute jobs?  
From: clipka
Date: 24 Jan 2011 12:30:45
Message: <4d3db745@news.povray.org>
Am 24.01.2011 16:39, schrieb Jack Burton:

> How does povray distribute jobs? If there are multiple cores (let's say 3 slaves
> and a single master), how are jobs queued and distributed to cores?

First of all, to avoid misunderstanding, a few clarifications:

- POV-Ray 3.7 does not assign jobs to cores; it assigns jobs to threads, 
leaving it up to the OS to assign those to cores.

- POV-Ray's "back-end" (the portion of code that does the actual 
computations) is not based on a master-slave architecture; instead, 
there are identical threads, using mutexed access to some shared 
ressources. (There is, however, a separate "front-end" thread that 
collects the work results. It currently doesn't distribute the jobs though.)

> For example, core 1 finishes its job and sits idle. There are jobs waiting on
> cores 2 and 3 - is the master clever enough to tell core 1 to take up the slack?
> Or does the master leave these jobs until the end and process the jobs itself?

Workload distribution in POV-Ray is actually pretty simple:

- The image to be rendered is divided into tiles, typically 32x32 pixels 
in size; the computation of each such tile comprises one job.

- There is only one single job queue, shared by all threads. Whenever a 
thread finishes a job, it pulls the next job from the queue (using 
mutexing to prevent race conditions or some such).

- As soon as a thread would become truly idle (because there are no jobs 
left in the queue), it terminates, so there is actually no such thing in 
POV-Ray as an idle render thread (except while waiting for a mutex or 
some such of course).

- The tiles are the smallest work units there is, so it may happen that 
one thread is still busy computing a particularly "expensive" tile, 
while the other threads have already terminated due to lack of work.


Post a reply to this message

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