MCX not deterministic

49 views
Skip to first unread message

kris.dre...@gmail.com

unread,
Oct 14, 2021, 6:06:57 AM10/14/21
to mcx-users
Dear Qianqian,

I stumbled upon a non-deterministic behavior of MCX although I used the same RNG seed. As far as I understand, simulations should be exactly reproducible as long as the same RNG seed is used.

I attached an image with two simulations where the same RNG seed was used and their difference. I also provided a link to a python script to reproduce the problem. (I didn't find another way to attach the python script directly.) You can just insert the absolute path to an mcx binary and the script can be executed.

Best,
KrisDifference_with_same_RNG_seed.png

Qianqian Fang

unread,
Oct 14, 2021, 7:50:26 AM10/14/21
to mcx-...@googlegroups.com, kris.dre...@gmail.com
On 10/14/21 6:06 AM, kris.dre...@gmail.com wrote:
Dear Qianqian,

I stumbled upon a non-deterministic behavior of MCX although I used the same RNG seed. As far as I understand, simulations should be exactly reproducible as long as the same RNG seed is used.


hi Kris

exact reproducibility has not been a guarantee on the GPU, it just happened that NVIDIA GPUs gives "nearly" repeatable results (likely due to a stable thread scheduling logic), but results between different cards and different thread/block numbers have not been repeatable in general.

see more on this in this reply

https://groups.google.com/g/mcx-users/c/PWa3B-7uwGE/m/4g6KVqs_CQAJ


if you want to see exactly repeatable results, you will have to do either


1. limit the total thread number to be exactly one block (such as -T 32 -t 32), or

2. saving all RNG seeds using -q and then rerun the simulation in replay mode (-E file.mch)


the behavior within each thread is deterministic if the RNG seed is given, but the non-repeatability comes from random thread orders when perform accumulations in a multi-threaded environment.


hope this makes sense.

Qianqian



I attached an image with two simulations where the same RNG seed was used and their difference. I also provided a link to a python script to reproduce the problem. (I didn't find another way to attach the python script directly.) You can just insert the absolute path to an mcx binary and the script can be executed.

Best,
KrisDifference_with_same_RNG_seed.png
--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/1b56a765-800f-4be6-8827-06728a8e85ebn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages