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