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

Make tree multithread-friendly #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RedKinda
Copy link

@RedKinda RedKinda commented Oct 8, 2023

Wraps the tree variable in a Mutex, so that execute only requires &self instead of &mut self. It also drops the lock while PP::playout is running, since that is the CPU intensive part. This allows for multiple threads to be running execute on it at the same time.

@Sagebati
Copy link
Owner

Hi, thanks for your PR.

Adding multi threading was of course on my plan, I'm happy someone is experimenting with this library.

I'm interested if you got some benchmark without your parallel implementation.

@RedKinda
Copy link
Author

Here is the (mess of a) project im using it in https://github.com/RedKinda/generalsio/blob/master/rs/src/mcts.rs

In the multithreaded version I am getting ~9k rollouts per second at maximum of 200 turns in one rollout, at 15 worker threads. For the old version i used to get around ~1600 rollouts per second, at 200 max turns as well, both on my local machine.

It is possible there is a faster way to do this, maybe with a multithread-friendly tree, this was a quick and simple way to get a good performance boost.

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.

2 participants