--- MITgcm/tools/build_options/linux_ia32_gfortran 2011/08/12 23:09:08 1.9 +++ MITgcm/tools/build_options/linux_ia32_gfortran 2011/09/06 23:19:30 1.10 @@ -1,17 +1,12 @@ #!/bin/bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/build_options/linux_ia32_gfortran,v 1.9 2011/08/12 23:09:08 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/build_options/linux_ia32_gfortran,v 1.10 2011/09/06 23:19:30 jmc Exp $ # $Name: $ # # Tested with gcc-gfortran v4.1.1 on FC5, FC6, FC8, using flags # formally for gcc-gfortran 4.3* # + with gcc-gfortran v4.3.0 on FC9 -# It fixes the ' \' versus ' &' terminator problem ; -# some namelist problems remain with old version (The biggest seems -# to be the inability to support namelist syntax such as: -# fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ', -# which results in run-time errors). #------- # run with OpenMP: needs to set environment var. OMP_NUM_THREADS @@ -24,46 +19,61 @@ # > setenv GOMP_STACKSIZE 400m #------- -FC=gfortran -F90C=gfortran -CC=gcc +if test "x$MPI" = xtrue ; then + CC=${CC:=mpicc -m32} + FC=${FC:=mpif77 -m32} + F90C=${F90C:=mpif90 -m32} +else + CC=gcc + FC=gfortran + F90C=gfortran +fi + DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' CPP='cpp -traditional -P' -NOOPTFLAGS='-O0' EXTENDED_SRC_FLAG='-ffixed-line-length-132' GET_FC_VERSION="--version" OMPFLAG='-fopenmp' -if test "x$DEVEL" != x ; then - FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check' -else - FFLAGS='' -fi +NOOPTFLAGS='-O0' +NOOPTFILES='' # Requires gfortran from 2006 onwards for -fconvert=big-endian FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" #- otherwise, switch to the home-made byte-swap: #DEFINES="-D_BYTESWAPIO $DEFINES" -if test "x$IEEE" = x ; then - # No need for IEEE-754 +has_sse2=f +grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1 && has_sse2=t + +if test "x$IEEE" = x ; then #- with optimisation: FOPTIM='-O3 -funroll-loops' + if test "x$has_sse2" = xt ; then + #FOPTIM="$FOPTIM -ftree-vectorize" # <-- was in optfile gfortran4.4 + FOPTIM="$FOPTIM -msse -msse2" + fi else - # Try to follow IEEE-754 - has_sse2=f - grep flags /proc/cpuinfo | grep sse2 > /dev/null 2>&1 && has_sse2=t + if test "x$DEVEL" = x ; then #- no optimisation + IEEE : if test "x$has_sse2" = xt ; then FOPTIM='-O0 -mfpmath=sse -msse -msse2' else FOPTIM='-O0 -ffloat-store' fi + else #- development/check options: + FOPTIM='-O0 -ffloat-store' + FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check" + fi fi # version 4.3.0 has problems with option "-malign-double" ; # may want to put it back with older/newer version (when it works) #FOPTIM="$FOPTIM -malign-double" F90FLAGS=$FFLAGS F90OPTIM=$FOPTIM -CFLAGS=$FOPTIM +CFLAGS='-O0' + +INCLUDEDIRS='' +INCLUDES='' +LIBS='' if [ "x$NETCDF_ROOT" != x ] ; then INCLUDEDIR="${NETCDF_ROOT}/include" @@ -99,3 +109,11 @@ INCLUDES='-I/usr/local/include' LIBS='-L/usr/local/lib' fi + +if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then + INCLUDES="$INCLUDES -I$MPI_INC_DIR" + INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" + MPIINCLUDEDIR="$MPI_INC_DIR" + MPI_HEADER_FILES='mpif.h mpiof.h' + MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' +fi