ujh / iomrascalai

Iomrascálaí is an AI for the game of Go/Weiqi/Baduk written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move prior calculation into a separate thread

ujh opened this issue · comments

The updating of the tree and there especially the prior calculation seems to be a big bottleneck. Maybe moving the calculation of the priors into a separate thread (or several) could help. Obviously it's not clear if that will even increase the number of playouts as this other thread will steal resources from the threads that are doing the playouts. Also selecting nodes while the priors aren't set yet may have unintended consequences as well.

As for the concrete idea:

  1. Pick a leaf to expand and just set the neutral prior
  2. Push the playout to one of the worker threads (same as before)
  3. Push calculation of the priors to another worker (new code)
  4. Update the tree with the result from the playout (same as before)
  5. Update the tree with the result from the prior calculation (new code)

Done with #275.