From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8CAAE3858021; Sat, 12 Dec 2020 23:55:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CAAE3858021 From: "damian at sourceryinstitute dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98253] Conflicting random_seed/random_init results Date: Sat, 12 Dec 2020 23:55:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: damian at sourceryinstitute dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2020 23:55:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98253 Damian Rouson changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|WAITING |RESOLVED --- Comment #8 from Damian Rouson --- Steve, one more question. How do you interpret the second sentence in the = text that I originally quoted: "In each execution of the program with the same execution environment, if the invoking image index value in the initial tea= m is the same, the value for PUT shall be the same." This is in 16.9.155 Case (= i) describing the relationship between random_init and random_seed. I origina= lly interpreted this quote to mean that each image would use the same seed each time the program runs, which would be a constraint on the PRNG. I'm now thinking that the reference to PUT implies that the user is setting the seed and this is saying that the program must set the same seed each a given ima= ge executes, but that seems like an odd constraint so I'm probably still horri= bly confused. Feel free to mark this issue as invalid if this is starting to s= eem like a waste of time. I'm just trying to understand. Either way, an image number is defined for all programs whether or not there are coarrays anywhere in the program and whether or not the program is ever executed in multiple images -- for example, this_image() is just an intrins= ic function rather than a (hypothetical) "coarray" intrinsic function. This p= oint is most meaningful with a compiler like the Cray compiler, which requires no special flags to compile a program that invokes this_image(). In some sens= e, all Fortran programs are now parallel programs whether the user takes advan= tage of that fact in any explicit way or not. I suspect that's the reason that IMAGE_DISTINCT is not optional. Possibly the committee deemed it better to require users to specify the desired behavior in multi-image execution. Even libraries that were never designed in any way to exploit parallelism can be linked into parallel programs so it seems better to have developers of such= a library specify the desired behavior if their code is ultimately linked int= o a parallel program -- analogous to requiring that code be thread-safe even if= the code makes no explicit use of multi-threading.=