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