public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Richard Thomas <paul.richard.thomas@gmail.com>
To: Richard Biener <rguenther@suse.de>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
	Steve Kargl <sgk@troutmask.apl.washington.edu>,
	 "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR37336 finalization
Date: Thu, 9 Mar 2023 12:43:41 +0000	[thread overview]
Message-ID: <CAGkQGiKF+ep=v=gzr4o586Fs0J9QBr0jA4E=bvbHbBC-W7RADg@mail.gmail.com> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2303090815450.18795@jbgna.fhfr.qr>

[-- Attachment #1: Type: text/plain, Size: 4011 bytes --]

Hi Richard,

Good spot! -fdefault-integer-8 does indeed fix the problem with rnflow.f90
but breaks tfft2.f90, with a type mismatch at lines 36 and 44.

      integer(8), parameter   :: jmul =  843314861  ! multiplicateur
      integer(8), parameter   :: jadd =  453816693  ! constante additive
Does the job and is portable.

With pr37336 patch applied:

Date & Time     :  9 Mar 2023 11:33:31
Test Name       : gfor_13
Compile Command : gfc13 -ffast-math -funroll-loops -O2 %n.f90 -o %n
Benchmarks      : ac aermod air capacita channel2 doduc gas_dyn2 fatigue2
induct2 linpk mp_prop_design nf protein rnflow test_fpu2 tfft2
Maximum Times   :    10000.0
Target Error %  :      0.100
Minimum Repeats :     1
Maximum Repeats :     2

   Benchmark   Compile  Executable   Ave Run  Number   Estim
        Name    (secs)     (bytes)    (secs) Repeats   Err %
   ---------   -------  ----------   ------- -------  ------
          ac      0.00       51720      7.78       2  0.0000
      aermod      0.00     1079416     10.35       2  0.1642
         air      0.00       87096      3.66       2  0.1230
    capacita      0.00       65936     22.88       2  0.0153
    channel2      0.00       39832     92.17       2  0.4410
       doduc      0.00      182104     14.55       2  0.2509
    gas_dyn2      0.00       91784    182.65       2  0.8576
    fatigue2      0.00       86496     95.72       2  0.7182
     induct2      0.00      183824    100.85       2  0.0084
       linpk      0.00       43576      6.19       2  0.4442
mp_prop_desi      0.00       48376     94.72       2  0.4276
          nf      0.00       52192      9.84       2  0.1321
     protein      0.00      128248     22.06       2  0.0476
      rnflow      0.00      136296     25.99       2  0.0462
   test_fpu2      0.00      106232     82.97       2  0.0042
       tfft2      0.00       35608     47.94       2  0.7071

Geometric Mean Execution Time =      28.68 seconds

I think that the PR can be closed.

Cheers

Paul



On Thu, 9 Mar 2023 at 08:18, Richard Biener <rguenther@suse.de> wrote:

> On Wed, 8 Mar 2023, Thomas Koenig wrote:
>
> > On 08.03.23 15:55, Paul Richard Thomas via Fortran wrote:
> > > As noted below, rnflow.f90 hangs with the unpatched mainline at -O3 but
> > > runs successfully at -O2.
> >
> > I can confirm that.
> >
> > > I presume that this is a serious regression since it involves
> optimization?
> > > Which component should I post it against?
> >
> > Probably against tree-optimization.  If later analysis determines that
> > it is something else, people will reassign it.
> >
> > This one probably calls for bisection.
>
> I have the following local change to rnflow with that I can't reproduce:
>
> --- rnflow.f90.orig     2016-06-01 14:50:16.922376347 +0200
> +++ rnflow.f90  2016-06-01 14:56:54.739045162 +0200
> @@ -884,6 +884,7 @@
>  !     generation maison d'une valeur pseudo-aleatoire uniforme sur (0,1)
>  !
>        integer, intent (inout) :: jsee               ! germe courant
> +      integer(kind=8) :: jsee_long
>        integer, parameter   :: jmul =  843314861     ! multiplicateur
>        integer, parameter   :: jadd =  453816693     ! constante additive
>        integer, parameter   :: j230 = 1073741824     ! 2 puissance 30
> @@ -899,7 +900,9 @@
>  !CRAY - The following multiply must be done with 64 bits (not 46 bits)
>  !       The algoritm depends on the overflow characteristics of
>  !       a 32 or 64 bit multiply.
> -      jsee = jsee * jmul + jadd
> +      jsee_long = jsee;
> +      jsee_long = jsee_long * jmul + jadd
> +      jsee = jsee_long;
>  !CRAY - Change to avoid 32 bit integer dependency
>        !
>        !  The original line is needlessly dependent on the
>
> the existing comment already explains the issue.  I suppose
> -fdefault-integer-8 would also work around the issue?
>
> ISTR there is an old (closed invalid) bugreport about this as well.
>
> Richard.
>


-- 
"If you can't explain it simply, you don't understand it well enough" -
Albert Einstein

  reply	other threads:[~2023-03-09 12:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 13:45 Paul Richard Thomas
2023-03-07 14:58 ` Thomas Koenig
2023-03-07 17:15   ` Steve Kargl
2023-03-08  7:32   ` Paul Richard Thomas
2023-03-08  8:05     ` Thomas Koenig
2023-03-08  8:14       ` Richard Biener
2023-03-08  8:55         ` Thomas Koenig
2023-03-08  9:10           ` Richard Biener
2023-03-08 12:27             ` Paul Richard Thomas
2023-03-08 10:28           ` Tobias Burnus
2023-03-08  9:14       ` Paul Richard Thomas
2023-03-08  9:21         ` Richard Biener
2023-03-08 14:55           ` Paul Richard Thomas
2023-03-08 14:57             ` Richard Biener
2023-03-08 21:35             ` Thomas Koenig
2023-03-09  7:13               ` Thomas Koenig
2023-03-09  8:32                 ` Richard Biener
2023-03-09  8:18               ` Richard Biener
2023-03-09 12:43                 ` Paul Richard Thomas [this message]
2023-03-09 17:30                   ` Thomas Koenig
2023-03-10  3:56                     ` Jerry D
2023-03-10 16:49                     ` Paul Richard Thomas
2023-03-15  7:29                       ` Paul Richard Thomas
2023-03-15  7:37                         ` Richard Biener
2023-03-16  7:20                           ` Paul Richard Thomas
2023-03-09 15:05                 ` Steve Kargl
2023-03-08 15:12     ` Steve Kargl
2023-03-08 15:29       ` Andrew Benson
2023-03-08 16:29       ` Tobias Burnus
2023-03-08 17:12         ` Paul Richard Thomas
2023-06-02 13:42 ` Paul Richard Thomas
2023-06-03  5:50   ` Thomas Koenig
2023-06-03  7:32     ` Steve Kargl
2023-06-03 13:16     ` Paul Richard Thomas
2023-06-03 19:10       ` Harald Anlauf
2023-06-03 19:22       ` Thomas Koenig

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='CAGkQGiKF+ep=v=gzr4o586Fs0J9QBr0jA4E=bvbHbBC-W7RADg@mail.gmail.com' \
    --to=paul.richard.thomas@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=sgk@troutmask.apl.washington.edu \
    --cc=tkoenig@netcologne.de \
    /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).