From: steve on
On Jun 18, 9:52 pm, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote:
> On Jun 19, 12:24 am, steve <kar...(a)comcast.net> wrote:
>
>
>
> > On Jun 18, 8:22 pm, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote:
>
> > > It is a revisit a problem I posted some time ago. However, the problem
> > > is not completely resolved.
> > > I have a code as follows to test the efficiency of OO.
>
> > Oddly, you haven't shown a -O0 result.
>
> > (Code elided)
>
> > > When I put all the code in one single file named test.f90 and compile
> > > it using gfortran -O3 -ffast-math -march=native -fwhole-file
> > > test.f90, I obtain excellent efficience for operator overload:
> > > Analysis runs for 0.141 sec and DNAD runs for 0.062 sec.
> > > However However, when I split it into three separate files (put
> > > program test in main.f90, CPUtime model in CPUtime.f90, and DNAD
> > > module in DNAD.f90), and use the following series of command:
> > > gfortran -c -O3 -ffast-math -march=native -fwhole-file  CPUtime.f90
> > > gfortran -c -O3 -ffast-math -march=native -fwhole-file  DNAD.f90
> > > gfortran -c -O3 -ffast-math -march=native -fwhole-file  main.f90
>
> > > gfortran -o -O3 -ffast-math -march=native -fwhole-file  CPUtime.o
> > > DNAD.o main.o
>
> > > I lost much of the efficiency, now the Analysis runs for 0.156 sec and
> > > DNAD runs for 1.25 sec.
>
> > > Any hints on how to optimize the multiple file code is greatly
> > > appreciated.
>
> > Read the documentation?
>
> > Hopefully, google-group does mess up the formatting.
>
> > % cat run
> > #! /bin/csh
>
> > echo "Case 1"
> > gfc4x -O3 -march=native -fwhole-program -ffast-math \
> >   -funroll-loops -ftree-vectorize -o z a.f90
> > ./z
> > echo "Case 2"
> > gfc4x -O3 -march=native -fwhole-file -ffast-math \
> >   -funroll-loops -ftree-vectorize -c c.f90
> > gfc4x -O3 -march=native -fwhole-file -ffast-math \
> >   -funroll-loops -ftree-vectorize -c d.f90
> > gfc4x -O3 -march=native -fwhole-program -ffast-math \
> >   -funroll-loops -ftree-vectorize -o z b.f90 d.o c.o
> > ./z
>
> > echo "Case 3"
> > gfc4x -flto -O3 -march=native -fwhole-file -ffast-math \
> >   -funroll-loops -ftree-vectorize -c c.f90
> > gfc4x -flto -O3 -march=native -fwhole-file -ffast-math  \
> >   -funroll-loops -ftree-vectorize -c d.f90
> > gfc4x -flto -O3 -march=native -fwhole-program -ffast-math \
> >  -funroll-loops -ftree-vectorize -o z b.f90 d.o c.o
> > ./z
>
> > % ./run
> > Case 1
> >  Analysis Runs for    7.50000030E-02  Seconds.
> >   -19999999.999023605
> >  DNAD Runs for    7.59999976E-02  Seconds.
> >   -19999999.999023605        24999999.999999996
> > Case 2
> >  Analysis Runs for    7.50000030E-02  Seconds.
> >   -19999999.999023605
> >  DNAD Runs for     1.5360000      Seconds.
> >   -19999999.999023605        24999999.999999996
> > Case 3
> >  Analysis Runs for    7.59999976E-02  Seconds.
> >   -19999999.999023605
> >  DNAD Runs for    7.50000030E-02  Seconds.
> >   -19999999.999023605        24999999.999999996
>

> I am using gfortran on windows. -flto is not available for win32 gcc
> version 4.6.0 20100524.

Bumper. I suppose you don't want to install an alternative OS
where ELF is the object file format.

--
steve
From: Tobias Burnus on
Hifi-Comp wrote:
> I am using gfortran on windows. -flto is not available for win32 gcc
> version 4.6.0 20100524.

Actually, that surprises me - I am pretty sure that LTO support for
MacOS and Windows went in. Let me search ...

.... and I remembered correctly. It was enabled for Windows on 4.6 (end
of April) and as the following link shows, it is also available in the
current 4.5 branch: http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01275.html

Thus, if your gfortran version does not have LTO, it probably means that
it is not enabled. It is only enabled if binutils >= 2.20.1 are found at
compile time. Additionally, one might need to use --enable-lto during
configure time.

You did not state where you got the binaries from, but seemingly from a
place with out-dated binutils and/or where --enable-lto was not used as
configure option.

Tobias
From: baf on
Tobias Burnus wrote:
> Hifi-Comp wrote:
>> I am using gfortran on windows. -flto is not available for win32 gcc
>> version 4.6.0 20100524.
>
> Actually, that surprises me - I am pretty sure that LTO support for
> MacOS and Windows went in. Let me search ...
>
> ... and I remembered correctly. It was enabled for Windows on 4.6 (end
> of April) and as the following link shows, it is also available in the
> current 4.5 branch: http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01275.html
>
> Thus, if your gfortran version does not have LTO, it probably means that
> it is not enabled. It is only enabled if binutils >= 2.20.1 are found at
> compile time. Additionally, one might need to use --enable-lto during
> configure time.
>
> You did not state where you got the binaries from, but seemingly from a
> place with out-dated binutils and/or where --enable-lto was not used as
> configure option.
>
> Tobias

If he used the version of gfortran that I recently built and made
available via a link on the wiki, then it was not built with
--enable-lto. I will rebuild a version today with that option enabled
and repost.

From: Hifi-Comp on
On Jun 19, 1:31 pm, baf <b...(a)nowhere.net> wrote:
> Tobias Burnus wrote:
> > Hifi-Comp wrote:
> >> I am using gfortran on windows. -flto is not available for win32 gcc
> >> version 4.6.0 20100524.
>
> > Actually, that surprises me - I am pretty sure that LTO support for
> > MacOS and Windows went in. Let me search ...
>
> > ... and I remembered correctly. It was enabled for Windows on 4.6 (end
> > of April) and as the following link shows, it is also available in the
> > current 4.5 branch:http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01275.html
>
> > Thus, if your gfortran version does not have LTO, it probably means that
> > it is not enabled. It is only enabled if binutils >= 2.20.1 are found at
> > compile time. Additionally, one might need to use --enable-lto during
> > configure time.
>
> > You did not state where you got the binaries from, but seemingly from a
> > place with out-dated binutils and/or where --enable-lto was not used as
> > configure option.
>
> > Tobias
>
> If he used the version of gfortran that I recently built and made
> available via a link on the wiki, then it was not built with
> --enable-lto.  I will rebuild a version today with that option enabled
> and repost.- Hide quoted text -
>
> - Show quoted text -

That will be most helpful. Thanks a lot! Once you build it, can you
also send me the link. If I remembered correctly, I used
http://users.humboldt.edu/finneyb/gfortran-windows.exe
From: baf on
Hifi-Comp wrote:
> On Jun 19, 1:31 pm, baf <b...(a)nowhere.net> wrote:
>> Tobias Burnus wrote:
>>> Hifi-Comp wrote:
>>>> I am using gfortran on windows. -flto is not available for win32 gcc
>>>> version 4.6.0 20100524.
>>> Actually, that surprises me - I am pretty sure that LTO support for
>>> MacOS and Windows went in. Let me search ...
>>> ... and I remembered correctly. It was enabled for Windows on 4.6 (end
>>> of April) and as the following link shows, it is also available in the
>>> current 4.5 branch:http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01275.html
>>> Thus, if your gfortran version does not have LTO, it probably means that
>>> it is not enabled. It is only enabled if binutils >= 2.20.1 are found at
>>> compile time. Additionally, one might need to use --enable-lto during
>>> configure time.
>>> You did not state where you got the binaries from, but seemingly from a
>>> place with out-dated binutils and/or where --enable-lto was not used as
>>> configure option.
>>> Tobias
>> If he used the version of gfortran that I recently built and made
>> available via a link on the wiki, then it was not built with
>> --enable-lto. I will rebuild a version today with that option enabled
>> and repost.- Hide quoted text -
>>
>> - Show quoted text -
>
> That will be most helpful. Thanks a lot! Once you build it, can you
> also send me the link. If I remembered correctly, I used
> http://users.humboldt.edu/finneyb/gfortran-windows.exe

The new build of gfortran for windows is now available at the same link
as you list above. I tested it with -flto and it produced an executable
that ran fine. The compiler will also install the latest version of
binutilts (2.20.51).