1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_ifort11,v 1.4 2011/09/07 23:20:47 jmc Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
# Constantinos Evangelinos |
7 |
# |
8 |
# Build options for the intel 11 fortran compiler (with/without MPI) |
9 |
# |
10 |
# with MPI : need to set environment variable MPI_INC_DIR to the include |
11 |
# directory of your MPI implementation |
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 |
#------- |
23 |
|
24 |
if test "x$MPI" = xtrue ; then |
25 |
CC=${CC:=mpicc} |
26 |
FC=${FC:=mpif77} |
27 |
F90C=${F90C:=mpif90} |
28 |
LINK="$F90C -shared-intel" |
29 |
else |
30 |
CC=icc |
31 |
FC=ifort |
32 |
F90C=ifort |
33 |
LINK=$FC |
34 |
fi |
35 |
|
36 |
DEFINES='-DWORDLENGTH=4' |
37 |
CPP='cpp -traditional -P' |
38 |
F90FIXEDFORMAT='-fixed -Tf' |
39 |
EXTENDED_SRC_FLAG='-132' |
40 |
OMPFLAG='-openmp' |
41 |
|
42 |
NOOPTFLAGS='-O0 -g' |
43 |
NOOPTFILES='' |
44 |
|
45 |
FFLAGS="$FFLAGS -convert big_endian -assume byterecl" |
46 |
#- might want to use '-r8' for fizhi pkg: |
47 |
#FFLAGS="$FFLAGS -r8" |
48 |
|
49 |
if test "x$GENERIC" != x ; then |
50 |
PROCF='-mia32 -axSSE4.2,SSE4.1,SSSE3,SSE3,SSE2' |
51 |
else |
52 |
PROCF=-xHost |
53 |
fi |
54 |
|
55 |
if test "x$DEVEL" = x ; then |
56 |
FFLAGS="$FFLAGS -W0 -WB" |
57 |
else |
58 |
FFLAGS="$FFLAGS -O0 -g -debug all -debug-parameters all -noalign -fp-stack-check -check all -fpe0 -traceback -ftrapuv -fp-model strict -warn all" |
59 |
fi |
60 |
|
61 |
# Note that the -mp switch is for ieee "maintain precision" and is |
62 |
# roughly equivalent to -ieee |
63 |
if test "x$IEEE" = x ; then #- with optimisation: |
64 |
FOPTIM="-O2 -align -ip -opt-streaming-stores auto $PROCF" |
65 |
else |
66 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
67 |
FOPTIM="-O0 -fp-model source -noalign $PROCF" |
68 |
else #- development/check options: |
69 |
FOPTIM="$PROCF" |
70 |
fi |
71 |
fi |
72 |
|
73 |
F90FLAGS=$FFLAGS |
74 |
F90OPTIM=$FOPTIM |
75 |
CFLAGS="-O0 $PROCF" |
76 |
|
77 |
INCLUDEDIRS='' |
78 |
INCLUDES='' |
79 |
LIBS='' |
80 |
|
81 |
if [ "x$NETCDF_ROOT" != x ] ; then |
82 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
83 |
INCLUDES="-I${NETCDF_ROOT}/include" |
84 |
LIBS="-L${NETCDF_ROOT}/lib" |
85 |
elif [ "x$NETCDF_HOME" != x ]; then |
86 |
INCLUDEDIRS="${NETCDF_HOME}/include" |
87 |
INCLUDES="-I${NETCDF_HOME}/include" |
88 |
LIBS="-L${NETCDF_HOME}/lib" |
89 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
90 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
91 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
92 |
INCLUDEDIRS="${NETCDF_INC}" |
93 |
INCLUDES="-I${NETCDF_INC}" |
94 |
LIBS="-L${NETCDF_LIB}" |
95 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
96 |
INCLUDEDIRS="${NETCDF_INCDIR}" |
97 |
INCLUDES="-I${NETCDF_INCDIR}" |
98 |
LIBS="-L${NETCDF_LIBDIR}" |
99 |
elif test -d /usr/include/netcdf-3 ; then |
100 |
INCLUDEDIRS='/usr/include/netcdf-3' |
101 |
INCLUDES='-I/usr/include/netcdf-3' |
102 |
LIBS='-L/usr/lib/netcdf-3' |
103 |
elif test -d /usr/local/pkg/netcdf ; then |
104 |
INCLUDEDIRS='/usr/local/pkg/netcdf/include' |
105 |
INCLUDES='-I/usr/local/pkg/netcdf/include' |
106 |
LIBS='-L/usr/local/pkg/netcdf/lib' |
107 |
elif test -d /usr/include/netcdf ; then |
108 |
INCLUDEDIRS='/usr/include/netcdf' |
109 |
INCLUDES='-I/usr/include/netcdf' |
110 |
elif test -d /usr/local/netcdf ; then |
111 |
INCLUDEDIRS='/usr/include/netcdf/include' |
112 |
INCLUDES='-I/usr/local/netcdf/include' |
113 |
LIBS='-L/usr/local/netcdf/lib' |
114 |
elif test -f /usr/local/include/netcdf.inc ; then |
115 |
INCLUDEDIRS='/usr/local/include' |
116 |
INCLUDES='-I/usr/local/include' |
117 |
LIBS='-L/usr/local/lib' |
118 |
fi |
119 |
|
120 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
121 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
122 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
123 |
#- used for parallel (MPI) DIVA |
124 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
125 |
#MPI_HEADER_FILES='mpif.h mpiof.h' |
126 |
fi |