public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH,Fortran] Improve PRNG jumping when using threads
Date: Wed, 04 Sep 2019 21:02:00 -0000	[thread overview]
Message-ID: <20190904210218.GA89799@troutmask.apl.washington.edu> (raw)
In-Reply-To: <20190904120926.16851-1-blomqvist.janne@gmail.com>

On Wed, Sep 04, 2019 at 03:09:26PM +0300, Janne Blomqvist wrote:
> Currently, when a new thread needs to use the RANDOM_NUMBER intrinsic,
> the per-thread PRNG state is initialized by copying the master state
> and then jumping forwards N*2**128 entries in the stream so that the
> PRNG streams for different threads don't alias each other, where N is
> the number of threads that have so far initialized the PRNG.
> 
> With this patch the master state itself is jumped forwards once each
> time a new thread initializes the PRNG, thus obviating the need to
> jump through all the N-1 previous streams. Effectively turning an O(N)
> algorithm into an O(1) one.
> 
> Regtested on x86_64-pc-linux-gnu, Ok for trunk?
> 

Ok.

-- 
Steve

      reply	other threads:[~2019-09-04 21:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 12:09 Janne Blomqvist
2019-09-04 21:02 ` Steve Kargl [this message]

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=20190904210218.GA89799@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).