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