Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Multithreading #92

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open

WIP: Multithreading #92

wants to merge 30 commits into from

Conversation

nick-paul
Copy link
Collaborator

@nick-paul nick-paul commented Mar 27, 2024

I removed all references to the global Aya thread and passed execution context down using the refactored blocks from this PR. With a bit more refactoring I was able to provide an API to spawn and manage multiple instances the Aya thread (now called AyaThread).

The API is very clunky and there are a handful of bugs I still need to work through but the implementation is quite stable now.

Examples

I used the raytracer implementation to test stability and performance since it was a fairly large aya project. I implemented a thread pool using the current version of the thread API. It is a bit clunky and needs some improvement but was very stable overall.

The performance is significantly better with more threads but there is still quite a bit of overhead. Rendering an image with 15 threads gave a ~6x speedup as seen below:

multithread_3s
15 threads, execution time ~3s

singlethread_18s
1 thread, execution time ~18s

Code for the multithreaded renderer is here: https://github.com/nick-paul/aya-raytrace/tree/thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant