Posted: 27 May 2012 09:35
This release is my first attempt at multithreaded rendering. Building upon work done for version 1.2, XRT now fires rays in a parallel fashion. Really, the algorithm is a no-brainer: the whole image is divided in small tiles stored in a work queue. While the queue is not empty, each rendering thread picks up a new tile and computes its pixels.
The tricky part is to make sure that the code is thread-safe. Namely, global ressources are evil things. Each thread must be granted exclusive write access while others are waiting for read access; otherwise, bad things happen.
There are only two solutions:
- protect the global ressources against shared access using atomics, mutexes, … Just be aware that synchronisation primitives have an intrinsic run-time cost and that the more threads wait, the less efficient the program becomes.
- make sure that each thread has its own copy of the data (re-entrancy is the buzzword here).
So, do not (yet) expect wonders. Synchronisation between threads on XRT is taking its toll and I have noticed that rendering times do not scale well with the number of processors. With 4 threads, I get only a 2.5x speed increase. I am looking at it.
As a side note, OIIO has also been upgraded to version 1.0.4. Except for a slight modification for XP, this is the genuine version.
The list of changes is fully detailed in the change log.
This version and the updated documentation are available in the Downloads page.