Fortran/GNU
From mn/geo/geoit
<rst>
- Compiling FLEXPART with the GNU Fortran compiler gfortran**
The advantages of the gfortran compiler as it stands now (gfortran with gcc 4.3.2) is that it can compile for 64Bit which means it can address more than 2GB of memory.
There are two additional makefiles for the ecmwf input routines when you check out FLEXPART from the svn server:
- make.ecmwf_gfortran*
- make.ecmwf_gfortran_64*
The compiler settings for 32Bit (in *make.ecmwf_gfortran*) are:
FC = gfortran INCPATH = /nilu/home/flexpart/lib/grib_api/include LIBPATH1 = /nilu/home/flexpart/lib/grib_api/lib LIBPATH2 = /nilu/home/flexpart/lib/jasper/lib FFLAGS = -O3 -m32 -fconvert=little-endian -I$(INCPATH) LDFLAGS = $(FFLAGS) -L$(LIBPATH2) -L$(LIBPATH1) -lgrib_api_f90 -lgrib_api -lm -ljasper
The compiler settings for 64Bit (in *make.ecmwf_gfortran_64*) are:
FC = gfortran INCPATH = /nilu/home/flexpart/lib64/grib_api/include LIBPATH1 = /nilu/home/flexpart/lib64/grib_api/lib LIBPATH2 = /nilu/home/flexpart/lib64/jasper/lib FFLAGS = -O3 -m64 -mcmodel=large -fconvert=little-endian -frecord-marker=4 -I$(INCPATH) LDFLAGS = $(FFLAGS) -L$(LIBPATH2) -L$(LIBPATH1) -lgrib_api_f90 -lgrib_api -lm -ljasper
Explanation of the options for the unformatted output from the `GCC 4.3.2 documentation <http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options>`_
-fconvert=conversion Specify the representation of data for unformatted files. Valid values for conversion are: `native', the default; `swap', swap between big- and little-endian; `big-endian', use big-endian representation for unformatted files; `little-endian', use little-endian representation for unformatted files. This option has an effect only when used in the main program. The CONVERT specifier and the GFORTRAN_CONVERT_UNIT environment variable override the default specified by -fconvert.
-frecord-marker=length Specify the length of record markers for unformatted files. Valid values for length are 4 and 8. Default is whatever off_t is specified to be on that particular system. Note that specifying length as 4 limits the record length of unformatted files to 2 GB. This option does not extend the maximum possible record length on systems where off_t is a four_byte quantity.
Explanation of the options for the memory model
-mcmodel=small Generate code for the small code model: the program and its symbols must be linked in the lower 2 GB of the address space. Pointers are 64 bits. Programs can be statically or dynamically linked. This is the default code model. -mcmodel=medium Generate code for the medium model: The program is linked in the lower 2 GB of the address space but symbols can be located anywhere in the address space. Programs can be statically or dynamically linked, but building of shared libraries are not supported with the medium model. -mcmodel=large Generate code for the large model: This model makes no assumptions about addresses and sizes of sections.
- Note:** on the 64-Bit machines which are not yet updated to the new Fedora release, gfortran is at version 4.1.2, which not yet supports the option *-mcmodel=large*. Instead use the option *-mcmodel=medium* when compiling on billy, sjanten and jegern until they are updated.
</rst>