4 |
# $Name$ |
# $Name$ |
5 |
# |
# |
6 |
|
|
7 |
# This was tested with gcc-gfortran v4.0.0 as shipped in Fedora Core |
# Tested with gcc-gfortran v4.1.1 on FC5, FC6, FC8, using flags |
8 |
# 4-test-2. MITgcm successfully compiled but the gfortran-built |
# formally for gcc-gfortran 4.3* |
9 |
# mitgcmuv binary failed to read the "eedata" file. The gfortran |
# + with gcc-gfortran v4.3.0 on FC9 |
10 |
# docs make it clear that there are known NAMELIST bugs in curreent |
# It fixes the ' \' versus ' &' terminator problem ; |
11 |
# versions of gfortran and that users should turn to g77 if their |
# some namelist problems remain with old version (The biggest seems |
12 |
# code encounters these bugs. Later versions of gfortran will |
# to be the inability to support namelist syntax such as: |
13 |
# supposedly fix the NAMELIST implementation. |
# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', |
14 |
|
# which results in run-time errors). |
15 |
|
|
16 |
|
#------- |
17 |
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
18 |
|
# and generally, needs to increase the thread stack-size: |
19 |
|
# - sh,bash: |
20 |
|
# > export OMP_NUM_THREADS=2 |
21 |
|
# > export GOMP_STACKSIZE=400m |
22 |
|
# - csh,tcsh: |
23 |
|
# > setenv OMP_NUM_THREADS 2 |
24 |
|
# > setenv GOMP_STACKSIZE 400m |
25 |
|
#------- |
26 |
|
|
27 |
FC=gfortran |
FC=gfortran |
28 |
|
F90C=gfortran |
29 |
CC=gcc |
CC=gcc |
30 |
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4' |
DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' |
31 |
CPP='cpp -traditional -P' |
CPP='cpp -traditional -P' |
32 |
NOOPTFLAGS='-O0' |
NOOPTFLAGS='-O0' |
33 |
|
EXTENDED_SRC_FLAG='-ffixed-line-length-132' |
34 |
|
GET_FC_VERSION="--version" |
35 |
|
OMPFLAG='-fopenmp' |
36 |
|
|
37 |
|
if test "x$DEVEL" != x ; then |
38 |
|
FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' |
39 |
|
else |
40 |
|
FFLAGS='' |
41 |
|
fi |
42 |
|
|
43 |
|
# Requires gfortran from 2006 onwards for -fconvert=big-endian |
44 |
|
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" |
45 |
|
#- otherwise, switch to the home-made byte-swap: |
46 |
|
#DEFINES="-D_BYTESWAPIO $DEFINES" |
47 |
|
|
48 |
if test "x$IEEE" = x ; then |
if test "x$IEEE" = x ; then |
49 |
# No need for IEEE-754 |
# No need for IEEE-754 |
50 |
FFLAGS='-Wimplicit -Wunused -Wuninitialized' |
FOPTIM='-O3 -funroll-loops' |
|
FOPTIM='-O3 -malign-double -funroll-loops' |
|
51 |
else |
else |
52 |
# Try to follow IEEE-754 |
# Try to follow IEEE-754 |
53 |
has_sse2=f |
has_sse2=f |
54 |
grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1 && has_sse2=t |
grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1 && has_sse2=t |
55 |
if test "x$has_sse2" = xt ; then |
if test "x$has_sse2" = xt ; then |
56 |
FFLAGS='-Wimplicit -Wunused -mfpmath=sse -msse -msse2' |
FOPTIM='-O0 -mfpmath=sse -msse -msse2' |
57 |
else |
else |
58 |
FFLAGS='-Wimplicit -Wunused -ffloat-store' |
FOPTIM='-O0 -ffloat-store' |
59 |
fi |
fi |
|
# echo 'FFLAGS="'$FFLAGS'"' |
|
|
FOPTIM='-O0 -malign-double' |
|
60 |
fi |
fi |
61 |
|
# version 4.3.0 has problems with option "-malign-double" ; |
62 |
if test -d /usr/include/netcdf-3 ; then |
# may want to put it back with older/newer version (when it works) |
63 |
|
#FOPTIM="$FOPTIM -malign-double" |
64 |
|
F90FLAGS=$FFLAGS |
65 |
|
F90OPTIM=$FOPTIM |
66 |
|
CFLAGS=$FOPTIM |
67 |
|
|
68 |
|
if [ "x$NETCDF_ROOT" != x ] ; then |
69 |
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
70 |
|
INCLUDES="-I${NETCDF_ROOT}/include" |
71 |
|
LIBDIR="${NETCDF_ROOT}/lib" |
72 |
|
LIBS="-L${NETCDF_ROOT}/lib" |
73 |
|
elif [ "x$NETCDF_HOME" != x ]; then |
74 |
|
INCLUDEDIR="${NETCDF_HOME}/include" |
75 |
|
INCLUDES="-I${NETCDF_HOME}/include" |
76 |
|
LIBDIR="${NETCDF_HOME}/lib" |
77 |
|
LIBS="-L${NETCDF_HOME}/lib" |
78 |
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
79 |
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
80 |
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
81 |
|
INCLUDEDIR="${NETCDF_INC}" |
82 |
|
INCLUDES="-I${NETCDF_INC}" |
83 |
|
LIBDIR="${NETCDF_LIB}" |
84 |
|
LIBS="-L${NETCDF_LIB}" |
85 |
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
86 |
|
INCLUDEDIR="${NETCDF_INCDIR}" |
87 |
|
INCLUDES="-I${NETCDF_INCDIR}" |
88 |
|
LIBDIR="${NETCDF_LIBDIR}" |
89 |
|
LIBS="-L${NETCDF_LIBDIR}" |
90 |
|
elif test -d /usr/include/netcdf-3 ; then |
91 |
INCLUDES='-I/usr/include/netcdf-3' |
INCLUDES='-I/usr/include/netcdf-3' |
92 |
LIBS='-L/usr/lib/netcdf-3' |
LIBS='-L/usr/lib/netcdf-3' |
93 |
elif test -d /usr/include/netcdf ; then |
elif test -d /usr/include/netcdf ; then |
95 |
elif test -d /usr/local/netcdf ; then |
elif test -d /usr/local/netcdf ; then |
96 |
INCLUDES='-I/usr/local/netcdf/include' |
INCLUDES='-I/usr/local/netcdf/include' |
97 |
LIBS='-L/usr/local/netcdf/lib' |
LIBS='-L/usr/local/netcdf/lib' |
98 |
|
elif test -d /usr/local/include/netcdf.inc ; then |
99 |
|
INCLUDES='-I/usr/local/include' |
100 |
|
LIBS='-L/usr/local/lib' |
101 |
fi |
fi |
|
|
|