POV-Ray : Newsgroups : povray.programming : beta: parallelizing BSP-building possible? : beta: parallelizing BSP-building possible? Server Time: 9 Jul 2008 06:06:17 GMT
  beta: parallelizing BSP-building possible?  
From: Lukas Winter
Date: 24 Feb 2008 10:28:09
Hello,

I had a quick look at the beta source, even though I can't compile it on 
my Linux machine, and wondered, whether the code for building the BSP-
tree could be parallelized. As far as I understand the code, building the 
left and the right cell of a node simultaneously would be safe (perhaps 
the parametre "BBOX& cell" is a minor problem).
My idea is to create a pool of worker threads. Instead of recursing by 
simply calling

BuildRecursive(/*...*/);

we could assign the task to a non-busy worker thread, if there is one.

pseudo-code:
//split left cell
//[...]

if(worker_pool.worker_available())
{
  worker_pool.assign_task(BuildRecursive, /*parametres*/);
}
else
{
  BuildRecursive(/*...*/);
}

//the same for the other cell

The main thread would have to wait for all worker threads to finish. If 
one thread has finished before another, the other one will assign a new 
task to it.

Please correct me if I am wrong about this. I have not looked at the 
threading code.

Regarads
Lukas


Post a reply to this message

Copyright 1991-2004 POV-Team™