/[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.14 - (hide annotations) (download)
Sun Aug 21 21:06:51 2011 UTC (12 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63b
Changes since 1.13: +64 -24 lines
towards single optfile for MPI and non-MPI built:
 merge +mpi_generic version into standard optfile (linux_amd64_gfortran):
  * move IEEE flags to DEVEL section; take IEEE flags from +mpi_generic ;
  * FAST case: for now, keep -O3 with ini_masks_etc.F in NOOPTFILES list;
 and use "-devel" testreport option for standard testing on baudelaire.

1 edhill 1.1 #!/bin/bash
2 jmc 1.7
3 jmc 1.14 # $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.13 2011/07/07 22:46:44 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     # on acesgrid with gcc-gfortran v4.6.0 as shipped with FC 15
15     #
16     # MPI : Tested on acesgrid (Fedora Core 15), using:
17     # module load gcc (Version 4.6.0)
18     # and with mpich1:
19     # module load mvapich
20     # or with mpich2:
21     # module load mvapich2
22     # or with openmpi:
23     # module load openmpi
24     # and on baudelaire.csail.mit.edu (FC13), using:
25     # export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3
26     # export MPI_INC_DIR=$MPI_GCC_DIR/include
27     # export PATH=$MPI_GCC_DIR/bin:$PATH
28 edhill 1.1
29 jmc 1.7 #-------
30 jmc 1.10 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
31 jmc 1.7 # and generally, needs to increase the thread stack-size:
32     # - sh,bash:
33     # > export OMP_NUM_THREADS=2
34     # > export GOMP_STACKSIZE=400m
35     # - csh,tcsh:
36     # > setenv OMP_NUM_THREADS 2
37     # > setenv GOMP_STACKSIZE 400m
38     #-------
39 edhill 1.1
40 jmc 1.14 if test "x$MPI" = xtrue ; then
41     CC=${CC:=mpicc}
42     FC=${FC:=mpif77}
43     F90C=${F90C:=mpif90}
44     else
45     CC=gcc
46     FC=gfortran
47     F90C=gfortran
48     fi
49    
50 ce107 1.2 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
51 jmc 1.14 CPP='cpp -traditional -P'
52 jmc 1.4 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
53 jmc 1.12 GET_FC_VERSION="--version"
54 jmc 1.7 OMPFLAG='-fopenmp'
55 edhill 1.1
56 jmc 1.14 NOOPTFLAGS='-O0'
57     NOOPTFILES=''
58 ce107 1.2
59     # Requires gfortran from 2006 onwards for -fconvert=big-endian
60     FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
61 jmc 1.10 # for big objects:
62     FFLAGS="$FFLAGS -fPIC"
63 jmc 1.14 #- might want to use '-fdefault-real-8' for fizhi pkg:
64     #FFLAGS="$FFLAGS -fdefault-real-8"
65 ce107 1.2
66 jmc 1.14 if test "x$IEEE" = x ; then #- with optimisation:
67     #- full optimisation
68 ce107 1.3 FOPTIM='-O3 -funroll-loops'
69 jmc 1.14 NOOPTFILES="$NOOPTFILES ini_masks_etc.F"
70     #- can use -O2 (safe optimisation) to avoid Pb with some gcc version of -O3:
71     #FOPTIM='-O2 -funroll-loops'
72 edhill 1.1 else
73 jmc 1.14 # these may also be useful, but require specific gfortran versions:
74     # -Wnonstd-intrinsics for gfortran <= 4.3
75     # -Wintrinsics-std for gfortran >= 4.4
76     # -Wno-tabs for gfortran >= 4.3
77 jahn 1.6 FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
78 jmc 1.14 #- to get plenty of warnings: -Wall -Wextra (older form: -Wall -W) or:
79     #FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
80     if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
81     FOPTIM='-O0'
82     else #- development/check options:
83 ce107 1.2 FOPTIM='-O0'
84 jmc 1.5 FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
85 jmc 1.14 fi
86 edhill 1.1 fi
87 jmc 1.14
88 ce107 1.2 F90FLAGS=$FFLAGS
89     F90OPTIM=$FOPTIM
90 jmc 1.10 CFLAGS='-O0 -fPIC'
91 ce107 1.2
92 jmc 1.14 INCLUDEDIRS=''
93     INCLUDES=''
94     LIBS=''
95    
96 ce107 1.2 if [ "x$NETCDF_ROOT" != x ] ; then
97     INCLUDEDIR="${NETCDF_ROOT}/include"
98     INCLUDES="-I${NETCDF_ROOT}/include"
99     LIBDIR="${NETCDF_ROOT}/lib"
100     LIBS="-L${NETCDF_ROOT}/lib"
101     elif [ "x$NETCDF_HOME" != x ]; then
102     INCLUDEDIR="${NETCDF_HOME}/include"
103     INCLUDES="-I${NETCDF_HOME}/include"
104     LIBDIR="${NETCDF_HOME}/lib"
105     LIBS="-L${NETCDF_HOME}/lib"
106     elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
107     NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
108     NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
109     INCLUDEDIR="${NETCDF_INC}"
110     INCLUDES="-I${NETCDF_INC}"
111     LIBDIR="${NETCDF_LIB}"
112     LIBS="-L${NETCDF_LIB}"
113     elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
114     INCLUDEDIR="${NETCDF_INCDIR}"
115     INCLUDES="-I${NETCDF_INCDIR}"
116     LIBDIR="${NETCDF_LIBDIR}"
117     LIBS="-L${NETCDF_LIBDIR}"
118     elif test -d /usr/include/netcdf-3 ; then
119 edhill 1.1 INCLUDES='-I/usr/include/netcdf-3'
120     LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
121     elif test -d /usr/include/netcdf ; then
122     INCLUDES='-I/usr/include/netcdf'
123     elif test -d /usr/local/netcdf ; then
124     INCLUDES='-I/usr/local/netcdf/include'
125     LIBS='-L/usr/local/netcdf/lib'
126 ce107 1.2 elif test -d /usr/local/include/netcdf.inc ; then
127     INCLUDES='-I/usr/local/include'
128     LIBS='-L/usr/local/lib64'
129 edhill 1.1 fi
130 jmc 1.14
131     if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
132     INCLUDES="$INCLUDES -I$MPI_INC_DIR"
133     INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
134     MPIINCLUDEDIR="$MPI_INC_DIR"
135     MPI_HEADER_FILES='mpif.h mpiof.h'
136     MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'
137     fi

  ViewVC Help
Powered by ViewVC 1.1.22