| 1 |
jmc |
1.1 |
#!/bin/bash |
| 2 |
|
|
# |
| 3 |
jmc |
1.2 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/other/linux_amd64_ifort+mpi_chk,v 1.1 2011/04/27 21:26:07 jmc Exp $ |
| 4 |
jmc |
1.1 |
# $Name: $ |
| 5 |
|
|
|
| 6 |
|
|
# Adapted from linux_amd64_ifort_generic_mpi |
| 7 |
|
|
# with specific local path (=MPI_INC_DIR & NETCDF_ROOT ) for MPI & NetCDF |
| 8 |
|
|
# Tested on jmc's laptop with MPI & Multi-Threaded |
| 9 |
|
|
# using intel compiler v.10.1.012 & mpich-1.2.7 (FC.8) |
| 10 |
|
|
# v.11.1.046 & mpich-1.2.7 (FC.11) |
| 11 |
|
|
# (intel compiler, mpich & netcdf installed in /opt/intel/ ) |
| 12 |
|
|
|
| 13 |
|
|
#------- |
| 14 |
|
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
| 15 |
|
|
# and generally, needs to increase the stack-size: |
| 16 |
|
|
# - sh,bash: |
| 17 |
|
|
# > export OMP_NUM_THREADS=2 |
| 18 |
|
|
# > export KMP_STACKSIZE=400m |
| 19 |
|
|
# - csh,tcsh: |
| 20 |
|
|
# > setenv OMP_NUM_THREADS 2 |
| 21 |
|
|
# > setenv KMP_STACKSIZE 400m |
| 22 |
|
|
# NOTE: need to set KMP_STACKSIZE in ~/.tcshrc (but curiously, works |
| 23 |
|
|
# without OMP_NUM_THREADS in ~/.tcshrc). |
| 24 |
|
|
#------- |
| 25 |
|
|
|
| 26 |
|
|
# Composed and tested by ce107 on ross/weddell (Opteron system) |
| 27 |
|
|
# Should work fine on EM64T and other AMD64 compatible Intel systems |
| 28 |
|
|
# a) Processor specific flags: |
| 29 |
|
|
# 1) for more speed on Core2 processors replace -xW with -xT |
| 30 |
|
|
# 2) for more speed on Pentium4 based EM64T processors replaces -xW with -xP |
| 31 |
|
|
# b) For more speed, provided your data size doesn't exceed 2GB you can |
| 32 |
|
|
# remove -fPIC which carries a performance penalty of 2-6%. |
| 33 |
|
|
# c) Provided that the libraries you link to are compiled with -fPIC this |
| 34 |
|
|
# optfile should work. |
| 35 |
|
|
# d) You can replace -fPIC with -mcmodel=medium which may perform faster |
| 36 |
|
|
# than -fPIC and still support data sizes over 2GB per process but all |
| 37 |
|
|
# the libraries you link to must be compiled with -fPIC or -mcmodel=medium |
| 38 |
|
|
# e) Changed from -O3 to -O2 to avoid buggy Intel v.10 compilers. Speed |
| 39 |
|
|
# impact appears to be minimal. |
| 40 |
|
|
# |
| 41 |
|
|
# DON'T FORGET to set environment variable MPI_INC_DIR to the include |
| 42 |
|
|
# directory of your MPI implementation |
| 43 |
|
|
|
| 44 |
|
|
NETCDF_ROOT='/opt/intel/netcdf-4.0.1/11.1' |
| 45 |
|
|
MPI_INC_DIR='/opt/intel/mpich-1.2.7p1_ic-11.1.046/include' |
| 46 |
|
|
|
| 47 |
|
|
FC=mpif77 |
| 48 |
|
|
F90C='mpif90 -fixed' |
| 49 |
|
|
CC=mpicc |
| 50 |
|
|
LINK='mpif90 -i-dynamic -no-ipo' |
| 51 |
|
|
#LINK='mpif90 -i-static -no-ipo' |
| 52 |
|
|
|
| 53 |
|
|
DEFINES='-DALLOW_USE_MPI -DALWAYS_USE_MPI -DWORDLENGTH=4' |
| 54 |
|
|
CPP='cpp -traditional -P' |
| 55 |
|
|
F90FIXEDFORMAT='-fixed -Tf' |
| 56 |
|
|
EXTENDED_SRC_FLAG='-132' |
| 57 |
jmc |
1.2 |
GET_FC_VERSION="--version" |
| 58 |
jmc |
1.1 |
OMPFLAG='-openmp' |
| 59 |
|
|
|
| 60 |
|
|
NOOPTFLAGS='-O0 -g -m64' |
| 61 |
|
|
NOOPTFILES='' |
| 62 |
|
|
|
| 63 |
|
|
INCLUDEDIRS='' |
| 64 |
|
|
INCLUDES='' |
| 65 |
|
|
LIBS='' |
| 66 |
|
|
|
| 67 |
|
|
if test "x$DEVEL" != x ; then |
| 68 |
|
|
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC -O0 -g -noalign -fp-stack-check -check all -fpe0 -traceback -ftrapuv -fp-model except -warn all" |
| 69 |
|
|
else |
| 70 |
|
|
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC" |
| 71 |
|
|
fi |
| 72 |
|
|
#- might want to use '-r8' for fizhi pkg: |
| 73 |
|
|
#FFLAGS="$FFLAGS -r8" |
| 74 |
|
|
|
| 75 |
|
|
if test "x$IEEE" = x ; then |
| 76 |
|
|
# No need for IEEE-754 |
| 77 |
|
|
FOPTIM='-O2 -align -xW -ip' |
| 78 |
|
|
else |
| 79 |
|
|
# Try to follow IEEE-754 |
| 80 |
|
|
FOPTIM='-O0 -xW -ip -fp-model strict' |
| 81 |
|
|
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
| 82 |
|
|
#FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all -ftrapuv" |
| 83 |
|
|
#FOPTIM="$FOPTIM -noalign -g -traceback" |
| 84 |
|
|
FOPTIM='-O0 -xW -ip' |
| 85 |
|
|
FFLAGS="$FFLAGS -warn all -warn nounused" |
| 86 |
|
|
fi |
| 87 |
|
|
F90FLAGS=$FFLAGS |
| 88 |
|
|
F90OPTIM=$FOPTIM |
| 89 |
|
|
CFLAGS='-O0 -ip -fPIC' |
| 90 |
|
|
|
| 91 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
| 92 |
|
|
INCLUDEDIRS="${NETCDF_ROOT}/include" |
| 93 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
| 94 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
| 95 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
| 96 |
|
|
INCLUDEDIRS="${NETCDF_HOME}/include" |
| 97 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
| 98 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
| 99 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
| 100 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
| 101 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
| 102 |
|
|
INCLUDEDIRS="${NETCDF_INC}" |
| 103 |
|
|
INCLUDES="-I${NETCDF_INC}" |
| 104 |
|
|
LIBS="-L${NETCDF_LIB}" |
| 105 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
| 106 |
|
|
INCLUDEDIRS="${NETCDF_INCDIR}" |
| 107 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
| 108 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
| 109 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
| 110 |
|
|
INCLUDEDIRS='/usr/include/netcdf-3' |
| 111 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
| 112 |
|
|
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
| 113 |
|
|
elif test -d /usr/include/netcdf ; then |
| 114 |
|
|
INCLUDEDIRS='/usr/include/netcdf' |
| 115 |
|
|
INCLUDES='-I/usr/include/netcdf' |
| 116 |
|
|
elif test -d /usr/local/netcdf ; then |
| 117 |
|
|
INCLUDEDIRS='/usr/include/netcdf/include' |
| 118 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
| 119 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
| 120 |
|
|
elif test -d /usr/local/include/netcdf.inc ; then |
| 121 |
|
|
INCLUDEDIRS='/usr/local/include' |
| 122 |
|
|
INCLUDES='-I/usr/local/include' |
| 123 |
|
|
LIBS='-L/usr/local/lib64' |
| 124 |
|
|
fi |
| 125 |
|
|
|
| 126 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
| 127 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
| 128 |
|
|
MPIINCLUDEDIR="$MPI_INC_DIR" |
| 129 |
|
|
MPI_HEADER_FILES='mpif.h mpiof.h' |
| 130 |
|
|
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |