makefile

From WikiROMS
Revision as of 19:57, 12 November 2006 by Arango (talk | contribs)
Jump to navigationJump to search

ROMS has a single makefile located in the top-level directory. Its generic structure facilitates the compiling of ROMS with other coupled models. The user usually needs to check/modify few definitions in the makefile before compiling a particular applications to specify primarily Fortran compiler, parallel options, and 64-bit floating-point number precision.

User Changes to makefile

As a user, you need to check and perhaps edit the makefile to set the value (on) or leave blank the following macro definitions:

DEBUG :=
Used to turn on symbolic debug information with no optimization.
MPI :=
Used to turn on distributed-memory parallelization in ROMS and linking to the Message Passing Interface (MPI) library.
MPIF90 :=
Used to turn on the MPICH implementation of MPI via the compilation script mpif90 which is required in some Linux operating systems without a native MPI library (-lmpi). This definition macro is also convinient when there are several Fortran compilers (ifort, pgf90, pathf90) in the system that use the mpif90 compilation command. In this case, the user needs turn on both MPI and MPIF90 definitions and specify the appropriate Fortran-90 compiler in FORTRAN macro.
OPENMP :=
Used to turn on shared-memory parallelization in ROMS using the OpenMP compiler directives.
ARPACK :=
Used to turn on linking to the ARPACK library which is used to solve large Ritz eigenvalue problems in the adjoint-based Generalized Stability Theory (GST) analysis.
LARGE :=
Used to turn on 64-bit floating-point number precision.

The user also need to specify the appropriate Fortran-90 compiler to use. The name of the Fortran-90 compiler depends on the operating system (see table below). This name is also used to determine the compiling configuration file to include in the makefile by concatenating the operating system (uname -s) and chosen compiler name.

Operating System Compiler(s)
AIX xlf
ALPHA f90
CYGWIN g95, df
Darwin f90, gfortran, xlf
Linux ifc, ifort, pgi, path, g95
SunOS f95
SunOS/Linus ftn
UNICOS-mp ftn
FORTRAN ?=
Set the Fortran-90 compiler to use. Notice that since the ?= assigment is used, the value of this macro definition is only relevant if the environmental variable FORTRAN has not been defined. The environmental value takes precedence.

See gmake for additional documentation.

Compiler-dependent Changes

Also as a user, you need to be aware of the files in the Compilers directory. The top-level makefile will be including one of these files, based on combining the result of uname -s with the value of FORTRAN. For instance, it might be including Darwin-gfortran.mk if you are on a Mac and using the gfortran compiler. You need to make sure this file exists and has the correct values for the compiler options and for finding the NetCDF library. The file should contain pointers to both the NetCDF library and include files. If the library is different for 32-bit and 64-bit options, that needs to be taken care of as well. See Gmake#Conditionals for an example.