public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Jerry DeLisle <jvdelisle@charter.net>
Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Implementation of RANDOM_INIT from F2018
Date: Tue, 09 Jan 2018 03:21:00 -0000	[thread overview]
Message-ID: <20180109032118.GA24781@troutmask.apl.washington.edu> (raw)
In-Reply-To: <02449bbc-b42b-371a-74b7-fbef6c8562f9@charter.net>

On Mon, Jan 08, 2018 at 06:51:06PM -0800, Jerry DeLisle wrote:
> On 01/08/2018 04:58 PM, Steve Kargl wrote:
> > On Sun, Jan 07, 2018 at 06:52:22PM -0800, Steve Kargl wrote:
> >>
> >> I have zero knowledge about co-arrays and especially zero
> >> knowledge about gfortran internals for co-arrays.  I'm
> >> disinclined to waste another 12 hours trying to get gfortran
> >> to emit essentially a call to this_image().  See iresolve.c
> >> for details.
> >>
> > 
> > An epiphany came to me last night, which has led to the attach
> > patch.  This patch should be a complete implementation of
> > RANDOM_INIT.
> > 
> > RANDOM_INIT takes two LOGICAL, INTENT(IN) arguments.  To 
> > avoid library bloat, these arguments are converted/casted to
> > LOGICAL(4) in trans-intrinsic.c (conv_intrinsic_random_init).
> > It is also in this function, that I set up the hidden argument
> > that is needed to hopefully give standard conforming behavior
> > when co-arrays are involved.  I, however, cannot test -fcoarray=lib
> > situation.  I would appreciate feedback from a co-array user.
> > 
> > Boostrapped and regression tested on x86_64-*-freebsd.
> > OK to commit?
> > 
> 
> Yes, Looks good Steve.  So all we need is a run test with actual =lib case.
> 

Yes.  If someone adds this to a program that creates two
images, and each image executes foo

subroutine foo
   character(len=10) name
   real x(2)
   integer fd
   write(name,'(A,I0)') 'dat', this_image()
   call random_init(repeatable=.true., image_distinct=.true.)
   call random_number(x)
   open(newunit=fd,file=name)
   write(fd,*) x
   close(fd)
end program  

then dat0 and dat1 will contain distinct numbers, and everytime
the program executes the new dat0 and new dat1 should match the
old dat0 and dat1.

If repeatable=.false., then dat0 and dat1 will still be distinct
sequences.  Repeated execution of the program will cause the new
dat0 and new dat1 to not match the old dat0 and old dat1.

-- 
Steve

  reply	other threads:[~2018-01-09  3:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08  2:52 Steve Kargl
2018-01-09  0:58 ` Steve Kargl
2018-01-09  1:33   ` Damian Rouson
2018-01-09  2:03     ` Steve Kargl
2018-01-09 23:33       ` Damian Rouson
2018-01-10  1:10         ` Steve Kargl
2018-01-12  0:54           ` Steve Kargl
2018-01-12  3:11             ` Damian Rouson
2018-01-12  4:17               ` Steve Kargl
2018-01-12  5:52                 ` Damian Rouson
2018-01-12  6:57                   ` Steve Kargl
2018-01-16 20:30                 ` Damian Rouson
2018-01-09  2:51   ` Jerry DeLisle
2018-01-09  3:21     ` Steve Kargl [this message]
2018-01-09 17:11     ` Steve Kargl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109032118.GA24781@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jvdelisle@charter.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).