1 |
#!/bin/bash |
2 |
|
3 |
# Adapted from linux_amd64_ifort_generic_mpi |
4 |
# with specific local path (=MPI_INC_DIR & NETCDF_ROOT ) for MPI & NetCDF |
5 |
# Tested on jmc's laptop (FC.8), with MPI & Multi-Threaded (OpenMP) |
6 |
# using ifort v.10.1.012 & mpich-1.2.7 (installed in /opt/intel/) |
7 |
|
8 |
#------- |
9 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
10 |
# and generally, needs to increase the stack-size: |
11 |
# - sh,bash: |
12 |
# > export OMP_NUM_THREADS=2 |
13 |
# > export KMP_STACKSIZE=400m |
14 |
# - csh,tcsh: |
15 |
# > setenv OMP_NUM_THREADS 2 |
16 |
# > setenv KMP_STACKSIZE 400m |
17 |
#------- |
18 |
|
19 |
# Composed and tested by ce107 on ross/weddell (Opteron system) |
20 |
# Should work fine on EM64T and other AMD64 compatible Intel systems |
21 |
# a) Processor specific flags: |
22 |
# 1) for more speed on Core2 processors replace -xW with -xT |
23 |
# 2) for more speed on Pentium4 based EM64T processors replaces -xW with -xP |
24 |
# b) For more speed, provided your data size doesn't exceed 2GB you can |
25 |
# remove -fPIC which carries a performance penalty of 2-6%. |
26 |
# c) Provided that the libraries you link to are compiled with -fPIC this |
27 |
# optfile should work. |
28 |
# d) You can replace -fPIC with -mcmodel=medium which may perform faster |
29 |
# than -fPIC and still support data sizes over 2GB per process but all |
30 |
# the libraries you link to must be compiled with -fPIC or -mcmodel=medium |
31 |
# e) Changed from -O3 to -O2 to avoid buggy Intel v.10 compilers. Speed |
32 |
# impact appears to be minimal. |
33 |
# |
34 |
# DON'T FORGET to set environment variable MPI_INC_DIR to the include |
35 |
# directory of your MPI implementation |
36 |
|
37 |
NETCDF_ROOT='/opt/intel/netcdf-3.6.2' |
38 |
MPI_INC_DIR='/opt/intel/mpich-1.2.7p1_ic-10.1.012/include' |
39 |
|
40 |
FC=mpif77 |
41 |
F90C='mpif90 -fixed' |
42 |
CC=mpicc |
43 |
LINK='mpif90 -i-dynamic -no-ipo' |
44 |
#LINK='mpif90 -i-static -no-ipo' |
45 |
|
46 |
DEFINES='-DALLOW_USE_MPI -DALWAYS_USE_MPI -DWORDLENGTH=4' |
47 |
CPP='cpp -traditional -P' |
48 |
F90FIXEDFORMAT='-fixed -Tf' |
49 |
EXTENDED_SRC_FLAG='-132' |
50 |
OMPFLAG='-openmp' |
51 |
|
52 |
NOOPTFLAGS='-O0 -g -m64 -fPIC' |
53 |
NOOPTFILES='' |
54 |
|
55 |
INCLUDEDIRS='' |
56 |
INCLUDES='' |
57 |
LIBS='' |
58 |
|
59 |
if test "x$DEVEL" != x ; then |
60 |
FFLAGS='-r8 -i4 -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC -O0 -g -noalign -fp-stack-check -check all -fpe0 -traceback -ftrapuv -fp-model except -warn all' |
61 |
else |
62 |
FFLAGS='-r8 -i4 -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC' |
63 |
fi |
64 |
|
65 |
if test "x$IEEE" = x ; then |
66 |
# No need for IEEE-754 |
67 |
FOPTIM='-O2 -align -xW -ip' |
68 |
else |
69 |
# Try to follow IEEE-754 |
70 |
FOPTIM='-O0 -align -xW -ip -fp-model strict' |
71 |
# for automatic testing with testreport (but no relation with IEEE arithmetic): |
72 |
FOPTIM="$FOPTIM -g -noalign -fp-stack-check -check all -fpe0 -traceback -ftrapuv" |
73 |
fi |
74 |
F90FLAGS=$FFLAGS |
75 |
F90OPTIM=$FOPTIM |
76 |
CFLAGS='-O0 -ip -fPIC' |
77 |
|
78 |
if [ "x$NETCDF_ROOT" != x ] ; then |
79 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
80 |
INCLUDES="-I${NETCDF_ROOT}/include" |
81 |
LIBS="-L${NETCDF_ROOT}/lib" |
82 |
elif [ "x$NETCDF_HOME" != x ]; then |
83 |
INCLUDEDIRS="${NETCDF_HOME}/include" |
84 |
INCLUDES="-I${NETCDF_HOME}/include" |
85 |
LIBS="-L${NETCDF_HOME}/lib" |
86 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
87 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
88 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
89 |
INCLUDEDIRS="${NETCDF_INC}" |
90 |
INCLUDES="-I${NETCDF_INC}" |
91 |
LIBS="-L${NETCDF_LIB}" |
92 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
93 |
INCLUDEDIRS="${NETCDF_INCDIR}" |
94 |
INCLUDES="-I${NETCDF_INCDIR}" |
95 |
LIBS="-L${NETCDF_LIBDIR}" |
96 |
elif test -d /usr/include/netcdf-3 ; then |
97 |
INCLUDEDIRS='/usr/include/netcdf-3' |
98 |
INCLUDES='-I/usr/include/netcdf-3' |
99 |
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
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/lib' |
107 |
elif test -d /usr/local/include/netcdf.inc ; then |
108 |
INCLUDEDIRS='/usr/local/include' |
109 |
INCLUDES='-I/usr/local/include' |
110 |
LIBS='-L/usr/local/lib64' |
111 |
fi |
112 |
|
113 |
|
114 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
115 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
116 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
117 |
MPI_HEADER_FILES='mpif.h mpiof.h' |
118 |
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |