From: e p chandler on 21 Jun 2010 10:25 "fj" <francois.jacq(a)irsn.fr> wrote in message news:986367df-d557-41bf-ac52-5efa049f8506(a)t10g2000yqg.googlegroups.com... > On 21 juin, 04:24, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote: >> On Jun 20, 3:21 am, baf <b...(a)nowhere.net> wrote: >> >> >> >> > 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. >> > 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).- Hide quoted text - >> >> Thanks. I downloaded the updated build. However, when I compile the >> codes according to case 3 given by Steve's post. I get the following >> error message: >> c:/program files/gfortran/bin/../lib/gcc/i586-pc- >> mingw32/4.6.0/../../../libmingw >> 32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain(a)16' >> collect2: ld returned 1 exit status > > I got the same message this morning because I forgot to link with the > main program ! Strange. I usually use G95 and I get a different message, an undefined reference to _MAIN. gfortran gives the message above. Interesting. I have not used gfortran enough to make this mistake on my own. [smile] -- e
From: Hifi-Comp on 21 Jun 2010 20:46 On Jun 21, 10:25 am, "e p chandler" <e...(a)juno.com> wrote: > "fj" <francois.j...(a)irsn.fr> wrote in message > > news:986367df-d557-41bf-ac52-5efa049f8506(a)t10g2000yqg.googlegroups.com... > > > > > > > On 21 juin, 04:24, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote: > >> On Jun 20, 3:21 am, baf <b...(a)nowhere.net> wrote: > > >> > 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. > >> > 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).- Hide quoted text - > > >> Thanks. I downloaded the updated build. However, when I compile the > >> codes according to case 3 given by Steve's post. I get the following > >> error message: > >> c:/program files/gfortran/bin/../lib/gcc/i586-pc- > >> mingw32/4.6.0/../../../libmingw > >> 32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain(a)16' > >> collect2: ld returned 1 exit status > > > I got the same message this morning because I forgot to link with the > > main program ! > > Strange. I usually use G95 and I get a different message, an undefined > reference to _MAIN. > gfortran gives the message above. Interesting. I have not used gfortran > enough to make this mistake on my own. [smile] > > -- e- Hide quoted text - > > - Show quoted text - I uninstalled and reinstalled. Still getting the same error message. My system is WinXP SP3.
From: baf on 22 Jun 2010 16:52 On 6/21/2010 5:46 PM, Hifi-Comp wrote: > On Jun 21, 10:25 am, "e p chandler"<e...(a)juno.com> wrote: >> "fj"<francois.j...(a)irsn.fr> wrote in message >> >> news:986367df-d557-41bf-ac52-5efa049f8506(a)t10g2000yqg.googlegroups.com... >> >> >> >> >> >>> On 21 juin, 04:24, Hifi-Comp<wenbinyu.hea...(a)gmail.com> wrote: >>>> On Jun 20, 3:21 am, baf<b...(a)nowhere.net> wrote: >> >>>>> 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. >>>>> 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).- Hide quoted text - >> >>>> Thanks. I downloaded the updated build. However, when I compile the >>>> codes according to case 3 given by Steve's post. I get the following >>>> error message: >>>> c:/program files/gfortran/bin/../lib/gcc/i586-pc- >>>> mingw32/4.6.0/../../../libmingw >>>> 32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain(a)16' >>>> collect2: ld returned 1 exit status >> >>> I got the same message this morning because I forgot to link with the >>> main program ! >> >> Strange. I usually use G95 and I get a different message, an undefined >> reference to _MAIN. >> gfortran gives the message above. Interesting. I have not used gfortran >> enough to make this mistake on my own. [smile] >> >> -- e- Hide quoted text - >> >> - Show quoted text - > > I uninstalled and reinstalled. Still getting the same error message. > My system is WinXP SP3. I rebuilt the compiler using the same options as I had specified in the May build with the exception of enabling lto support. I also included the most current version of the binutils (which includes the loader). What exactly are you trying to do. Provide the code and the compile commands that are producing the errors you are seeing.
From: stevenb on 22 Jun 2010 17:01 On Jun 19, 5:57 am, yaqi <yaqiw...(a)gmail.com> wrote: > On Jun 18, 9: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. > > > MODULE CPUTime > > IMPLICIT NONE > > PRIVATE > > PUBLIC TIC, TOC > > INTEGER::start, rate, finish > > CONTAINS > > SUBROUTINE TIC > > CALL SYSTEM_CLOCK(start,rate) > > END SUBROUTINE TIC > > > FUNCTION TOC() RESULT(sec) > > REAL::sec > > CALL SYSTEM_CLOCK(finish) > > IF(finish>start) THEN > > sec=REAL(finish-start)/REAL(rate) > > ELSE > > sec=0.0 > > ENDIF > > END FUNCTION TOC > > END MODULE CPUTime > > > MODULE DNAD > > IMPLICIT NONE > > PRIVATE > > > TYPE,PUBLIC:: DUAL_NUM > > REAL(8)::x_ad_ > > REAL(8)::xp_ad_ > > END TYPE DUAL_NUM > > > PUBLIC OPERATOR (-) > > INTERFACE OPERATOR (-) > > MODULE PROCEDURE MINUS_DD > > END INTERFACE > > > PUBLIC OPERATOR (*) > > INTERFACE OPERATOR (*) > > MODULE PROCEDURE MULT_DD > > END INTERFACE > > > PUBLIC OPERATOR (/) > > INTERFACE OPERATOR (/) > > MODULE PROCEDURE DIV_DD > > END INTERFACE > > > CONTAINS > > ELEMENTAL FUNCTION MINUS_DD(u,v) RESULT(res) > > TYPE (DUAL_NUM), INTENT(IN)::u,v > > TYPE (DUAL_NUM)::res > > res%x_ad_ = u%x_ad_-v%x_ad_ > > res%xp_ad_= u%xp_ad_-v%xp_ad_ > > END FUNCTION MINUS_DD > > > ELEMENTAL FUNCTION MULT_DD(u,v) RESULT(res) > > TYPE (DUAL_NUM), INTENT(IN)::u,v > > TYPE (DUAL_NUM)::res > > res%x_ad_ = u%x_ad_*v%x_ad_ > > res%xp_ad_= u%xp_ad_*v%x_ad_ + u%x_ad_*v%xp_ad_ > > END FUNCTION MULT_DD > > > ELEMENTAL FUNCTION DIV_DD(u,v) RESULT(res) > > TYPE (DUAL_NUM), INTENT(IN)::u,v > > REAL(8)::tmp > > TYPE (DUAL_NUM)::res > > tmp=1.D0/v%x_ad_ > > res%x_ad_ = u%x_ad_*tmp > > res%xp_ad_ =(u%xp_ad_- res%x_ad_*v%xp_ad_)*tmp > > END FUNCTION DIV_DD > > END MODULE DNAD > > > PROGRAM Test > > USE DNAD > > USE CPUTime > > IMPLICIT NONE > > REAL(8):: x_,y_,z_,f_,ftot_ > > TYPE(DUAL_NUM):: x,y,z,f,ftot > > INTEGER:: I > > > x_=1.0d0;y_=2.0d0;z_=0.3d0 > > ftot_=0.0d0 > > CALL TIC > > > DO i=1,50000000 > > f_=x_-y_*z_/x_ > > ftot_ = ftot_ - f_ > > > ENDDO > > WRITE(*,*)'Analysis Runs for ', TOC(),' Seconds.' > > write(*,*)ftot_ > > > x=DUAL_NUM(1.0d0,0.1D0);y=DUAL_NUM(2.0d0,0.2D0);z=DUAL_NUM(0.3d0,0.3D0) > > ftot=DUAL_NUM(0.0d0,0.0D0) > > CALL TIC > > > DO i=1,50000000 > > f=x-y*z/x > > ftot = ftot - f > > > ENDDO > > WRITE(*,*)'DNAD Runs for ', TOC(),' Seconds.' > > write(*,*)ftot > > END PROGRAM Test > > > 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. > > Hi Hifi-Comp, > > I tested your code with Intel Visual Fortran. It matters when I turn > the Interprocedural optimization to Multi-file (/Qipo). Single file > optimization does not give the good performance. With /Qipo, time is > 0.125s, without, 2.45s. > > Not quite sure if gfortran can do the similar thing. If not, you may > consider to switch to another compiler. gfortran can do this since GCC 4.5 for platforms based on the ELF binary format (i.e. almost all unix variants). See the documentation of the -flto flag in the GCC documentation. For windows (PE-COFF) and apple-darwin (Mach-O) this will be available in GCC 4.5.1. Ciao! Steven
From: baf on 22 Jun 2010 18:17 Hifi-Comp wrote: > On Jun 21, 10:25 am, "e p chandler" <e...(a)juno.com> wrote: >> "fj" <francois.j...(a)irsn.fr> wrote in message >> >> news:986367df-d557-41bf-ac52-5efa049f8506(a)t10g2000yqg.googlegroups.com... >> >> >> >> >> >>> On 21 juin, 04:24, Hifi-Comp <wenbinyu.hea...(a)gmail.com> wrote: >>>> On Jun 20, 3:21 am, baf <b...(a)nowhere.net> wrote: >>>>> 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. >>>>> 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).- Hide quoted text - >>>> Thanks. I downloaded the updated build. However, when I compile the >>>> codes according to case 3 given by Steve's post. I get the following >>>> error message: >>>> c:/program files/gfortran/bin/../lib/gcc/i586-pc- >>>> mingw32/4.6.0/../../../libmingw >>>> 32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain(a)16' >>>> collect2: ld returned 1 exit status >>> I got the same message this morning because I forgot to link with the >>> main program ! >> Strange. I usually use G95 and I get a different message, an undefined >> reference to _MAIN. >> gfortran gives the message above. Interesting. I have not used gfortran >> enough to make this mistake on my own. [smile] >> >> -- e- Hide quoted text - >> >> - Show quoted text - > > I uninstalled and reinstalled. Still getting the same error message. > My system is WinXP SP3. I used the code that you provided in your original post and got the following results with the build of the compiler currently available. Looks like there is only a minor "penalty" for using separate files for the modules and main program. I suspect that the problem you are reporting with the linker is due to an old version of ld in the $PATH prior to the new version provided with the latest compiler package. D:\fortran\test>gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=c:/program files/gfortran/bin/../libexec/gcc/i586-pc-mingw32 /4.6.0/lto-wrapper.exe Target: i586-pc-mingw32 Configured with: ../gcc-trunk/configure --prefix=/mingw --enable-languages=c,fortran --with-gmp=/home/brad/gfortran/dependencies --disable-werror --enable-threads --disable-nls --build=i586-pc-mingw32 --enable-libgomp --disable-shared --disable-win32-registry --with-dwarf2 --disable-sjlj-exceptions --enable-lto Thread model: win32 gcc version 4.6.0 20100620 (experimental) [trunk revision 161045] (GCC) D:\fortran\test>gfortran -O3 -ffast-math -march=native -fwhole-file -flto onefile.f90 -o onefile D:\fortran\test>onefile Analysis Runs for 9.30000022E-02 Seconds. -19999999.999990787 DNAD Runs for 0.11000000 Seconds. -19999999.999990787 25000000.000000000 D:\fortran\test>gfortran -c -O3 -ffast-math -march=native -fwhole-file -flto cputime.f90 D:\fortran\test>gfortran -c -O3 -ffast-math -march=native -fwhole-file -flto dnad.f90 D:\fortran\test>gfortran -c -O3 -ffast-math -march=native -fwhole-file -flto main.f90 D:\fortran\test>main Analysis Runs for 9.39999968E-02 Seconds. -19999999.999990787 DNAD Runs for 0.11000000 Seconds. -19999999.999990787 25000000.000000000
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Commercial Fortran Compilers Next: preprocessing issue with Visual Studio |