|
From: | Philippe Michel |
Subject: | Re: [Bug-gnubg] Threaded rollouts and RNGs |
Date: | Tue, 7 Feb 2017 23:34:33 +0100 (CET) |
User-agent: | Alpine 2.20 (BSF 67 2015-01-07) |
On Wed, 1 Feb 2017, Øystein Schønning-Johansen wrote:
The rollout code in GNU Backgammon is of course threaded. How is this threaded actually? Is it threaded on each sample (aka each game). One thread pr. game? Or one thread pr. evaluation? Or?
I'm not sure I really understand how it is done, but the threads are fed with tasks and for a rollout I think a task is one playout of a candidate move. If some candidates are stopped on a standard deviation criteria, the others are then processed faster.
I just wrote a code that does a threaded MC simulation of a different problem, and I noticed that I got significantly different results depending on either I used threading or not. Funny thing, it didn't initially occur to me, but of course I need one separate RNG instance for each thread. Fixing that didn't only give me the right results of the simulation, but it also improved the performance. How about GNU Backgammon? Do you use one separate RNG instance for each thread?
This is the principle, but it is complicated by the need to have each dice combination appear once for every 36 rolls.
Moreover, the UI is quite fragile since one can set the rng to something not thread-safe like "file" or "random.org". The defaut mersenne rng is ok, though. With it, for a given position and seed, the result is the same for any numbers of threads.
[Prev in Thread] | Current Thread | [Next in Thread] |