maxpumperla / deep_learning_and_the_game_of_go

Code and other material for the book "Deep Learning and the Game of Go"

Home Page:https://www.manning.com/books/deep-learning-and-the-game-of-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any methods to speed up mcts?

computer-idol opened this issue · comments

when I run mcts,the speed is a little slow,9*9board can only simulate 500 games in 15 seconds. In my go playing website, I have to decrease the number of simulated games so that can receive response in limited time,but the level is also decreased.Is it possible to implement the parallel mcts?

@computer-idol I agree, our implementation isn't optimized for speed at all, rather for educational clarity (or so we hope). If you want to help implementing a parallel version, that'd be cool! I assume that wouldn't be too hard. You could start by looking at the multiprocessing routines we used for processing the boards. I would love to look at this myself, but frankly don't have the time right now.

Hey @computer-idol, I actually put together a C++ implementation of the GoBoard / GameState library (with Python wrapper). It's a LOT faster than the pure Python version in the book. On my laptop on a 9x9, it can simulate about 10000 games in 15 seconds. So something like 10x - 20x speedup from the book version.

I think the library fully works, but it is not fully documented and packaged yet. But if you have some patience to try building it from source, give it a try!

https://github.com/macfergus/baduk

also, on the subject of parallel MCTS, it turns out to be fairly complicated, see this paper for an overview of the some of the options and tradeoffs:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.159.4373&rank=1

That paper was written about classical MCTS (random rollouts). With deep learning MCTS (value network), you have an additional problem where if you do two rollouts in parallel, they will give you the exact same result! So some of the methods described in the linked paper don't work at all for deep learning + MCTS, but something like the "virtual losses" method should be possible.

@macfergus wonderful!! I will try soon.

@macfergus, I have bulid and run baduk successfully through mysy2,but I don't know how to use the library in windows,the import is no use.
image
image