-
Notifications
You must be signed in to change notification settings - Fork 137
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
random_seed intrinsic errors for certain seed values #691
Comments
kiranchandramohan
added a commit
to kiranchandramohan/flang
that referenced
this issue
Apr 5, 2019
This patch fixes setting random seeds when seeds are large and has zeroes in their least significant 23 bits. Fixes flang-compiler#691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
kiranchandramohan
added a commit
to kiranchandramohan/flang
that referenced
this issue
Apr 5, 2019
This patch fixes setting random seeds when seeds are large and has zeroes in their least significant 23 bits. Fixes flang-compiler#691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
kiranchandramohan
added a commit
to kiranchandramohan/flang
that referenced
this issue
Apr 5, 2019
This patch fixes setting random seeds when seeds are large and has zeros in their least significant 23 bits. Fixes flang-compiler#691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
kiranchandramohan
added a commit
to kiranchandramohan/flang
that referenced
this issue
Jun 14, 2022
This patch fixes setting random seeds when seeds are large and has zeros in their least significant 23 bits. Fixes flang-compiler#691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
kiranchandramohan
added a commit
to kiranchandramohan/flang
that referenced
this issue
Jun 15, 2022
This patch fixes setting random seeds when seeds are large and has zeros in their least significant 23 bits. Fixes flang-compiler#691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
pawosm-arm
pushed a commit
that referenced
this issue
Jun 15, 2022
This patch fixes setting random seeds when seeds are large and has zeros in their least significant 23 bits. Fixes #691 Change-Id: If532da3159997a4ddbecd20f388a5e6280bc1012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We observed recently that the random_seed intrinsic function errors out when certain seed values are used. By looking at the relevant code it was found that only the least significant 23 bits of the seed is used and if it happens to be 0 then an Error is generated.
This restriction of using only the least significant 23 bits is not mentioned in the PGI compiler's documentation, nor is it mentioned in the Error produced. Browsing through the old PGI fortran documentation it was observed that the following statement was present till the 2011 release but dropped from the 2012 release. It specifically talks about using the least significant 23 bits. Also, there is a mention about integer sizes of some platforms which are probably not valid for Flang.
https://www.pgroup.com/doc/pgi11fortref.pdf
https://www.pgroup.com/doc/pgi12fortref.pdf
"The random number intrinsic generates a 46 bit lagged fibonacci pseudo-random sequence with a short lag of 5 and a long lag of 17. For a given seed, including the default seed, the sequence generated is independent of the platform and number of processors. Due to limitations of some platforms' default integer type, the seed vector is of size 34. Only the least significant 23 bits of each element of the seed array are used, thus a seed array returned or used is portable between platforms. For non-degenerate seed arrays, the period of this generator is (217 - 1) * 245. If all the odd elements of the seed array are even, the period will be shorter."
Reproducer and output observed are given below.
Reproducer
Output
The text was updated successfully, but these errors were encountered: