Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

You're dead, Jim. -- McCoy, "Amok Time", stardate 3372.7


devel / comp.lang.fortran / Re: gfortran flags vs pgf95 flags

SubjectAuthor
* gfortran flags vs pgf95 flagsPhilip Massey
`* Re: gfortran flags vs pgf95 flagsThomas Koenig
 `- Re: gfortran flags vs pgf95 flagsPhilip Massey

1
gfortran flags vs pgf95 flags

<27235fc9-90c1-47bd-a7d0-27295090da80n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3658&group=comp.lang.fortran#3658

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:20af:b0:66c:ff64:a230 with SMTP id 15-20020a05621420af00b0066cff64a230mr253242qvd.6.1698165159440;
Tue, 24 Oct 2023 09:32:39 -0700 (PDT)
X-Received: by 2002:a05:6808:3605:b0:3b2:e7a9:1013 with SMTP id
ct5-20020a056808360500b003b2e7a91013mr4865184oib.3.1698165159265; Tue, 24 Oct
2023 09:32:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 24 Oct 2023 09:32:38 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=207.192.243.66; posting-account=oZINDgkAAADBOdyMxT3ow977E_hOlIxJ
NNTP-Posting-Host: 207.192.243.66
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <27235fc9-90c1-47bd-a7d0-27295090da80n@googlegroups.com>
Subject: gfortran flags vs pgf95 flags
From: massey@lowell.edu (Philip Massey)
Injection-Date: Tue, 24 Oct 2023 16:32:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: Philip Massey - Tue, 24 Oct 2023 16:32 UTC

I’m running some stellar atmosphere code on a Mac. When the code is compiled with the pgf95 compiler using the flags -mp -Mlarge_arrays -O2 -fast -Mconcur
it takes about 3 hours to run.

When I compile the same code using gfortran and the switches
-O2 -fopenmp -m64
it takes about 5 hours to run.

In both cases I’m running nominally on 4 cores, although the gfortran compilation may not
be fully utilizing them based on what I see using “top”.

I’d appreciate any suggestions. The “-fast” in pgf95 seems to do a lot of good things, but I can’t seem to identify anything analogous in gfortran. Thanks for any advice.

Re: gfortran flags vs pgf95 flags

<uh8tmo$24jav$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3659&group=comp.lang.fortran#3659

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-e676-0-6fde-15c3-e164-6356.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: gfortran flags vs pgf95 flags
Date: Tue, 24 Oct 2023 17:08:40 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <uh8tmo$24jav$1@newsreader4.netcologne.de>
References: <27235fc9-90c1-47bd-a7d0-27295090da80n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 24 Oct 2023 17:08:40 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-e676-0-6fde-15c3-e164-6356.ipv6dyn.netcologne.de:2001:4dd7:e676:0:6fde:15c3:e164:6356";
logging-data="2248031"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 24 Oct 2023 17:08 UTC

Philip Massey <massey@lowell.edu> schrieb:
> I’m running some stellar atmosphere code on a Mac.

Which type? Apple Silicon or x86? (I'm not sure that Apple
Silicon is officially supported yet).

Which version of gfortran?

> When the code is compiled with the pgf95 compiler using the flags -mp -Mlarge_arrays -O2 -fast -Mconcur
> it takes about 3 hours to run.
>
> When I compile the same code using gfortran and the switches
> -O2 -fopenmp -m64
> it takes about 5 hours to run.

A significant difference, but this is not unheard of.

A few suggestions:

Upgrade to a newer version, if possible (the lastest release
gfortran 13.2).

For time-critical code use at least -O3 -march=native -mtune=native

If you call a lot of procedures from other places, try -flto.
This will expose a lot of optmiization opportunities. It will also
make your compilations much longer, but for your calculation times,
that may still be a win.

You could also try out -ffast-math, but if your code requires any
guarantees on numerical rearrangement or accuracy, then this option
could impact it negatively. You could also try out the indiviual
gcc flags controlling numerics to see if they make a difference.

-Ofast also includes -ffast-math, plus it does some other things;
it can also increase your stack usage, and you could get seemingly
random crashes. This is a known problem from measly maximum
allocation for openmp threads on MacOS.

There are also options for less accurate calculation of square
roots, but if these help (and their large inaccuracy does not
disturb you) this may be worth looking into.

> In both cases I’m running nominally on 4 cores, although the gfortran compilation may not
> be fully utilizing them based on what I see using “top”.

Can't speak to that.

> I’d appreciate any suggestions. The “-fast” in pgf95 seems to do a lot of good things, but I can’t seem to identify anything analogous in gfortran. Thanks for any advice.

Well, -ffast-math does some things that are rightly considered
bad in some use cases, and are considered good (increases speed
and does not negatively impact correctness) in others. I would
not recommend using it without some thought.

Re: gfortran flags vs pgf95 flags

<6882cb61-40ab-407e-bd7e-b659f7f9e076n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=3660&group=comp.lang.fortran#3660

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:1790:b0:66d:393:bf0e with SMTP id ct16-20020a056214179000b0066d0393bf0emr207718qvb.9.1698167959312;
Tue, 24 Oct 2023 10:19:19 -0700 (PDT)
X-Received: by 2002:a05:6808:1484:b0:39c:a74b:81d6 with SMTP id
e4-20020a056808148400b0039ca74b81d6mr4842548oiw.7.1698167959137; Tue, 24 Oct
2023 10:19:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 24 Oct 2023 10:19:18 -0700 (PDT)
In-Reply-To: <uh8tmo$24jav$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=207.192.243.66; posting-account=oZINDgkAAADBOdyMxT3ow977E_hOlIxJ
NNTP-Posting-Host: 207.192.243.66
References: <27235fc9-90c1-47bd-a7d0-27295090da80n@googlegroups.com> <uh8tmo$24jav$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6882cb61-40ab-407e-bd7e-b659f7f9e076n@googlegroups.com>
Subject: Re: gfortran flags vs pgf95 flags
From: massey@lowell.edu (Philip Massey)
Injection-Date: Tue, 24 Oct 2023 17:19:19 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4052
 by: Philip Massey - Tue, 24 Oct 2023 17:19 UTC

On Tuesday, October 24, 2023 at 10:08:45 AM UTC-7, Thomas Koenig wrote:
> Philip Massey <mas...@lowell.edu> schrieb:
> > I’m running some stellar atmosphere code on a Mac.
> Which type? Apple Silicon or x86? (I'm not sure that Apple
> Silicon is officially supported yet).

I'm currently running on an intel machine but hope to implement it on an M2 when gfortran for apple silicon is a little
more mature.
>
> Which version of gfortran?
> > When the code is compiled with the pgf95 compiler using the flags -mp -Mlarge_arrays -O2 -fast -Mconcur
> > it takes about 3 hours to run.
> >
> > When I compile the same code using gfortran and the switches
> > -O2 -fopenmp -m64
> > it takes about 5 hours to run.
> A significant difference, but this is not unheard of.
>
> A few suggestions:
>
> Upgrade to a newer version, if possible (the lastest release
> gfortran 13.2).

I'm using 13.2.
>
> For time-critical code use at least -O3 -march=native -mtune=native
>
> If you call a lot of procedures from other places, try -flto.
> This will expose a lot of optmiization opportunities. It will also
> make your compilations much longer, but for your calculation times,
> that may still be a win.
>
> You could also try out -ffast-math, but if your code requires any
> guarantees on numerical rearrangement or accuracy, then this option
> could impact it negatively. You could also try out the indiviual
> gcc flags controlling numerics to see if they make a difference.
>
> -Ofast also includes -ffast-math, plus it does some other things;
> it can also increase your stack usage, and you could get seemingly
> random crashes. This is a known problem from measly maximum
> allocation for openmp threads on MacOS.
>
> There are also options for less accurate calculation of square
> roots, but if these help (and their large inaccuracy does not
> disturb you) this may be worth looking into.
> > In both cases I’m running nominally on 4 cores, although the gfortran compilation may not
> > be fully utilizing them based on what I see using “top”..
> Can't speak to that.
> > I’d appreciate any suggestions. The “-fast” in pgf95 seems to do a lot of good things, but I can’t seem to identify anything analogous in gfortran. Thanks for any advice.
> Well, -ffast-math does some things that are rightly considered
> bad in some use cases, and are considered good (increases speed
> and does not negatively impact correctness) in others. I would
> not recommend using it without some thought.

These are all very useful, valuable suggestions, and exactly what I was after. Thanks!

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor