--- MITgcm/tools/build_options/linux_amd64_sunf90 2010/03/21 22:22:52 1.3 +++ MITgcm/tools/build_options/linux_amd64_sunf90 2011/09/12 15:13:07 1.4 @@ -1,38 +1,59 @@ #!/bin/bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/build_options/linux_amd64_sunf90,v 1.3 2010/03/21 22:22:52 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/build_options/linux_amd64_sunf90,v 1.4 2011/09/12 15:13:07 jmc Exp $ # $Name: $ -FC=f77 -F90C=f90 -CC=cc -LINK=${F90C} +# Build options for the Sun fortran compiler (with and without MPI) +# on Linux AMD64 platform +# MPI : need to set environment variable MPI_INC_DIR to the include +# directory of your MPI implementation + +if test "x$MPI" = xtrue ; then + CC=${CC:=mpicc} + FC=${FC:=mpif77} + F90C=${F90C:=mpif90} + LINK=${F90C} +else + CC='cc' + FC='f77' + F90C='f90' + LINK=${F90C} +fi + FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" DEFINES='-DWORDLENGTH=4' CPP='cpp -traditional -P' -NOOPTFLAGS='-O0 -g -m64 -Kpic -xfilebyteorder=big16:%all -u -r8const' -NOOPTFILES='' EXTENDED_SRC_FLAG='-e' OMPFLAG='-xopenmp' +NOOPTFLAGS='-O0 -g' +NOOPTFILES='' + +FFLAGS="$FFLAGS -m64 -xfilebyteorder=big16:%all -u" +#FFLAGS="$FFLAGS -r8const" +# for big objects: +FFLAGS="$FFLAGS -Kpic" + if test "x$DEVEL" != x ; then - FFLAGS='-xfilebyteorder=big16:%all -u -r8const -g -xs -C -xcommonchk -xcheck=init_local -fpover' -else - FFLAGS='-xfilebyteorder=big16:%all -u -r8const' + FFLAGS="$FFLAGS -g -xs -C -xcommonchk -xcheck=init_local -fpover" + OMPFLAG='-xopenmp=noopt' fi -if test "x$IEEE" = x ; then - # No need for IEEE-754 - FOPTIM='-fast -m64 -xvector=simd -xpad=local -Kpic' - LIBS="$LIBS -lmopt" -else - # Try to follow IEEE-754 -# FOPTIM='-O0 -m64 -Kpic' - FOPTIM='-fast -m64 -xpad=local -fsimple=1 -Kpic' +if test "x$IEEE" = x ; then #- with optimisation: + FOPTIM='-fast -xvector=simd -xpad=local' + LIBS="$LIBS -lmopt" #- but get overwritten during NETCDF libs setting below +else #- no optimisation + IEEE : +# FOPTIM='-O0' + FOPTIM='-fast -xpad=local -fsimple=1' fi + F90FLAGS=$FFLAGS F90OPTIM=$FOPTIM -CFLAGS='-O3 -m64 -Kpic' +CFLAGS='-O0 -m64 -Kpic' + +INCLUDEDIRS='' +INCLUDES='' +#LIBS='' if [ "x$NETCDF_ROOT" != x ] ; then INCLUDEDIR="${NETCDF_ROOT}/include" @@ -69,3 +90,12 @@ LIBS='-L/usr/local/lib64 -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=${MPI_HEADER_FILES:='mpif.h mpiof.h'} + MPI_HEADER_FILES_INC=${MPI_HEADER_FILES_INC:='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'} +fi + +