1 |
#!/bin/bash |
#!/bin/bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
# $Name$ |
# $Name$ |
5 |
# |
# |
|
|
|
6 |
# Composed and tested by ce107 on ross/weddell (Opteron system) |
# Composed and tested by ce107 on ross/weddell (Opteron system) |
7 |
# Should work fine on EM64T and other AMD64 compatible Intel systems |
# Should work fine on EM64T and other AMD64 compatible Intel systems |
8 |
# a) Processor specific flags: |
# a) Processor specific flags: |
17 |
# the libraries you link to must be compiled with -fPIC or -mcmodel=medium |
# the libraries you link to must be compiled with -fPIC or -mcmodel=medium |
18 |
# e) Changed from -O3 to -O2 to avoid buggy Intel v.10 compilers. Speed |
# e) Changed from -O3 to -O2 to avoid buggy Intel v.10 compilers. Speed |
19 |
# impact appears to be minimal. |
# impact appears to be minimal. |
20 |
|
# |
21 |
|
# MPI : DON'T FORGET to set environment variable MPI_INC_DIR to the include |
22 |
|
# directory of your MPI implementation |
23 |
|
|
24 |
#------- |
#------- |
25 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
30 |
# - csh,tcsh: |
# - csh,tcsh: |
31 |
# > setenv OMP_NUM_THREADS 2 |
# > setenv OMP_NUM_THREADS 2 |
32 |
# > setenv KMP_STACKSIZE 400m |
# > setenv KMP_STACKSIZE 400m |
33 |
|
# NOTE: with MPI+OpenMP, need to set KMP_STACKSIZE in ~/.tcshrc (but curiously, |
34 |
|
# works without OMP_NUM_THREADS in ~/.tcshrc). |
35 |
#------- |
#------- |
36 |
|
|
37 |
FC=ifort |
if test "x$MPI" = xtrue ; then |
38 |
F90C=ifort |
CC=mpicc |
39 |
CC=icc |
FC=mpif77 |
40 |
LINK='ifort -i-dynamic -no-ipo' |
F90C=mpif90 |
41 |
|
LINK="$F90C -i-dynamic -no-ipo" |
42 |
|
else |
43 |
|
CC=icc |
44 |
|
FC=ifort |
45 |
|
F90C=ifort |
46 |
|
LINK="$F90C -i-dynamic -no-ipo" |
47 |
|
fi |
48 |
|
|
49 |
DEFINES='-DWORDLENGTH=4' |
DEFINES='-DWORDLENGTH=4' |
50 |
CPP='cpp -traditional -P' |
CPP='cpp -traditional -P' |
51 |
F90FIXEDFORMAT='-fixed -Tf' |
F90FIXEDFORMAT='-fixed -Tf' |
52 |
EXTENDED_SRC_FLAG='-132' |
EXTENDED_SRC_FLAG='-132' |
53 |
|
GET_FC_VERSION="--version" |
54 |
OMPFLAG='-openmp' |
OMPFLAG='-openmp' |
55 |
|
|
56 |
NOOPTFLAGS='-O0 -g -m64 -fPIC' |
NOOPTFLAGS='-O0 -g' |
57 |
NOOPTFILES='' |
NOOPTFILES='' |
58 |
|
|
59 |
INCLUDEDIRS='' |
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC" |
60 |
INCLUDES='' |
FFLAGS="$FFLAGS -fPIC" |
|
LIBS='' |
|
|
|
|
|
if test "x$DEVEL" != x ; then |
|
|
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC -O0 -g -noalign -fpstkchk -check all -fpe0 -traceback -ftrapuv -fpmodel except -warn all" |
|
|
else |
|
|
FFLAGS="-$FFLAGS w95 -W0 -WB -convert big_endian -assume byterecl -fPIC" |
|
|
fi |
|
61 |
#- might want to use '-r8' for fizhi pkg: |
#- might want to use '-r8' for fizhi pkg: |
62 |
#FFLAGS="$FFLAGS -r8" |
#FFLAGS="$FFLAGS -r8" |
63 |
|
|
64 |
# Note that the -mp switch is for ieee "maintain precision" and is |
if test "x$IEEE" = x ; then #- with optimisation: |
|
# roughly equivalent to -ieee |
|
|
if test "x$IEEE" = x ; then |
|
|
# No need for IEEE-754 |
|
65 |
FOPTIM='-O2 -align -xW -ip' |
FOPTIM='-O2 -align -xW -ip' |
66 |
else |
else |
67 |
# Try to follow IEEE-754 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
68 |
FOPTIM='-O2 -align -xW -ip -mp' |
# "-mp" is for ieee "maintain precision" |
69 |
|
FOPTIM='-O0 -noalign -xW -ip -mp' |
70 |
|
else #- development/check options: |
71 |
|
FFLAGS="$FFLAGS -warn all -warn nounused" |
72 |
|
FOPTIM="-fpe0 -fpstkchk -fpmodel except -check all -ftrapuv" |
73 |
|
FOPTIM="$FOPTIM -O0 -noalign -g -traceback" |
74 |
|
fi |
75 |
fi |
fi |
76 |
|
|
77 |
F90FLAGS=$FFLAGS |
F90FLAGS=$FFLAGS |
78 |
F90OPTIM=$FOPTIM |
F90OPTIM=$FOPTIM |
79 |
CFLAGS='-O2 -ip -fPIC' |
CFLAGS='-O0 -ip -fPIC' |
80 |
|
|
81 |
|
INCLUDEDIRS='' |
82 |
|
INCLUDES='' |
83 |
|
LIBS='' |
84 |
|
|
85 |
if [ "x$NETCDF_ROOT" != x ] ; then |
if [ "x$NETCDF_ROOT" != x ] ; then |
86 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
116 |
INCLUDES='-I/usr/local/include' |
INCLUDES='-I/usr/local/include' |
117 |
LIBS='-L/usr/local/lib64' |
LIBS='-L/usr/local/lib64' |
118 |
fi |
fi |
119 |
|
|
120 |
|
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
121 |
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
122 |
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
123 |
|
MPIINCLUDEDIR="$MPI_INC_DIR" |
124 |
|
MPI_HEADER_FILES='mpif.h mpiof.h' |
125 |
|
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
126 |
|
fi |