Difference between revisions of "FLEXPART Model/FLEXPARTCompilerSettings"

From mn/geo/geoit
Jump to: navigation, search
Line 13: Line 13:
 
GRIB_API and JASPER (the latter as required by GRIB_API).
 
GRIB_API and JASPER (the latter as required by GRIB_API).
  
The main point to be considered for running FLEXPART in a 64-bit environment is
+
The main point to be considered for running FLEXPART in a 64-bit environment is the possiblity to allocate data arrays >2GB. This requires to use the compiler flag -mcmodel=medium. Note that this memory model slows down calculations, if data arrays of less than 2GB are allocated, the use of -mcmodel=small is said to provide slightly better performance.
the possiblity to allocate data arrays >2GB. This requires to use the compiler
 
flag -mcmodel=medium. Note that this memory model slows down calculations, if
 
data arrays of less than 2GB are allocated, the use of -mcmodel=small is said to
 
provide slightly better performance.
 
  
An additional requirement is that the external libraries must be compiled with
+
An additional requirement is that the external libraries must be compiled with the flag -fPIC to allow for the libraries to be located at any position in the computer's main memory. Without this flag, a 'relocation truncated to fit' error will result when linking FLEXPART.
the flag -fPIC to allow for the libraries to be located at any position in the
 
computer's main memory. Without this flag, a 'relocation truncated to fit'
 
error will result when linking FLEXPART.
 
  
If the compilers are not set to generate 64-bit binaries by default, the flag
+
If the compilers are not set to generate 64-bit binaries by default, the flag <code> -m64 </code> should be included for FLEXPART and the external libraries.
-m64 should be included for FLEXPART and the external libraries.
 
  
All of the required settings for FLEXPART are already made in the makefiles  
+
All of the required settings for FLEXPART are already made in the makefiles included in the FLEXPART 8.1 distribution.
included in the FLEXPART 8.1 distribution.
 
  
  
Line 36: Line 27:
 
1. JASPER:
 
1. JASPER:
  
::
+
<pre>
  
 
./configure CC=gcc CFLAGS='-O2 -m64 -fPIC'
 
./configure CC=gcc CFLAGS='-O2 -m64 -fPIC'
 
make
 
make
 
make install
 
make install
 
+
</pre>
  
 
2. GRIB_API:
 
2. GRIB_API:
  
::
+
<pre>
  
 
export CC=gcc  
 
export CC=gcc  
Line 55: Line 46:
 
make check
 
make check
 
make install
 
make install
 +
</pre>
  
 
3. FLEXPART:
 
3. FLEXPART:
Line 60: Line 52:
 
use one of the following:
 
use one of the following:
  
::
+
<pre>
  
 
make -f makefile.ecmwf_gfortran_64
 
make -f makefile.ecmwf_gfortran_64
Line 66: Line 58:
 
make -f makefile.ecmwf_absoft_64
 
make -f makefile.ecmwf_absoft_64
 
make -f makefile.gfs_absoft_64
 
make -f makefile.gfs_absoft_64
 +
</pre>
  
 
NOTE: Set -mcmodel=medium or -mcmodel=small in the makefiles,
 
NOTE: Set -mcmodel=medium or -mcmodel=small in the makefiles,
 
depending on memory allocation needs (see above).
 
depending on memory allocation needs (see above).

Revision as of 16:02, 14 September 2011

This is the README file included now with the FLEXPART distribution

Compiling FLEXPART 8.1 in a 64-bit environment

This file describes the required compiler flags for compiling FLEXPART 8.1 in a 64-bit computing environment for the gfortran compiler (version 4.2) and absoft compiler (version 10.1).

Moving from a 32-bit to a 64-bit environment brings the advantage of using >2GB main memory for FLEXPART data arrays. However, this requires certain adjustments to the compilation settings of FLEXPART and the external libraries GRIB_API and JASPER (the latter as required by GRIB_API).

The main point to be considered for running FLEXPART in a 64-bit environment is the possiblity to allocate data arrays >2GB. This requires to use the compiler flag -mcmodel=medium. Note that this memory model slows down calculations, if data arrays of less than 2GB are allocated, the use of -mcmodel=small is said to provide slightly better performance.

An additional requirement is that the external libraries must be compiled with the flag -fPIC to allow for the libraries to be located at any position in the computer's main memory. Without this flag, a 'relocation truncated to fit' error will result when linking FLEXPART.

If the compilers are not set to generate 64-bit binaries by default, the flag -m64 should be included for FLEXPART and the external libraries.

All of the required settings for FLEXPART are already made in the makefiles included in the FLEXPART 8.1 distribution.


Recommended compilation steps using the gfortran or absoft compiler


1. JASPER:


./configure CC=gcc CFLAGS='-O2 -m64 -fPIC'
make
make install

2. GRIB_API:


export CC=gcc 
export FC=gfortran/absoft
export CFLAGS='-O2 -m64 -fPIC' 
export FFLAGS='-O2 -m64 -fPIC'
./configure
make
make check
make install

3. FLEXPART:

use one of the following:


make -f makefile.ecmwf_gfortran_64
make -f makefile.gfs_gfortran_64
make -f makefile.ecmwf_absoft_64
make -f makefile.gfs_absoft_64

NOTE: Set -mcmodel=medium or -mcmodel=small in the makefiles, depending on memory allocation needs (see above).