1 |
ce107 |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jmc |
1.5 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_ifort10.1,v 1.4 2010/03/22 19:47:52 jmc Exp $ |
4 |
jmc |
1.2 |
# $Name: $ |
5 |
|
|
# |
6 |
ce107 |
1.1 |
# Constantinos Evangelinos |
7 |
|
|
# |
8 |
jmc |
1.5 |
# Build options for the intel 10.1 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 |
ce107 |
1.1 |
|
13 |
jmc |
1.2 |
#------- |
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 |
jmc |
1.5 |
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 |
ce107 |
1.1 |
|
36 |
|
|
DEFINES='-DWORDLENGTH=4' |
37 |
|
|
CPP='cpp -traditional -P' |
38 |
jmc |
1.2 |
F90FIXEDFORMAT='-fixed -Tf' |
39 |
ce107 |
1.1 |
EXTENDED_SRC_FLAG='-132' |
40 |
jmc |
1.2 |
OMPFLAG='-openmp' |
41 |
ce107 |
1.1 |
|
42 |
|
|
NOOPTFLAGS='-O0 -g' |
43 |
|
|
NOOPTFILES='' |
44 |
|
|
|
45 |
jmc |
1.5 |
FFLAGS="$FFLAGS -convert big_endian -assume byterecl" |
46 |
jmc |
1.2 |
#- might want to use '-r8' for fizhi pkg: |
47 |
|
|
#FFLAGS="$FFLAGS -r8" |
48 |
ce107 |
1.1 |
|
49 |
|
|
if test "x$GENERIC" != x ; then |
50 |
|
|
PROCF=-axSOTPNWK |
51 |
|
|
else |
52 |
|
|
has_sse4a=f |
53 |
|
|
has_sse4=f |
54 |
|
|
has_ssse3=f |
55 |
|
|
has_sse3=f |
56 |
|
|
has_sse2=f |
57 |
|
|
has_sse=f |
58 |
|
|
is_opteron=f |
59 |
|
|
is_pentiumm=f |
60 |
|
|
grep flags /proc/cpuinfo | grep " sse4a " > /dev/null 2>&1 && has_sse4a=t |
61 |
|
|
grep flags /proc/cpuinfo | grep " sse4 " > /dev/null 2>&1 && has_sse4=t |
62 |
|
|
grep flags /proc/cpuinfo | grep " sse3 " > /dev/null 2>&1 && has_ssse3=t |
63 |
|
|
grep flags /proc/cpuinfo | grep " sse3 " > /dev/null 2>&1 && has_sse3=t |
64 |
|
|
grep flags /proc/cpuinfo | grep " sse2 " > /dev/null 2>&1 && has_sse2=t |
65 |
|
|
grep flags /proc/cpuinfo | grep " sse " > /dev/null 2>&1 && has_sse=t |
66 |
|
|
grep "model name" /proc/cpuinfo | grep " Opteron" > /dev/null 2>&1 && is_opteron=t |
67 |
|
|
grep "model name" /proc/cpuinfo | grep " Phenom" > /dev/null 2>&1 && is_opteron=t |
68 |
|
|
grep "model name" /proc/cpuinfo | grep " Athlon 64" > /dev/null 2>&1 && is_opteron=t |
69 |
|
|
grep "model name" /proc/cpuinfo | grep " Pentium(R) M" > /dev/null 2>&1 && is_pentiumm=t |
70 |
|
|
if test "x$has_sse4a" = xt ; then |
71 |
|
|
PROCF=-xO |
72 |
|
|
elif test "x$has_sse4" = xt ; then |
73 |
|
|
PROCF=-xS |
74 |
|
|
elif test "x$has_ssse3" = xt ; then |
75 |
|
|
PROCF=-xT |
76 |
|
|
elif test "x$has_sse3" = xt ; then |
77 |
|
|
if test "x$is_opteron" = xt ; then |
78 |
|
|
PROCF=-xO |
79 |
|
|
else |
80 |
|
|
PROCF=-xP |
81 |
|
|
fi |
82 |
|
|
elif test "x$has_sse2" = xt ; then |
83 |
|
|
if test "x$is_pentiumm" = xt ; then |
84 |
|
|
PROCF=-xB |
85 |
|
|
elif test "x$is_opteron" = xt ; then |
86 |
|
|
PROCF=-xW |
87 |
|
|
else |
88 |
|
|
PROCF=-xN |
89 |
|
|
fi |
90 |
|
|
elif test "x$has_sse" = xt ; then |
91 |
|
|
PROCF=-xK |
92 |
|
|
fi |
93 |
|
|
fi |
94 |
jmc |
1.5 |
|
95 |
|
|
if test "x$DEVEL" = x ; then |
96 |
|
|
FFLAGS="$FFLAGS -W0 -WB" |
97 |
|
|
else |
98 |
|
|
FFLAGS="$FFLAGS -O0 -g -debug all -debug-parameters all -noalign -fp-stack-check -check all -fpe0 -traceback -ftrapuv -fp-model strict -warn all" |
99 |
|
|
fi |
100 |
|
|
|
101 |
ce107 |
1.1 |
# Note that the -mp switch is for ieee "maintain precision" and is |
102 |
|
|
# roughly equivalent to -ieee |
103 |
jmc |
1.5 |
if test "x$IEEE" = x ; then #- with optimisation: |
104 |
ce107 |
1.1 |
FOPTIM="-O3 -align -ip -opt-streaming-stores auto $PROCF" |
105 |
|
|
else |
106 |
jmc |
1.5 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
107 |
|
|
FOPTIM="-O0 -mp -noalign $PROCF" |
108 |
|
|
else #- development/check options: |
109 |
|
|
FOPTIM="$PROCF" |
110 |
|
|
fi |
111 |
ce107 |
1.1 |
fi |
112 |
jmc |
1.5 |
|
113 |
ce107 |
1.1 |
F90FLAGS=$FFLAGS |
114 |
|
|
F90OPTIM=$FOPTIM |
115 |
jmc |
1.5 |
CFLAGS="-O0 $PROCF" |
116 |
|
|
|
117 |
|
|
INCLUDEDIRS='' |
118 |
|
|
INCLUDES='' |
119 |
|
|
LIBS='' |
120 |
ce107 |
1.1 |
|
121 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
122 |
|
|
INCLUDEDIRS="${NETCDF_ROOT}/include" |
123 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
124 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
125 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
126 |
|
|
INCLUDEDIRS="${NETCDF_HOME}/include" |
127 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
128 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
129 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
130 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
131 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
132 |
|
|
INCLUDEDIRS="${NETCDF_INC}" |
133 |
|
|
INCLUDES="-I${NETCDF_INC}" |
134 |
|
|
LIBS="-L${NETCDF_LIB}" |
135 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
136 |
|
|
INCLUDEDIRS="${NETCDF_INCDIR}" |
137 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
138 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
139 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
140 |
|
|
INCLUDEDIRS='/usr/include/netcdf-3' |
141 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
142 |
|
|
LIBS='-L/usr/lib/netcdf-3' |
143 |
|
|
elif test -d /usr/local/pkg/netcdf ; then |
144 |
|
|
INCLUDEDIRS='/usr/local/pkg/netcdf/include' |
145 |
|
|
INCLUDES='-I/usr/local/pkg/netcdf/include' |
146 |
|
|
LIBS='-L/usr/local/pkg/netcdf/lib' |
147 |
|
|
elif test -d /usr/include/netcdf ; then |
148 |
|
|
INCLUDEDIRS='/usr/include/netcdf' |
149 |
|
|
INCLUDES='-I/usr/include/netcdf' |
150 |
|
|
elif test -d /usr/local/netcdf ; then |
151 |
|
|
INCLUDEDIRS='/usr/include/netcdf/include' |
152 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
153 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
154 |
|
|
elif test -f /usr/local/include/netcdf.inc ; then |
155 |
|
|
INCLUDEDIRS='/usr/local/include' |
156 |
|
|
INCLUDES='-I/usr/local/include' |
157 |
|
|
LIBS='-L/usr/local/lib' |
158 |
|
|
fi |
159 |
|
|
|
160 |
jmc |
1.5 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
161 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
162 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
163 |
|
|
MPIINCLUDEDIR="$MPI_INC_DIR" |
164 |
|
|
MPI_HEADER_FILES='mpif.h mpiof.h' |
165 |
|
|
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
166 |
|
|
fi |