To: J3 J3/18-205r1 From: Steve Lionel & Dan Nagle & John Reid Subject: Response to DIS comments GB043, 044, 045 (RANDOM_INIT) Date: 2018-June-13 Reference: 18-007,14-184r4 Discussion ---------- DIS comment GB043 says: "Subclause 16.7, para 4 says "It is processor dependent whether each image uses a separate random number generator, or if some or all images use common random number generators." We believe that the reason for this wording is to allow implementations to use a separate seed on each image, a single seed on each set of images (perhaps those on single nodes) or a single seed on all images (perhaps on a shared-memory machine with a modest number of images). The present wording for IMAGE_DISTINCT makes sense only for the case of a separate seed on each image - which image of a set sharing a seed calls RANDOM_INIT has no bearing. Does a single call of RANDOM_INIT initialize all the seeds? The a current wording suggests that only one seed is initialized. Subclause 16.7, para 4 also says "If RANDOM_INIT or RANDOM_SEED is called in a segment A, and RANDOM_INIT, RANDOM_SEED, or RANDOM_NUMBER is called in segment B, then segments A and B shall be ordered." If only one seed is initialized, the calls must be in a CRITICAL construct or its equivalent, which would be very inefficient. It would be much better to say that a single call initializes all the seeds and that it does not matter which image makes the call." After extensive discussion, JOR recognizes that the current definition of RANDOM_INIT is unworkable. Edits are supplied that provide the following: - Each image in a team that wishes to "participate" in a shared behavior of RANDOM_NUMBER must call RANDOM_INIT with the same values for its arguments. In this sense it is similar to a collective subroutine. - All words that relate to implementation details ("seed" or "common generator" are removed. Instead the text describes the sequences obtained by calls to RANDOM_NUMBER after RANDOM_INIT is called. A processor may choose to use a common generator in the cases where REPEATABLE is false, but a program has no way of detecting this. - The text in 16.7 about image segment ordering is removed, as it is no longer relevant. Comment GB044 says: "In the definition of argument REPEATABLE, the last sentence says "If it has the value false, the seed is set to a processor-dependent, unpredictably different value on each call." The inclusion of the word "unpredictably" has the effect of forbidding a vendor from documenting how their pseudorandom number generator works. We believe that this was not intended. " JOR does not agree with this interpretation, and believes no such restriction is implied. Comment GB045 says: "In the current definition [of the argument REPEATABLE], it is unclear whether the value of the seed is the same only for the current execution or is repeatable over different runs on the same processor with the same number of images. We think the latter was intended, which is very useful when testing or verifying code." We agree that this was the intention, but there remains the possibility that changes in the execution environment may affect the sequence. An edit and a note are added to address this. Edits ----- 16.7p4, page 348 Standard Generic Intrinsic procedures Replace the paragraph "If RANDOM_INIT ... generators" with: "The pseudorandom number generator on each image has a state independent of the state of that on any other image. References to RANDOM_INIT, RANDOM_NUMBER, and RANDOM_SEED may update this state and no other image's pseudorandom number generator's state. The state is the sole determiner, per image, of the sequence of pseudorandom numbers generated." 16.9.155p3, page 416, RANDOM_INIT (Arguments) In the description of REPEATABLE, replace the text "If it has the value ... on each call." with: "If it has the value true, subsequent calls to RANDOM_NUMBER in the current image will generate the same sequence of pseudorandom numbers each time RANDOM_INIT is called for a given number of images in the current team. If it has the value false, subsequent calls to RANDOM_NUMBER will select from an unpredictably different sequence after each call to RANDOM_INIT." In the description of IMAGE_DISTINCT, replace the text "If it has the value true ... calls RANDOM_INIT." with: "If it has the value true, subsequent calls to RANDOM_NUMBER in the current image will produce a sequence of pseudorandom numbers that is dependent on the image index of the current image. If it has the value false, subsequent calls to RANDOM_NUMBER in the current image will select from a sequence of pseudorandom numbers that does not depend directly on the image index of the current image." 16.9.155p4, page 416, RANDOM_INIT (Example) In paragraph 4 (Example) replace the sentence by "The following statement initializes the pseudorandom number generator of the current image so that the pseudorandom number sequence is different from those established by earlier calls to RANDOM_INIT and depends on the image index of the current image." After paragraph 4, add a note: "Changes in a program's execution environment may affect the repeatability of pseudorandom number sequences established by a call to RANDOM_INIT." 16.9.156p3, Page 416, RANDOM_NUMBER (Arguments) In the description of HARVEST delete the last sentence "If images use . . . processor dependent." [535] A.2p1, page 535, Processor Dependencies Delete the bullet "on images that use . . . unordered segments (16.7)." ==END==