-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathmkmf.template.gfortran
146 lines (138 loc) · 6.45 KB
/
mkmf.template.gfortran
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Template for GNU gfortran on Linux or Mac OSX
#
# DART software - Copyright UCAR. This open source software is provided
# by UCAR, "as is", without charge, subject to all terms of use at
# http://www.image.ucar.edu/DAReS/DART/DART_download
#
# DART $Id$
# typical use with mkmf
# mkmf -t mkmf.template.xxxx ...
#
# Suggested (perhaps required) flags:
# -ffree-line-length-none handles "long" lines - i.e. longer than 72 chars
# -O2 default level of code optimization
# (remove for debugging)
#
# Suggested debugging flags:
# -g add debugging information to executable
# -Wuninitialized catch uninitialized variables
# -Wunused issue warning for unused variables - keeps code clean
# -fbacktrace runtime errors try to print out a stack backtrace
# -fbounds-check add runtime-checking for out-of-range array indices
# -ffpe-trap=invalid,zero,overflow
# stop on floating point errors
#
# Earlier versions of this mkmf file listed 'precision' as one of the options on
# the fpe-trap line. This is not recommended anymore as some of the gfortran internal
# routines will trap, as well as some perfectly valid DART computations.
#
# Generally not needed but possibly useful for non-DART code:
#
# -ffree-form forces input file to be read as free format regardless
# of what file extension it has.
#
# -fdefault-real-8 force all real variables to be real*8. not needed for DART code
# since all real variables in DART are declared with a size.
#
# Binary (unformatted) file issues:
#
# Files which use NetCDF format (e.g. input/output ensemble member model state)
# automatically convert between big-endian and little-endian number formats
# if needed, and handle differences between single and double precision reals.
#
# Ascii files (e.g. obs_seq files using ascii format, control files, scripts)
# are portable between different systems.
#
# However, binary observation sequence (obs_seq) files and other model-specific
# binary files can have some or all of the following issues:
#
# - Record Marker size
#
# Some older versions of the gfortran compiler (including 4.1.2) changed
# the record marker size to 8 bytes, which made binary files written with
# the 'unformatted' option unreadable by programs built with other compilers.
# Later versions of the compiler changed the default back to 4 bytes.
# If you have a version that defaults to 8 byte record markers, use this
# compile time flag to write files with 4 byte markers:
# -frecord-marker=4
# If you have files written by older versions of the gfortran compiler that
# cannot be read now, try this compile time flag:
# -frecord-marker=8
#
# - Real variable precision/size:
#
# If binary files are written with code that declares the variables to
# be real*8 (8 byte reals), which is the default in DART, the executable
# that reads this file must be compiled the same way. Some DART users
# redefine all DART reals to be real*4 (4 byte reals) so all code computes
# with and reads/writes single precision values. In that case, all
# executables must be compiled this same way to read binary (unformatted)
# files successfully. See the "types_mod.f90" file for this setting.
#
# - Endian issues
#
# Intel CPU chips use "little-endian" number format. IBM Power chips
# use "big-endian" number format. When binary files are written they
# default to writing numbers with the byte order native to the machine.
#
# To read DART observation sequence (obs_seq) binary files on a
# computing platform with a different "endian-ness":
#
# There is a runtime namelist item in the &obs_sequence_nml namelist
# to set a different endian for the observation sequence files only.
# This is the recommended way to read binary obs_seq files if written
# by a different platform. Options: big_endian, little_endian, native.
#
# To read other model-specific binary files on a different platform:
#
# You can convert big-endian or little-endian binary files at runtime
# on a unit-number by unit-number basis. Note that if you set all
# open file units to a different endian-ness, any new files you write
# will also have that same endian-ness. You may need to add some print
# statements in the code after opening the file to determine which
# unit numbers are being used. You can then set them in the environment
# to override the default:
#
# setenv GFORTRAN_CONVERT_UNIT 'big_endian'
# Treats ALL open file units as big_endian. (Not recommended if new files
# will be written.) Options: big_endian, little_endian, native.
#
# setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
# Treats file units 10-20 as native; the rest are 'big_endian'
#
# For more information on unit conversions:
# http://gcc.gnu.org/onlinedocs/gfortran/GFORTRAN_005fCONVERT_005fUNIT.html
#
MPIFC = mpif90
MPILD = mpif90
FC = gfortran
LD = gfortran
# DISCUSSION ABOUT NETCDF. DART works with both V3 and V4 flavors of netCDF.
# Some V4 installations also require the HDF5 libraries. Some don't.
# Some netCDF installations require both -lnetcdff and -lnetcdf, some only
# require -lnetcdf. The permutations make it difficult to cover the possible
# installations. Here are some candidates, you might just have to resort to
# trial and error:
# LIBS = -L$(NETCDF)/lib -lnetcdf
# LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf
# LIBS = -L$(NETCDF)/lib -lnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm
# LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf -lcurl -lhdf5_hl -lhdf5 -lz -lm
#
# If you get an error "ld: library not found for -lnetcdff" (note 2 f's),
# remove it from the LIBS line. The same is true for any library. If 'ld'
# does not complain - it worked.
# If your NETCDF environment variable is not set correctly,
# uncomment the following line and set value to where lib and include
# are found for the netcdf files that match this compiler.
#
# NETCDF = /opt/local
INCS = -I$(NETCDF)/include
LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf
FFLAGS = -O2 -ffree-line-length-none $(INCS)
LDFLAGS = $(FFLAGS) $(LIBS)
# FFLAGS = -g -Wuninitialized -Wunused -ffree-line-length-none -fbounds-check \
# -fbacktrace -ffpe-trap=invalid,zero,overflow $(INCS)
# <next few lines under version control, do not edit>
# $URL$
# $Revision$
# $Date$