[Wrf-users] WRFSI built with g95: success, but ...

Andrés Calderón andresfcalderon at gmail.com
Wed Feb 23 20:14:08 MST 2005


It is very interesting.

Do you have something about the performance? IFC vs PGI vs g95?

thanks,

 -- Andres Calderon

On Thu, 24 Feb 2005 00:23:16 +0100, Arnold Moene <arnold.moene at wur.nl> wrote:
> L.S.,
> 
> After some tweaking and contact with the main developer of the GNU Fortran 95
> compiler (g95) I've managed to build WRFSI with g95 (version gcc version 4.0.0
> 20050129 (experimental) (g95!) Feb 16 2005) on Linux i586.
> 
> The changes I had to make are listed below, with some comments to explain the
> reasons for the changes. Apart from a number of defendable changes, there also
> appeared to be a number of non-standard constructs in the code (according to
> Andy Vaught, g95 developer). It would be nice if those non-standard things
> could be changed.
> 
> I hope this is useful to others.
> 
> Regards, Arnold Moene
> 
> PS: Here comes the diff (comments preceded by #, first lines are from the *new*
> code)
> 
> # FLOAT appears to be a specific intrinsic that only works with
> # 4-byte integers. The generic function is REAL
> diff -r wrfsi/src/grid/alt_all.f wrfsi.orig/src/grid/alt_all.f
> 991c991
> <               sum=sum+real(datain(III,JJJ))
> ---
> >               sum=sum+float(datain(III,JJJ))
> 1056c1056
> <               sum=sum+(out2d(I,J)-real(datain(III,JJJ)))**2.
> ---
> >               sum=sum+(out2d(I,J)-float(datain(III,JJJ)))**2.
> 
> # The standard way of indicating octal numbers is with the 'O'
> # preceding the string, rather than following it.
> diff -r wrfsi/src/grid/gridgen_utils.f wrfsi.orig/src/grid/gridgen_utils.f
> 930,931c930,931
> <         BIT_1 = O'200'     ! BINARY '10000000'
> <         BIT_2 = O'377'     ! BINARY '11111111'
> ---
> >         BIT_1 = '200'O     ! BINARY '10000000'
> >         BIT_2 = '377'O     ! BINARY '11111111'
> 
> # The -DUSE_TRIGD is needed to make sure that trigd.mod is generated, since
> # g95 does not know DCOSD etc.
> diff -r wrfsi/src/include/makefile_pc.inc.in
> wrfsi.orig/src/include/makefile_pc.inc.in
> 8c8
> < DEFS=-Di686 -DDEC -DBIT32 -DF90 -DFORTRANDOUBLEUNDERSCORE -DDYNAMIC
> -DUSE_TRIGD
> ---
> > DEFS=-Di686 -DDEC -DBIT32 -DF90 -DFORTRANUNDERSCORE -DDYNAMIC
> 
> # Of course ;)
> 14c14
> < FC       = g95
> ---
> > FC       = pgf90
> 
> # The addition of $(DEFS) is needed to make sure that trigd.mod is built
> # changes to FIXED and FREE are simply compiler specific
> 20,23c20,23
> < FFLAGS =  $(INC) -O2 $(DEFS)
> < DBFLAGS = $(INC) -g -C $(DEFS)
> < FIXED=-ffixed-form
> < FREE=-ffree-form
> ---
> > FFLAGS =  $(INC) -O2 -byteswapio
> > DBFLAGS = $(INC) -g -C -byteswapio
> > FIXED=-Mfixed
> > FREE=-Mfree
> 
> # The -P is needed to let cpp work with non-C code graciously.
> 28c28
> < CPP =  cpp -traditional-cpp -P
> ---
> > CPP =  pgf90 -E
> 
> # The addition of -I$(SRCROOT)/src/lib is needed to make trigd.mod available
> # to other code as well.
> 36c36
> < INC = -I$(SRCROOT)/src/include -I$(NETCDF)/include -I$(SRCROOT)/src/mod
> -I$(SRCROOT)/src/io_netcdf -I$(SRCROOT)/src/lib
> ---
> > INC = -I$(SRCROOT)/src/include -I$(NETCDF)/include -I$(SRCROOT)/src/mod
> -I$(SRCROOT)/src/io_netcdf
> 
> # Switch on trigd module
> diff -r wrfsi/src/include/trigd.inc wrfsi.orig/src/include/trigd.inc
> 5c5
> <        use trigd
> ---
> > C      use trigd
> 
> # IACHAR just wants *one* character as its argument. Don't know why other
> # compilers swallow this.
> diff -r wrfsi/src/io_netcdf/wrf_io.F90 wrfsi.orig/src/io_netcdf/wrf_io.F90
> 482c482
> <     if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c(1:1))+upper_to_lower)
> ---
> >     if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower)
> 499c499
> <     if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c(1:1))+lower_to_upper)
> ---
> >     if('a'<=c .and. c <='z') MemOrd(i:i)=achar(iachar(c)+lower_to_upper)
> 
> # Put $(BIGFOBJS) before $(FOBJS) to make sure that trigd.mod gets built
> # before the object files that need it
> diff -r wrfsi/src/lib/Makefile wrfsi.orig/src/lib/Makefile
> 110c110
> < $(LIB):                        $(COBJS) $(BIGFOBJS) $(FOBJS)
> ---
> > $(LIB):                        $(COBJS) $(FOBJS) $(BIGFOBJS)
> 
> # Also remove *.mod when doing make clean
> 119c119
> <                         $(RM) $(FOBJS) $(BIGFOBJS) $(COBJS) core *.a *.mod
> ---
> >                         $(RM) $(FOBJS) $(BIGFOBJS) $(COBJS) core *.a
> 
> # The specification of hexadecimal numbers with an X following the string
> # is non-standard; should be with Z preceding the string
> diff -r wrfsi/src/lib/w3lib/gbytes.f wrfsi.orig/src/lib/w3lib/gbytes.f
> 25,37c25,30
> <       DATA      MASKS /Z'1',Z'3',Z'7',Z'F',Z'1F',Z'3F',Z'7F',Z'FF',
> <      +Z'1FF',Z'3FF',Z'7FF',Z'FFF', Z'1FFF',Z'3FFF',Z'7FFF',Z'FFFF',
> <      +Z'1FFFF',       Z'3FFFF',       Z'7FFFF',       Z'FFFFF',
> <      +Z'1FFFFF',      Z'3FFFFF',      Z'7FFFFF',      Z'FFFFFF',
> <      +Z'1FFFFFF',     Z'3FFFFFF',     Z'7FFFFFF', Z'FFFFFFF',
> <      +Z'1FFFFFFF',    Z'3FFFFFFF',    Z'7FFFFFFF', Z'FFFFFFFF'/
> <
> < c     DATA      MASKS /'1'X,'3'X,'7'X,'F'X, '1F'X,'3F'X,'7F'X,'FF'X,
> < c    +'1FF'X,'3FF'X,'7FF'X,'FFF'X, '1FFF'X,'3FFF'X,'7FFF'X,'FFFF'X,
> < c    +'1FFFF'X,       '3FFFF'X,       '7FFFF'X,       'FFFFF'X,
> < c    +'1FFFFF'X,      '3FFFFF'X,      '7FFFFF'X,      'FFFFFF'X,
> < c    +'1FFFFFF'X,     '3FFFFFF'X,     '7FFFFFF'X,     'FFFFFFF'X,
> < c    +'1FFFFFFF'X,    '3FFFFFFF'X,    '7FFFFFFF'X,    'FFFFFFFF'X/
> ---
> >       DATA      MASKS /'1'X,'3'X,'7'X,'F'X, '1F'X,'3F'X,'7F'X,'FF'X,
> >      +'1FF'X,'3FF'X,'7FF'X,'FFF'X, '1FFF'X,'3FFF'X,'7FFF'X,'FFFF'X,
> >      +'1FFFF'X,       '3FFFF'X,       '7FFFF'X,       'FFFFF'X,
> >      +'1FFFFF'X,      '3FFFFF'X,      '7FFFFF'X,      'FFFFFF'X,
> >      +'1FFFFFF'X,     '3FFFFFF'X,     '7FFFFFF'X,     'FFFFFFF'X,
> >      +'1FFFFFFF'X,    '3FFFFFFF'X,    '7FFFFFFF'X,    'FFFFFFFF'X/
> 
> # CHAR wants an integer as its argument, not a logical
> diff -r wrfsi/src/lib/w3lib/sbytesc.f wrfsi.orig/src/lib/w3lib/sbytesc.f
> 35c35
> <              out(index) = char(int(or(itmp2,itmp3)))
> ---
> >              out(index) = char(or(itmp2,itmp3))
> 45c45
> <              out(index) = char(int(and(itmp,255)))
> ---
> >              out(index) = char(and(itmp,255))
> 56c56
> <              out(index) = char(int(or(itmp2,itmp3)))
> ---
> >              out(index) = char(or(itmp2,itmp3))
> 
> # The specification of hexadecimal numbers with an X following the string
> # is non-standard; should be with Z preceding the stri
> diff -r wrfsi/src/lib/w3lib/sbytes.f wrfsi.orig/src/lib/w3lib/sbytes.f
> 26,38c26,31
> <       DATA      MASKS /Z'1',Z'3',Z'7',Z'F',Z'1F',Z'3F',Z'7F',Z'FF',
> <      +Z'1FF',Z'3FF',Z'7FF',Z'FFF', Z'1FFF',Z'3FFF',Z'7FFF',Z'FFFF',
> <      +Z'1FFFF',       Z'3FFFF',       Z'7FFFF',       Z'FFFFF',
> <      +Z'1FFFFF',      Z'3FFFFF',      Z'7FFFFF',      Z'FFFFFF',
> <      +Z'1FFFFFF',     Z'3FFFFFF',     Z'7FFFFFF', Z'FFFFFFF',
> <      +Z'1FFFFFFF',    Z'3FFFFFFF',    Z'7FFFFFFF', Z'FFFFFFFF'/
> <
> < c     DATA      MASKS /'1'X,'3'X,'7'X,'F'X, '1F'X,'3F'X,'7F'X,'FF'X,
> < c    +'1FF'X,'3FF'X,'7FF'X,'FFF'X, '1FFF'X,'3FFF'X,'7FFF'X,'FFFF'X,
> < c    +'1FFFF'X,       '3FFFF'X,       '7FFFF'X,       'FFFFF'X,
> < c    +'1FFFFF'X,      '3FFFFF'X,      '7FFFFF'X,      'FFFFFF'X,
> < c    +'1FFFFFF'X,     '3FFFFFF'X,     '7FFFFFF'X,     'FFFFFFF'X,
> < c    +'1FFFFFFF'X,    '3FFFFFFF'X,    '7FFFFFFF'X,    'FFFFFFFF'X/
> ---
> >       DATA      MASKS /'1'X,'3'X,'7'X,'F'X, '1F'X,'3F'X,'7F'X,'FF'X,
> >      +'1FF'X,'3FF'X,'7FF'X,'FFF'X, '1FFF'X,'3FFF'X,'7FFF'X,'FFFF'X,
> >      +'1FFFF'X,       '3FFFF'X,       '7FFFF'X,       'FFFFF'X,
> >      +'1FFFFF'X,      '3FFFFF'X,      '7FFFFF'X,      'FFFFFF'X,
> >      +'1FFFFFF'X,     '3FFFFFF'X,     '7FFFFFF'X,     'FFFFFFF'X,
> >      +'1FFFFFFF'X,    '3FFFFFFF'X,    '7FFFFFFF'X,    'FFFFFFFF'X/
> 
> # CHAR wants an integer as its argument, not a logical
> diff -r wrfsi/src/lib/w3lib/w3fi74.f wrfsi.orig/src/lib/w3lib/w3fi74.f
> 355c355
> <       GDS(17) = CHAR(int(OR(IGDS(8),ISHFT(ICOMP,3))))
> ---
> >       GDS(17) = CHAR(OR(IGDS(8),ISHFT(ICOMP,3)))
> 
> --
> ------------------------------------------------------------------------
> Arnold F. Moene                          NEW tel: +31 (0)317 482604
> Meteorology and Air Quality Group            fax: +31 (0)317 482811
> Wageningen University                   e-mail: Arnold.Moene at wur.nl
> Duivendaal 2                             url: http://www.met.wau.nl
> 6701 AP  Wageningen
> The Netherlands
> ------------------------------------------------------------------------
> Openoffice.org - Freedom at work
> Firefox        - The browser you can trust (www.mozilla.org)
> ------------------------------------------------------------------------
> _______________________________________________
> Wrf-users mailing list
> Wrf-users at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>


More information about the Wrf-users mailing list