1 |
#!/bin/bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_ifort+authors,v 1.3 2011/08/12 23:09:08 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
# Build options for the intel fortran compiler - version 9.0 (and earlier) - |
7 |
# on Linux IA32 platform |
8 |
|
9 |
# tested on faulks (FC.6), with OpenMP, using: |
10 |
# (sh, bash): source /usr/local/pkg/intel/intel_fc_90/bin/ifortvars.sh |
11 |
# (csh,tcsh): source /usr/local/pkg/intel/intel_fc_90/bin/ifortvars.csh |
12 |
# [was also tested on hugo (FC.4, FC.9), eddy (FC.5)] |
13 |
# and on aces-grid cluster, with OpenMP, using: |
14 |
# module add ifc/9.0.021 icc/9.0.021 intel/9.0 |
15 |
# module add netcdf/3.6.1/icc |
16 |
|
17 |
# MPI : Tested on aces-grid cluster, using: |
18 |
# a) default intel (v8.1) and default mpich/intel: |
19 |
# module add mpich/intel |
20 |
# module add netcdf/3.6.1/icc |
21 |
# e.g.(sh,bash): |
22 |
# export MPI_INC_DIR='/usr/local/pkg/mpich/mpich-intel/include' |
23 |
# (and run using: mpirun -machinefile my_list_of_nodes) |
24 |
# |
25 |
# b) intel v9.0 and mpich2-intel (+ OpenMPI or not) using, in this order: |
26 |
# module add ifc/9.0.021 icc/9.0.021 intel/9.0 |
27 |
# module add mpich2/1.0.3/intel |
28 |
# module add netcdf/3.6.1/icc |
29 |
# module add mpiexec (<-- to run with mpiexec) |
30 |
# e.g.(sh,bash): |
31 |
# export MPI_INC_DIR='/usr/local/pkg/mpich2/mpich2-1.0.3/intel/include' |
32 |
# (and run using mpiexec) |
33 |
|
34 |
# OpenMP : not working well with version earlier than v.9 |
35 |
#------- |
36 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
37 |
# and generally, needs to increase the stack-size: |
38 |
# - sh,bash: |
39 |
# > export OMP_NUM_THREADS=2 |
40 |
# > export KMP_STACKSIZE=400m |
41 |
# - csh,tcsh: |
42 |
# > setenv OMP_NUM_THREADS 2 |
43 |
# > setenv KMP_STACKSIZE 400m |
44 |
#------- |
45 |
|
46 |
if test "x$MPI" = xtrue ; then |
47 |
CC='mpicc' |
48 |
FC='mpif77' |
49 |
F90C=$FC |
50 |
#F90C='mpif90' |
51 |
LINK=$FC |
52 |
else |
53 |
CC='icc' |
54 |
FC='ifort' |
55 |
F90C=$FC |
56 |
LINK="$FC -i-static" |
57 |
fi |
58 |
|
59 |
DEFINES='-DWORDLENGTH=4' |
60 |
CPP='cpp -traditional -P' |
61 |
F90FIXEDFORMAT='-fixed -Tf' |
62 |
EXTENDED_SRC_FLAG='-132' |
63 |
GET_FC_VERSION="--version" |
64 |
OMPFLAG='-openmp' |
65 |
|
66 |
NOOPTFLAGS='-O0' |
67 |
NOOPTFILES='' |
68 |
|
69 |
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl" |
70 |
#- might want to use '-r8' for fizhi pkg: |
71 |
#FFLAGS="$FFLAGS -r8" |
72 |
|
73 |
if test "x$IEEE" = x ; then #- with optimisation: |
74 |
F90OPTIM='-O3' |
75 |
FOPTIM='-O3 -align' |
76 |
#P3 FOPTIM=$FOPTIM' -tpp6 -xWKM' |
77 |
#P4 FOPTIM=$FOPTIM' -tpp7 -xWKM' |
78 |
else |
79 |
F90OPTIM='-O0' |
80 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
81 |
# "-mp" is for ieee "maintain precision" |
82 |
FOPTIM='-O0 -noalign' |
83 |
#FFLAGS="$FFLAGS -mp" |
84 |
else #- development/check options: |
85 |
#FOPTIM='-O0 -noalign -CB -CU -CV' |
86 |
FOPTIM='-O0 -noalign -check all' |
87 |
FFLAGS="$FFLAGS -xN -pc64" |
88 |
NOOPTFILES='mds_byteswapr8.F mds_byteswapr4.F mds_byteswapi4.F' |
89 |
NOOPTFILES=$NOOPTFILES' mitcplr_char2real.F mitcplr_real2char.F' |
90 |
NOOPTFILES=$NOOPTFILES' mitcplr_char2int.F mitcplr_int2char.F mds_byteswap.F' |
91 |
fi |
92 |
fi |
93 |
|
94 |
F90FLAGS=$FFLAGS |
95 |
#F90OPTIM=$FOPTIM |
96 |
|
97 |
INCLUDEDIRS='' |
98 |
INCLUDES='' |
99 |
LIBS='' |
100 |
|
101 |
if [ "x$NETCDF_ROOT" != x ] ; then |
102 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
103 |
INCLUDES="-I${NETCDF_ROOT}/include" |
104 |
LIBDIR="${NETCDF_ROOT}/lib" |
105 |
LIBS="-L${NETCDF_ROOT}/lib" |
106 |
elif [ "x$NETCDF_HOME" != x ]; then |
107 |
INCLUDEDIR="${NETCDF_HOME}/include" |
108 |
INCLUDES="-I${NETCDF_HOME}/include" |
109 |
LIBDIR="${NETCDF_HOME}/lib" |
110 |
LIBS="-L${NETCDF_HOME}/lib" |
111 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
112 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
113 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
114 |
INCLUDEDIR="${NETCDF_INC}" |
115 |
INCLUDES="-I${NETCDF_INC}" |
116 |
LIBDIR="${NETCDF_LIB}" |
117 |
LIBS="-L${NETCDF_LIB}" |
118 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
119 |
INCLUDEDIR="${NETCDF_INCDIR}" |
120 |
INCLUDES="-I${NETCDF_INCDIR}" |
121 |
LIBDIR="${NETCDF_LIBDIR}" |
122 |
LIBS="-L${NETCDF_LIBDIR}" |
123 |
elif test -d /usr/include/netcdf-3 ; then |
124 |
INCLUDES='-I/usr/include/netcdf-3' |
125 |
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
126 |
elif test -d /usr/include/netcdf ; then |
127 |
INCLUDES='-I/usr/include/netcdf' |
128 |
elif test -d /usr/local/netcdf ; then |
129 |
INCLUDES='-I/usr/local/netcdf/include' |
130 |
LIBS='-L/usr/local/netcdf/lib' |
131 |
elif test -d /usr/local/include/netcdf.inc ; then |
132 |
INCLUDES='-I/usr/local/include' |
133 |
LIBS='-L/usr/local/lib64' |
134 |
fi |
135 |
|
136 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
137 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
138 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
139 |
# MPIINCLUDEDIR="$MPI_INC_DIR" |
140 |
# MPI_HEADER_FILES='mpif.h mpiof.h' |
141 |
# MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
142 |
fi |