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

Diff of /MITgcm/tools/build_options/linux_ia32_gfortran

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

revision 1.4 by edhill, Fri May 12 19:08:46 2006 UTC revision 1.10 by jmc, Tue Sep 6 23:19:30 2011 UTC
# Line 4  Line 4 
4  #  $Name$  #  $Name$
5  #  #
6    
7  #  Tested with gcc-gfortran v4.0.x as shipped with Fedora Core 4.  #  Tested with gcc-gfortran v4.1.1 on FC5, FC6, FC8, using flags
8  #  It fixes the ' \' versus ' &' terminator problem but some  #              formally for gcc-gfortran 4.3*
9  #  namelist problems remain.  The biggest seems to be the inability  #       + with gcc-gfortran v4.3.0 on FC9
10  #  of current gfortran versions to support namelist syntax such as:  
11  #  #-------
12  #     fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ',  # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
13  #  #    and generally, needs to increase the thread stack-size:
14  #  which results in run-time errors.  #   -  sh,bash:
15    #     > export OMP_NUM_THREADS=2
16    #     > export GOMP_STACKSIZE=400m
17    #   - csh,tcsh:
18    #     > setenv OMP_NUM_THREADS 2
19    #     > setenv GOMP_STACKSIZE 400m
20    #-------
21    
22    if test "x$MPI" = xtrue ; then
23      CC=${CC:=mpicc -m32}
24      FC=${FC:=mpif77 -m32}
25      F90C=${F90C:=mpif90 -m32}
26    else
27      CC=gcc
28      FC=gfortran
29      F90C=gfortran
30    fi
31    
32    DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
33    CPP='cpp -traditional -P'
34    EXTENDED_SRC_FLAG='-ffixed-line-length-132'
35    GET_FC_VERSION="--version"
36    OMPFLAG='-fopenmp'
37    
 FC=gfortran  
 CC=gcc  
 DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4 -DNML_TERMINATOR'  
 # CPP='gcc -E -traditional -P -'  
 CPP='cpp  -traditional -P'  
38  NOOPTFLAGS='-O0'  NOOPTFLAGS='-O0'
39    NOOPTFILES=''
40    
41    # Requires gfortran from 2006 onwards for -fconvert=big-endian
42    FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
43    #- otherwise, switch to the home-made byte-swap:
44    #DEFINES="-D_BYTESWAPIO $DEFINES"
45    
46  if test "x$IEEE" = x ; then  has_sse2=f
47      #  No need for IEEE-754  grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1  &&  has_sse2=t
48      #  "warning: -Wuninitialized is not supported without -O"  
49      FFLAGS='-Wunused'  if test "x$IEEE" = x ; then     #- with optimisation:
50      FOPTIM='-O3 -malign-double -funroll-loops'      FOPTIM='-O3 -funroll-loops'
51        if test "x$has_sse2" = xt ; then
52           #FOPTIM="$FOPTIM -ftree-vectorize"  # <-- was in optfile gfortran4.4
53            FOPTIM="$FOPTIM -msse -msse2"
54        fi
55  else  else
56      #  Try to follow IEEE-754    if test "x$DEVEL" = x ; then  #- no optimisation + IEEE :
     has_sse2=f  
     grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1  &&  has_sse2=t  
57      if test "x$has_sse2" = xt ; then      if test "x$has_sse2" = xt ; then
58          FFLAGS='-Wunused -mfpmath=sse -msse -msse2'          FOPTIM='-O0 -mfpmath=sse -msse -msse2'
59      else      else
60          FFLAGS='-Wunused -ffloat-store'          FOPTIM='-O0 -ffloat-store'
61      fi      fi
62      #  echo 'FFLAGS="'$FFLAGS'"'    else                          #- development/check options:
63      FOPTIM='-O0 -malign-double'      FOPTIM='-O0 -ffloat-store'
64        FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
65      fi
66  fi  fi
67    #  version 4.3.0 has problems with option "-malign-double" ;
68  if test -d /usr/include/netcdf-3 ; then  #  may want to put it back with older/newer version (when it works)
69    #FOPTIM="$FOPTIM -malign-double"
70    F90FLAGS=$FFLAGS
71    F90OPTIM=$FOPTIM
72    CFLAGS='-O0'
73    
74    INCLUDEDIRS=''
75    INCLUDES=''
76    LIBS=''
77    
78    if [ "x$NETCDF_ROOT" != x ] ; then
79        INCLUDEDIR="${NETCDF_ROOT}/include"
80        INCLUDES="-I${NETCDF_ROOT}/include"
81        LIBDIR="${NETCDF_ROOT}/lib"
82        LIBS="-L${NETCDF_ROOT}/lib"
83    elif [ "x$NETCDF_HOME" != x ]; then
84        INCLUDEDIR="${NETCDF_HOME}/include"
85        INCLUDES="-I${NETCDF_HOME}/include"
86        LIBDIR="${NETCDF_HOME}/lib"
87        LIBS="-L${NETCDF_HOME}/lib"
88    elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
89        NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
90        NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
91        INCLUDEDIR="${NETCDF_INC}"
92        INCLUDES="-I${NETCDF_INC}"
93        LIBDIR="${NETCDF_LIB}"
94        LIBS="-L${NETCDF_LIB}"
95    elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
96        INCLUDEDIR="${NETCDF_INCDIR}"
97        INCLUDES="-I${NETCDF_INCDIR}"
98        LIBDIR="${NETCDF_LIBDIR}"
99        LIBS="-L${NETCDF_LIBDIR}"
100    elif test -d /usr/include/netcdf-3 ; then
101      INCLUDES='-I/usr/include/netcdf-3'      INCLUDES='-I/usr/include/netcdf-3'
102      LIBS='-L/usr/lib/netcdf-3'      LIBS='-L/usr/lib/netcdf-3'
103  elif test -d /usr/include/netcdf ; then  elif test -d /usr/include/netcdf ; then
# Line 47  elif test -d /usr/include/netcdf ; then Line 105  elif test -d /usr/include/netcdf ; then
105  elif test -d /usr/local/netcdf ; then  elif test -d /usr/local/netcdf ; then
106      INCLUDES='-I/usr/local/netcdf/include'      INCLUDES='-I/usr/local/netcdf/include'
107      LIBS='-L/usr/local/netcdf/lib'      LIBS='-L/usr/local/netcdf/lib'
108    elif test -d /usr/local/include/netcdf.inc ; then
109        INCLUDES='-I/usr/local/include'
110        LIBS='-L/usr/local/lib'
111  fi  fi
112    
113    if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
114        INCLUDES="$INCLUDES -I$MPI_INC_DIR"
115        INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
116        MPIINCLUDEDIR="$MPI_INC_DIR"
117        MPI_HEADER_FILES='mpif.h mpiof.h'
118        MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'
119    fi

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22