POV-Ray : Newsgroups : povray.programming : beta: parallelizing BSP-building possible? : beta: parallelizing BSP-building possible? Server Time
4 May 2024 08:08:48 EDT (-0400)
  beta: parallelizing BSP-building possible?  
From: Lukas Winter
Date: 24 Feb 2008 05:28:09
Message: <47c146b9@news.povray.org>
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 2003-2023 Persistence of Vision Raytracer Pty. Ltd.