Skills Practiced: C++, Multithreading, Parallel Processing, Raytracing
Frameworks / Tools / Engines Used: SFML
Project Duration: 3 Weeks
Project Type: University Coursework
This was created during my time at the University of Abertay, Dundee, as a coursework project for a Parallel Programming module. The coursework specified that we should have an application that ran in parallel on multiple cores, making use of modern multithreading techniques, that it should be thread-safe, and that we should do in-depth analysis of the performance and issues that arose.
I wrote a multi-threaded raytrace renderer, as they are easy to parallelize (by splitting the screen into separate rendering “chunks”, as shown in the image below) and I wanted to further my graphics programming skill. I had previously written a raycast renderer, and so I wanted to improve upon what I already knew with a raytracer that could handle shadows and lighting.
The application used SFML to render a 2D surface, upon which I could modify the frame buffer to render the scene.
I wrote a task manager for the application that would assign jobs to threads based on which chunks had already been rendered that frame; this worked for the most part but ran into issues where some jobs would be assigned out of sync with threads, leaving them uncompleted while the thread continued with other queued jobs. These “orphaned” jobs were then re-assigned by the task manager if they had been assigned but were not being worked on by any active threads, with a minimal performance overhead.
Detailed performance metrics were collected, as seen below: