-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-Uniform Photon Launch Distributions from Sources #31
Comments
this issue was originally reported in this mailing list thread back in April, 2016 https://groups.google.com/forum/#!topic/mcx-users/nRcAkZbvBaI and was recently encountered again by @jbfborg. The reported artifacts are similar, and later identified as not specific to disk sources. |
@jbfborg, I just want you to know that the reported issue was identified and a fix was committed. it turns out that the cause of the issue was due to the low precision of the CPU (host) random number generator (RNG) on Windows. the default Windows c-library rand() function is only a 15bit RNG. The low-precision makes the initial RNG states, provided by the CPU RNG, containing lots of 0s (particularly, the random number seeds from the host - unsigned integer of 32 bits - has 0 for the high 17 bits, and only the low 15bits are random). This is not an issue on Linux and Mac because the default rand() is a 31bit RNG. I verified this by compiling the debug version of mcx using
and then run one of the benchmarks using the debug binary:
the printed RNG random state vector (two 64bit integers for the default xorshift128+ RNG) shows a lot of zeros, for example:
you can see only the lower 4 letters are nonzero (in each 32bit segment of the 64bit RNG states). In comparison, on Linux, this prints as
the low-precision rand() was actually reported in many places, and has caused problems in other projects, for example https://www.csie.ntu.edu.tw/~cjlin/liblinear/FAQ.html#windows_binary_files In the below fix, I used the approach in this post cjlin1/liblinear#28 (review) now running mcxlab/mcx on Windows no longer has these artifacts. |
Hello Dr. Fang,
I have noticed that I am having an artifact occur when running a low scattering, Beer's law validation on mcxlab using Windows 10, NVIDIA GTX 1060, cuda 9.1, MATLAB R2017a. This artifact shows a non-uniform distribution of photons from the source when using a disk or Gaussian source (and a planar-like source based on your own diagnostics). Below is your diagnosis of the problem:
In the attached .zip file is the MATLAB code I have been using, as well as the raw results generated and some images of the fluence distribution.
Thank you for looking into this problem.
Best regards,
Jeremy
testMCX.zip
The text was updated successfully, but these errors were encountered: