/[MITgcm]/MITgcm/tools/build_options/linux_amd64_gfortran
ViewVC logotype

Annotation of /MITgcm/tools/build_options/linux_amd64_gfortran

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.23 - (hide annotations) (download)
Wed Nov 27 22:07:11 2013 UTC (10 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t
Changes since 1.22: +4 -2 lines
- simplify Warnings options (-ieee & -devel cases)

1 edhill 1.1 #!/bin/bash
2 jmc 1.7
3 jmc 1.23 # $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.22 2013/09/23 23:32:59 jmc Exp $
4 edhill 1.1 # $Name: $
5 jmc 1.7
6 jmc 1.14 # Build options for gfortran compiler (GNU) on Linux AMD64 platform
7     #
8 jmc 1.5 # Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8
9     # with gcc-gfortran v4.3.x as shipped with Fedora Core 9,10
10 jmc 1.14 #
11     # OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10
12     # on baudelaire with gcc-gfortran v4.4.5 as shipped with FC 13
13     # on danton with gcc-gfortran v4.5.1 as shipped with FC 14
14 jmc 1.21 # with gcc-gfortran v4.7.x as shipped with FC 17
15     # with gcc-gfortran v4.8.1 as shipped with FC 19
16 jmc 1.14 # on acesgrid with gcc-gfortran v4.6.0 as shipped with FC 15
17     #
18     # MPI : Tested on acesgrid (Fedora Core 15), using:
19     # module load gcc (Version 4.6.0)
20     # and with mpich1:
21     # module load mvapich
22     # or with mpich2:
23     # module load mvapich2
24     # or with openmpi:
25     # module load openmpi
26     # and on baudelaire.csail.mit.edu (FC13), using:
27     # export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3
28     # export MPI_INC_DIR=$MPI_GCC_DIR/include
29     # export PATH=$MPI_GCC_DIR/bin:$PATH
30 heimbach 1.19 #
31 jmc 1.20 # and on IRIDIS at Southampton
32 heimbach 1.19 # http://www.southampton.ac.uk/isolutions/computing/hpc/iridis/
33     # with
34     # module load openmpi/1.4.3/gcc-4.3.3
35     # and
36     # export MPI_INC_DIR=$MPIROOT/include
37 edhill 1.1
38 jmc 1.7 #-------
39 jmc 1.10 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
40 jmc 1.7 # and generally, needs to increase the thread stack-size:
41     # - sh,bash:
42     # > export OMP_NUM_THREADS=2
43     # > export GOMP_STACKSIZE=400m
44     # - csh,tcsh:
45     # > setenv OMP_NUM_THREADS 2
46     # > setenv GOMP_STACKSIZE 400m
47     #-------
48 edhill 1.1
49 jmc 1.14 if test "x$MPI" = xtrue ; then
50     CC=${CC:=mpicc}
51     FC=${FC:=mpif77}
52     F90C=${F90C:=mpif90}
53     else
54     CC=gcc
55     FC=gfortran
56     F90C=gfortran
57     fi
58    
59 ce107 1.2 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
60 jmc 1.4 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
61 utke 1.15 F90FIXEDFORMAT='-ffixed-form'
62 jmc 1.12 GET_FC_VERSION="--version"
63 jmc 1.7 OMPFLAG='-fopenmp'
64 edhill 1.1
65 jmc 1.14 NOOPTFLAGS='-O0'
66     NOOPTFILES=''
67 ce107 1.2
68 jmc 1.21 CFLAGS='-O0'
69     #- Requires gfortran from 2006 onwards for -fconvert=big-endian
70 ce107 1.2 FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
71 jmc 1.21 #- for big setups, compile & link with "-fPIC" or set memory-model to "medium":
72 jmc 1.22 #CFLAGS="$CFLAGS -fPIC"
73     #FFLAGS="$FFLAGS -fPIC"
74 jmc 1.21 #- with FC 19, need to use this without -fPIC (which cancels -mcmodel option):
75 jmc 1.22 CFLAGS="$CFLAGS -mcmodel=medium"
76     FFLAGS="$FFLAGS -mcmodel=medium"
77 jmc 1.14 #- might want to use '-fdefault-real-8' for fizhi pkg:
78 jmc 1.18 #FFLAGS="$FFLAGS -fdefault-real-8 -fdefault-double-8"
79 ce107 1.2
80 jmc 1.14 if test "x$IEEE" = x ; then #- with optimisation:
81     #- full optimisation
82 ce107 1.3 FOPTIM='-O3 -funroll-loops'
83 jmc 1.14 NOOPTFILES="$NOOPTFILES ini_masks_etc.F"
84     #- can use -O2 (safe optimisation) to avoid Pb with some gcc version of -O3:
85     #FOPTIM='-O2 -funroll-loops'
86 edhill 1.1 else
87 jmc 1.14 # these may also be useful, but require specific gfortran versions:
88     # -Wnonstd-intrinsics for gfortran <= 4.3
89     # -Wintrinsics-std for gfortran >= 4.4
90     # -Wno-tabs for gfortran >= 4.3
91 jmc 1.23 #FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
92     #- or simply:
93     FFLAGS="$FFLAGS -Wall -Wno-unused-dummy-argument"
94 jmc 1.14 #- to get plenty of warnings: -Wall -Wextra (older form: -Wall -W) or:
95     #FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
96     if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
97     FOPTIM='-O0'
98     else #- development/check options:
99 jmc 1.17 FOPTIM='-O0 -g -fbounds-check'
100     FOPTIM="$FOPTIM -ffpe-trap=invalid,zero,overflow -finit-real=inf"
101 jmc 1.14 fi
102 edhill 1.1 fi
103 jmc 1.14
104 ce107 1.2 F90FLAGS=$FFLAGS
105     F90OPTIM=$FOPTIM
106    
107 jmc 1.14 INCLUDEDIRS=''
108     INCLUDES=''
109     LIBS=''
110    
111 ce107 1.2 if [ "x$NETCDF_ROOT" != x ] ; then
112     INCLUDEDIR="${NETCDF_ROOT}/include"
113     INCLUDES="-I${NETCDF_ROOT}/include"
114     LIBDIR="${NETCDF_ROOT}/lib"
115     LIBS="-L${NETCDF_ROOT}/lib"
116     elif [ "x$NETCDF_HOME" != x ]; then
117     INCLUDEDIR="${NETCDF_HOME}/include"
118     INCLUDES="-I${NETCDF_HOME}/include"
119     LIBDIR="${NETCDF_HOME}/lib"
120     LIBS="-L${NETCDF_HOME}/lib"
121     elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
122     NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
123     NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
124     INCLUDEDIR="${NETCDF_INC}"
125     INCLUDES="-I${NETCDF_INC}"
126     LIBDIR="${NETCDF_LIB}"
127     LIBS="-L${NETCDF_LIB}"
128     elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
129     INCLUDEDIR="${NETCDF_INCDIR}"
130     INCLUDES="-I${NETCDF_INCDIR}"
131     LIBDIR="${NETCDF_LIBDIR}"
132     LIBS="-L${NETCDF_LIBDIR}"
133     elif test -d /usr/include/netcdf-3 ; then
134 edhill 1.1 INCLUDES='-I/usr/include/netcdf-3'
135     LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
136     elif test -d /usr/include/netcdf ; then
137     INCLUDES='-I/usr/include/netcdf'
138     elif test -d /usr/local/netcdf ; then
139     INCLUDES='-I/usr/local/netcdf/include'
140     LIBS='-L/usr/local/netcdf/lib'
141 ce107 1.2 elif test -d /usr/local/include/netcdf.inc ; then
142     INCLUDES='-I/usr/local/include'
143     LIBS='-L/usr/local/lib64'
144 mlosch 1.16 elif test -d /usr/include/netcdf.inc ; then
145     INCLUDES='-I/usr/include'
146     LIBS='-L/usr/lib64'
147 edhill 1.1 fi
148 jmc 1.14
149     if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
150     INCLUDES="$INCLUDES -I$MPI_INC_DIR"
151     INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
152 jmc 1.20 #- used for parallel (MPI) DIVA
153 jmc 1.14 MPIINCLUDEDIR="$MPI_INC_DIR"
154 jmc 1.20 #MPI_HEADER_FILES='mpif.h mpiof.h'
155 jmc 1.14 fi

  ViewVC Help
Powered by ViewVC 1.1.22