Difference between revisions of "GENIE Compiling"

From SourceWiki
Jump to navigation Jump to search
m (GENIE:Compiling moved to GENIE Compiling: make public)
(No difference)

Revision as of 14:53, 11 March 2008

Apple OSX and g95

  • POWERPC, 1.5GHZ Powerbook
  • OSX Tiger 10.4.7, Xcode 2.4

Genie compiles with g95, gcc and g++

  • g95 0.90-1 (Fink download)
  • gcc 4 (Xcode, probably)
  • g++ 4 (Xcode, probably)

Need to exclude biogem (code from cvs early October 2006)

In genie-main makefile

MODULE_NAMES = igcm3 \
              slabocean \
              slabseaice \
              fixedocean \
              fixedseaice \
              goldstein \
              embm \
              seaice \
              fixedatmos \
              land \
              fixedland \
              fixedicesheet \
              fixedchem \
              ichem \
              atchem
#               biogem \
#               ichem 


genie-main/genie_ini_wrappers.f90: Lines 262+:

! call initialise_biogenie(t0,go_dt,go_lin,go_lout, &
! and all the arguments...

genie-main/genie_loop_wrappers.f90: Lines 676+ and 725:

! call biogenie( &
! and all the arguments...
! call rest_biogem(go_lout,'.'//go_ext)

genie-main/genie.F: Line 1688:

c call end_biogenie(go_sfcatm(:,:,:)) 

In order to work with netcdf (v3.6.1 compiled from source with g96, gcc and g++)

You must compile netcdf with identical compilers to those used for genie. You may need to edit the netcdf configure script to make sure it finds the right compilers. Netcdf binaries downloaded via fin are therefore unlikely to work.

Then in genie-main makefile.arc comment out two flags:

#FFLAGS += -fno-second-underscore
#LDFLAGS += -static

Alternatively, if you can work out how to do it, compile netcdf with -fno-second-underscore. I couldn't fathom where to put that in.


jules@jamstec.go.jp, 30th October 2006.

Compilation error with NetCDF version 4

If you are using identical compilers for genie and netcdf, but still get a compilation error message associated with netcdf (e.g. This module file was generated for a different platform or by an incompatible compiler or compiler release. It cannot be read), there may be a compatibility issue with your netcdf version. Switching from NetCDF version 4 (RHES4) to v3.6.1 has bypassed this problem (using Red Hat/ifort/icc), although the reason for this is not known.

k.i.c.oliver@open.ac.uk, 21st November 2006

Intel Fortran v7.1, INT() and PARAMETER()

ifcv7.1 will not compile statements of the form:

* PARAMETER (N=INT(..))

Hence they have been removed from genie-land/src/fotran/qsat.f

Gethin Williams Fri Dec 15 16:58:47 GMT 2006

New line characters in text files (UNIX/Windows)

Description of problem

UNIX uses a linefeed character (as should CVS internally), but Windows uses both carriage-return and linefeed (CR/LF). Some compilers/other tools may have trouble reading or displaying files that have the wrong new line characters for the platform. A symptom of this can be a large number of "odd-looking" compiler errors, and the problem may not be easy to spot because most code editors correctly display both UNIX and Windows new lines. Note that CVS should append the appropriate new line characters for the platform onto which a source file is checked out, but this may not be reliable.

Suggested solutions

If your text editor has an option allowing you to change the new line character, edit the option and save the file. UNIX commands are also available to do the job, for example:

  • dos2unix -ascii my_source_file.f90 my_source_file.f90
  • unix2dos -ascii my_source_file.f90 my_source_file.f90

Ian Henderson Fri Jan 12 15:49:57 GMT 2007

Standard Fortran compliance

Description of problem

Most compilers allow extensions to the Fortran language, but using these extensions may cause errors when a different (often older) compiler is used. For instance, the only format descriptor that can be used without an explicit width is the character descriptor "A", however many compilers will allow other format descriptors to be used without a width, e.g. "G", to which a default width (and number of characters right of the decimal place) is applied by the compiler.

Suggested solutions

The GENIE overnight tests are carried out on several different platforms (Linux, Windows, Solaris) with different compilers. However, it isn't practicable to test every combination of platform and compiler, so when adding significant amounts of new code to GENIE it may be worth testing on more than one compiler/platform if available.

A good check for non-standard Fortran is to compile GENIE with an appropriate compiler option that checks for standards compliance (the compiler option can be added in makefile.arc). In general, it's best to avoid non-standard Fortran unless there's a strong argument for using it.

Compiler flags for popular Fortran compilers:

  • -std -- Intel (ifort)
  • -Mstandard -- Portland (pgf90)
  • -ansi -- Sun (f95)

The ISO Fortran standard homepage is here: http://www.nag.co.uk/sc22wg5/

Ian Henderson Fri Jan 12 15:49:57 GMT 2007