Dear Dr. Fang,
I have some questions about the RNGSeed parameter, is it correct that for values greater than 2^31 are all RNGSeed will generate the same results? (see figures below). And how does the size of RNGSeed affect the randomness of the simulations?
According to documentation on Monte Carlo eXtreme: GPU-based Monte Carlo Simulations: Doc/mcx help it has to be a large positive integer to get reproducible results. But it does not give within which range it has to be.In this group on the RNGSeed I found: "it is a 32-bit integer (if set to 0 or a negative value, mcx will use system clock as the seed), you are recommended to set it to a big positive number (so that every bit is randomized). explicitly setting to a big positive integer has the benefit of creating somewhat reproducible results, but setting to 0 or negative value can not do the same."
Is it correct to interpret this as to get reproducible results RNGSeed has to be a positive integer between 1 and 2^(32-1) (recommended to set it to a big positive number so that every bit is randomized)?
yes this is still correct.
To check this I did some simulations with 100 photons with mua=mus=0, n=1 and g=1 where I saved the seeds (' -w spxv --saveseed 1 -F jnii -E 2147483651 --bc ______000001 ')With as resulting photon seeds for the different RNGSeed
please note that exact reproducibility is not guaranteed for a
multi-threaded environment. however, in your test case, if you
only run 100 photons, it is likely every thread only need to run a
single photon, therefore, the RNG seed will be the initial seed
generated on the CPU (host), which is based on libc's RNG function
and is supposed to be exactly reproducible.
what if you change -E 2147483651 to something a little bit
smaller? say remove the leading number 2 and make it 8 digit?
Kind Regards,Gijs Buist
--
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/7ba1be84-6339-4c34-81eb-b6281dce1664n%40googlegroups.com.
Dear Qianqian,
Thanks for the quick reaction. I want to be sure that I understood what you said, is it correct that:
RNGSeed is used to generate a seed for each photon that will be launched. These photon seeds together with the simulation parameters ( volume, optical properties, flags) will determine the photons interaction. Reruns use saved photon seeds to reproduce the photon interactions of each photon seed exactly. However it is not guaranteed that the same RNGSeed will reproduce the same photon seeds if the number of photons is greater than the number of threads. This is because the timing (sequencing) of when which threads are done and will need a new photon seed is impossible to control and keep constant.
Also I have a second question. From the sentence that said that RNGSeed is a 32-bit integer I had understood that RNGSeed has to be between 1 and 2^32. But from simulations I did I noticed that simulations with RNGSeed > 2^31 gave the exact same number of detected photons while different RNGSeeds where used (51 different RNGSeed with RNGSeed >2^31 gave same number of detected photons). I therefore did runs while saving the photon seeds as described in my first message. I did 4 runs with different RNGSeed with RNGSeed <2^31 and 4 with different RNGSeed and RNGSeed >2^31. The results can be seen in the attached figures, which show that for the RNGSeed <2^31 we get different photon seeds for every RNGSeed while for RNGSeed >2^31 we get the exact same photon seeds. Now my question is: what is the range of RNGSeed to get as reproducible results as possible while different RNGSeed result in calculating different realisations?
Finally I noticed that others have used 128-bit integers RNGSeed. How does this affect the simulations?
Thanks in advance.
Regards,
Gijs Buist
From: 'Qianqian Fang' via mcx-users <mcx-...@googlegroups.com>
Sent: dinsdag 29 november 2022 18:06
To: mcx-...@googlegroups.com
Subject: Re: [mcx-users] RNGSeed input reproducible runs
see my comments below
On 11/29/22 07:36, 'G Buist' via mcx-users wrote:
Dear Dr. Fang,
I have some questions about the RNGSeed parameter, is it correct that for values greater than 2^31 are all RNGSeed will generate the same results? (see figures below). And how does the size of RNGSeed affect the randomness of the simulations?
According to documentation on Monte Carlo eXtreme: GPU-based Monte Carlo Simulations: Doc/mcx help it has to be a large positive integer to get reproducible results. But it does not give within which range it has to be.
In this group on the RNGSeed I found: "it is a 32-bit integer (if set to 0 or a negative value, mcx will use system clock as the seed), you are recommended to set it to a big positive number (so that every bit is randomized). explicitly setting to a big positive integer has the benefit of creating somewhat reproducible results, but setting to 0 or negative value can not do the same."
Is it correct to interpret this as to get reproducible results RNGSeed has to be a positive integer between 1 and 2^(32-1) (recommended to set it to a big positive number so that every bit is randomized)?
yes this is still correct.
To check this I did some simulations with 100 photons with mua=mus=0, n=1 and g=1 where I saved the seeds (' -w spxv --saveseed 1 -F jnii -E 2147483651 --bc ______000001 ')
With as resulting photon seeds for the different RNGSeed
please note that exact reproducibility is not guaranteed for a multi-threaded environment. however, in your test case, if you only run 100 photons, it is likely every thread only need to run a single photon, therefore, the RNG seed will be the initial seed generated on the CPU (host), which is based on libc's RNG function and is supposed to be exactly reproducible.
what if you change -E 2147483651 to something a little bit smaller? say remove the leading number 2 and make it 8 digit?
Kind Regards,
Gijs Buist
--
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/7ba1be84-6339-4c34-81eb-b6281dce1664n%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "mcx-users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/mcx-users/E9VgPb4q62M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
mcx-users+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mcx-users/cc9fe1b3-2e25-7768-b17a-1b4640aef134%40neu.edu.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/AM0PR09MB27855C7CBBC2D4A4324795F7E5159%40AM0PR09MB2785.eurprd09.prod.outlook.com.