POV-Ray : Newsgroups : povray.bugreports : POV-ray should use multiple threads : Re: POV-ray should use multiple threads Server Time
15 May 2024 01:23:58 EDT (-0400)
  Re: POV-ray should use multiple threads  
From: clipka
Date: 12 Aug 2009 19:15:10
Message: <4a834cfe$1@news.povray.org>
Timwi schrieb:
> Suggested algorithm (pseudo-code):
> 
> Let n = number of CPUs (or configured number of threads).
> Let h = height of the output bitmap.
> Let lines = list of integers initialised to [0, 1, 2, ..., h-1].
> 
> Spawn n threads, where each thread does the following:
>   Obtain a mutex on 'lines'.
>   If 'lines' is empty, release the mutex and return.
>   Remove an integer y from 'lines'.
>   Release the mutex on 'lines'.
>   Render the row of pixels at y co-ordinate 'y'.
>   Go back to start.
> 
> Wait for all n threads to complete.
> Done.

Congratulations - you just re-invented POV-Ray 3.7 (which is currently 
in public beta phase) :P.

Except that 3.7 schedules square blocks instead of lines (to allow for 
better efficiency of some caching mechanisms). And that things start 
getting more complicated than you expect when it comes to some more 
sophisticated features (like radiosity for instance).


Post a reply to this message

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