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

Diff of /MITgcm/tools/build_options/linux_amd64_gfortran

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

revision 1.13 by jmc, Thu Jul 7 22:46:44 2011 UTC revision 1.14 by jmc, Sun Aug 21 21:06:51 2011 UTC
# Line 3  Line 3 
3  #  $Header$  #  $Header$
4  #  $Name$  #  $Name$
5    
6    # Build options for gfortran compiler (GNU) on Linux AMD64 platform
7    #
8  #  Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8  #  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  #         with gcc-gfortran v4.3.x as shipped with Fedora Core 9,10
10    #
11  # OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10  # OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10
12  #          and on baudelaire with gcc-gfortran v4.4.5 as shipped with FC 13  #              on baudelaire with gcc-gfortran v4.4.5 as shipped with FC 13
13  #          also on danton    with gcc-gfortran v4.5.1 as shipped with FC 14  #              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    
29  #-------  #-------
30  # run with OpenMP: needs to set environment var. OMP_NUM_THREADS  # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
31  #    and generally, needs to increase the thread stack-size:  #    and generally, needs to increase the thread stack-size:
# Line 20  Line 37 
37  #     > setenv GOMP_STACKSIZE 400m  #     > setenv GOMP_STACKSIZE 400m
38  #-------  #-------
39    
40  FC=gfortran  if test "x$MPI" = xtrue ; then
41  F90C=gfortran    CC=${CC:=mpicc}
42  CC=gcc    FC=${FC:=mpif77}
43      F90C=${F90C:=mpif90}
44    else
45      CC=gcc
46      FC=gfortran
47      F90C=gfortran
48    fi
49    
50  DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'  DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
51  CPP='cpp  -traditional -P'  CPP='cpp -traditional -P'
 NOOPTFLAGS='-O0'  
52  EXTENDED_SRC_FLAG='-ffixed-line-length-132'  EXTENDED_SRC_FLAG='-ffixed-line-length-132'
53  GET_FC_VERSION="--version"  GET_FC_VERSION="--version"
54  OMPFLAG='-fopenmp'  OMPFLAG='-fopenmp'
55    
56  if test "x$DEVEL" != x ; then  NOOPTFLAGS='-O0'
57      FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check'  NOOPTFILES=''
 else  
     FFLAGS=''  
 fi  
58    
59  # Requires gfortran from 2006 onwards for -fconvert=big-endian  # Requires gfortran from 2006 onwards for -fconvert=big-endian
60  FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"  FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
61  # for big objects:  # for big objects:
62  FFLAGS="$FFLAGS -fPIC"  FFLAGS="$FFLAGS -fPIC"
63    #- might want to use '-fdefault-real-8' for fizhi pkg:
64    #FFLAGS="$FFLAGS -fdefault-real-8"
65    
66  if test "x$IEEE" = x ; then  if test "x$IEEE" = x ; then     #- with optimisation:
67      #  No need for IEEE-754     #- full optimisation
68      FOPTIM='-O3 -funroll-loops'      FOPTIM='-O3 -funroll-loops'
69        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  else  else
73      #  Try to follow IEEE-754     # these may also be useful, but require specific gfortran versions:
74      # these may also be useful, but require specific gfortran versions:     # -Wnonstd-intrinsics  for gfortran <= 4.3
75      # -Wnonstd-intrinsics  for gfortran <= 4.3     # -Wintrinsics-std     for gfortran >= 4.4
76      # -Wintrinsics-std     for gfortran >= 4.4     # -Wno-tabs            for gfortran >= 4.3
     # -Wno-tabs            for gfortran >= 4.3  
77      FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"      FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
78  #   to get plenty of warnings :     #- to get plenty of warnings: -Wall -Wextra (older form: -Wall -W) or:
79  #   FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"     #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      FOPTIM='-O0'      FOPTIM='-O0'
 #   for automatic testing with testreport (but no relation with IEEE arithmetic):  
84      FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"      FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
85      fi
86  fi  fi
87    
88  F90FLAGS=$FFLAGS  F90FLAGS=$FFLAGS
89  F90OPTIM=$FOPTIM  F90OPTIM=$FOPTIM
90  CFLAGS='-O0 -fPIC'  CFLAGS='-O0 -fPIC'
91    
92    INCLUDEDIRS=''
93    INCLUDES=''
94    LIBS=''
95    
96  if [ "x$NETCDF_ROOT" != x ] ; then  if [ "x$NETCDF_ROOT" != x ] ; then
97      INCLUDEDIR="${NETCDF_ROOT}/include"      INCLUDEDIR="${NETCDF_ROOT}/include"
98      INCLUDES="-I${NETCDF_ROOT}/include"      INCLUDES="-I${NETCDF_ROOT}/include"
# Line 95  elif test -d /usr/local/include/netcdf.i Line 127  elif test -d /usr/local/include/netcdf.i
127      INCLUDES='-I/usr/local/include'      INCLUDES='-I/usr/local/include'
128      LIBS='-L/usr/local/lib64'      LIBS='-L/usr/local/lib64'
129  fi  fi
130    
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

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22