1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_ifort11,v 1.14 2013/10/22 21:13:17 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
# Build options for version 11 and newer of intel compiler on Linux AMD64 platform |
7 |
# Author: Constantinos Evangelinos |
8 |
|
9 |
# Tested on baudelaire (FC 13) with intel compiler v.11.1.073 (20100806) |
10 |
# |
11 |
# OpenMP : tested on danton (FC 14) using intel compiler v.11.1.046 (20090630) |
12 |
# and (FC 14,17 & 19) v.12.0.4 (20110427) |
13 |
# and also (FC 19) v.14.0.0 (20130728) |
14 |
# |
15 |
# MPI : Tested on danton, with and without OpenMP, |
16 |
# using intel compiler v.11.1.046 and v.12.0.4 and also v.14.0.0 |
17 |
# and on acesgrid (FC 15) with intel compiler v.13.0.0.079 (20120731) |
18 |
# ==> DON'T FORGET to set environment variable MPI_INC_DIR to the include |
19 |
# directory of your MPI implementation |
20 |
|
21 |
#------- |
22 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
23 |
# and generally, needs to increase the stack-size: |
24 |
# - sh,bash: |
25 |
# > export OMP_NUM_THREADS=2 |
26 |
# > export KMP_STACKSIZE=400m |
27 |
# - csh,tcsh: |
28 |
# > setenv OMP_NUM_THREADS 2 |
29 |
# > setenv KMP_STACKSIZE 400m |
30 |
# NOTE, MPI+OpenMP: might need to set KMP_STACKSIZE in ~/.tcshrc |
31 |
# (but curiously, works without OMP_NUM_THREADS in ~/.tcshrc). |
32 |
#------- |
33 |
|
34 |
if test "x$MPI" = xtrue ; then |
35 |
CC=${CC:=mpicc} |
36 |
FC=${FC:=mpif77} |
37 |
F90C=${F90C:=mpif90} |
38 |
LINK="$F90C -shared-intel -no-ipo" |
39 |
else |
40 |
CC=icc |
41 |
FC=ifort |
42 |
F90C=ifort |
43 |
LINK="$F90C -shared-intel" |
44 |
fi |
45 |
|
46 |
DEFINES='-DWORDLENGTH=4' |
47 |
F90FIXEDFORMAT='-fixed -Tf' |
48 |
EXTENDED_SRC_FLAG='-132' |
49 |
GET_FC_VERSION="--version" |
50 |
OMPFLAG='-openmp' |
51 |
|
52 |
NOOPTFLAGS='-O0 -g' |
53 |
NOOPTFILES='' |
54 |
|
55 |
if test "x$GENERIC" != x ; then |
56 |
PROCF=-axSSE4.2,SSE4.1,SSSE3,SSE3,SSE2 |
57 |
else |
58 |
PROCF=-xHost |
59 |
fi |
60 |
|
61 |
CFLAGS="-O0 -ip -m64 $PROCF" |
62 |
FFLAGS="$FFLAGS -m64 -convert big_endian -assume byterecl" |
63 |
#- for big setups, compile & link with "-fPIC" or set memory-model to "medium": |
64 |
#CFLAGS="$CFLAGS -fPIC" |
65 |
#FFLAGS="$FFLAGS -fPIC" |
66 |
#- with FC 19, need to use this without -fPIC (which cancels -mcmodel option): |
67 |
CFLAGS="$CFLAGS -mcmodel=medium" |
68 |
FFLAGS="$FFLAGS -mcmodel=medium" |
69 |
#- might want to use '-r8' for fizhi pkg: |
70 |
#FFLAGS="$FFLAGS -r8" |
71 |
|
72 |
if test "x$IEEE" = x ; then #- with optimisation: |
73 |
FOPTIM="-O2 -align -ip -fp-model source $PROCF" |
74 |
else |
75 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
76 |
FOPTIM="-O0 -fp-model source -noalign $PROCF" |
77 |
else #- development/check options: |
78 |
#FFLAGS="$FFLAGS -debug all -debug-parameters all -fp-model strict" |
79 |
FOPTIM="-O0 -noalign -g -traceback $PROCF" |
80 |
NOOPTFLAGS=$FOPTIM |
81 |
NOOPTFILES='adread_adwrite.F mdsio_rw_field.F mdsio_rw_slice.F' |
82 |
FOPTIM="$FOPTIM -warn all -warn nounused" |
83 |
FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all -ftrapuv" |
84 |
fi |
85 |
fi |
86 |
|
87 |
F90FLAGS=$FFLAGS |
88 |
F90OPTIM=$FOPTIM |
89 |
|
90 |
INCLUDEDIRS='' |
91 |
INCLUDES='' |
92 |
LIBS='' |
93 |
|
94 |
if [ "x$NETCDF_ROOT" != x ] ; then |
95 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
96 |
INCLUDES="-I${NETCDF_ROOT}/include" |
97 |
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_ROOT}/lib" |
98 |
elif [ "x$NETCDF_HOME" != x ]; then |
99 |
INCLUDEDIRS="${NETCDF_HOME}/include" |
100 |
INCLUDES="-I${NETCDF_HOME}/include" |
101 |
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_HOME}/lib" |
102 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
103 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
104 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
105 |
INCLUDEDIRS="${NETCDF_INC}" |
106 |
INCLUDES="-I${NETCDF_INC}" |
107 |
LIBS="-L${NETCDF_LIB}" |
108 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
109 |
INCLUDEDIRS="${NETCDF_INCDIR}" |
110 |
INCLUDES="-I${NETCDF_INCDIR}" |
111 |
LIBS="-L${NETCDF_LIBDIR}" |
112 |
elif test -d /usr/include/netcdf-3 ; then |
113 |
INCLUDEDIRS='/usr/include/netcdf-3' |
114 |
INCLUDES='-I/usr/include/netcdf-3' |
115 |
LIBS='-L/usr/lib64/netcdf-3 -L/usr/lib/netcdf-3' |
116 |
elif test -d /usr/local/pkg/netcdf ; then |
117 |
INCLUDEDIRS='/usr/local/pkg/netcdf/include' |
118 |
INCLUDES='-I/usr/local/pkg/netcdf/include' |
119 |
LIBS='-L/usr/local/pkg-x86_64/netcdf/lib64 -L/usr/local/pkg-x86_64/netcdf/lib -L/usr/local/pkg/netcdf/lib64 -L/usr/local/pkg/netcdf/lib' |
120 |
elif test -d /usr/include/netcdf ; then |
121 |
INCLUDEDIRS='/usr/include/netcdf' |
122 |
INCLUDES='-I/usr/include/netcdf' |
123 |
elif test -d /usr/local/netcdf ; then |
124 |
INCLUDEDIRS='/usr/include/netcdf/include' |
125 |
INCLUDES='-I/usr/local/netcdf/include' |
126 |
LIBS='-L/usr/local/netcdf/lib64 -L/usr/local/netcdf/lib' |
127 |
elif test -f /usr/local/include/netcdf.inc ; then |
128 |
INCLUDEDIRS='/usr/local/include' |
129 |
INCLUDES='-I/usr/local/include' |
130 |
LIBS='-L/usr/local/lib64 -L/usr/local/lib' |
131 |
fi |
132 |
|
133 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
134 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
135 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
136 |
#- used for parallel (MPI) DIVA |
137 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
138 |
#MPI_HEADER_FILES='mpif.h mpiof.h' |
139 |
fi |