1 |
#! /usr/bin/env bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_pathf90,v 1.6 2011/08/10 23:27:21 jmc Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
# Build options for PathScale (EKOPATH) Compiler on Linux x86-64 |
7 |
# first version tested on Fedore Core 3 x86-64 Opteron (Linux batsi) |
8 |
# updated and tested on acesgrid (Fedora Core 15), using: |
9 |
# module load ekopath (Version 4.0.10) |
10 |
# |
11 |
#------- |
12 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
13 |
# and generally, needs to increase the thread stack-size: |
14 |
# - sh,bash: |
15 |
# > export OMP_NUM_THREADS=2 |
16 |
# > export PSC_OMP_STACK_SIZE=400m |
17 |
# - csh,tcsh: |
18 |
# > setenv OMP_NUM_THREADS 2 |
19 |
# > setenv PSC_OMP_STACK_SIZE 400m |
20 |
#------- |
21 |
|
22 |
CC=pathcc |
23 |
FC=pathf90 |
24 |
LINK=pathf90 |
25 |
|
26 |
DEFINES='-DWORDLENGTH=4' |
27 |
CPP='cpp -traditional -P' |
28 |
EXTENDED_SRC_FLAG='-extend-source' |
29 |
GET_FC_VERSION="-v" |
30 |
OMPFLAG='-openmp' |
31 |
#OMPFLAG='-openmp -OPT:early_mp=ON' |
32 |
|
33 |
NOOPTFLAGS='-O0 -g' |
34 |
NOOPTFILES='' |
35 |
|
36 |
FFLAGS="$FFLAGS -m64 -fPIC -convert big_endian" |
37 |
#- might want to use '-r8' for fizhi pkg: |
38 |
#FFLAGS="$FFLAGS -r8" |
39 |
|
40 |
if test "x$IEEE" = x ; then #- with optimisation: |
41 |
#- full optimisation, trips over MITgcm code because of compiler problems: |
42 |
#FOPTIM='-Ofast -LNO:fusion=2 -funsafe-math-optimizations' |
43 |
#- high optimisation (-O3), might find Pb with few S/R; fully safe: switch to -O2: |
44 |
FOPTIM='-O3 -LNO:fusion=2 -funsafe-math-optimizations' |
45 |
else |
46 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
47 |
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
48 |
else #- development/check options: |
49 |
FFLAGS="$FFLAGS -ffortran-bounds-check -trapuv -g" |
50 |
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
51 |
fi |
52 |
fi |
53 |
|
54 |
F90FLAGS=$FFLAGS |
55 |
F90OPTIM=$FOPTIM |
56 |
CFLAGS='-O0 -m64 -fPIC' |
57 |
GSLLIB='-lgsl -lgslcblas' |
58 |
|
59 |
if [ "x$NETCDF_ROOT" != x ] ; then |
60 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
61 |
INCLUDES="-I${NETCDF_ROOT}/include" |
62 |
LIBDIR="${NETCDF_ROOT}/lib" |
63 |
LIBS="-L${NETCDF_ROOT}/lib" |
64 |
elif [ "x$NETCDF_HOME" != x ]; then |
65 |
INCLUDEDIR="${NETCDF_HOME}/include" |
66 |
INCLUDES="-I${NETCDF_HOME}/include" |
67 |
LIBDIR="${NETCDF_HOME}/lib" |
68 |
LIBS="-L${NETCDF_HOME}/lib" |
69 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
70 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
71 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
72 |
INCLUDEDIR="${NETCDF_INC}" |
73 |
INCLUDES="-I${NETCDF_INC}" |
74 |
LIBDIR="${NETCDF_LIB}" |
75 |
LIBS="-L${NETCDF_LIB}" |
76 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
77 |
INCLUDEDIR="${NETCDF_INCDIR}" |
78 |
INCLUDES="-I${NETCDF_INCDIR}" |
79 |
LIBDIR="${NETCDF_LIBDIR}" |
80 |
LIBS="-L${NETCDF_LIBDIR}" |
81 |
elif test -d /usr/include/netcdf-3 ; then |
82 |
INCLUDES='-I/usr/include/netcdf-3' |
83 |
LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
84 |
elif test -d /usr/include/netcdf ; then |
85 |
INCLUDES='-I/usr/include/netcdf' |
86 |
elif test -d /usr/local/netcdf ; then |
87 |
INCLUDES='-I/usr/local/netcdf/include' |
88 |
LIBS='-L/usr/local/netcdf/lib' |
89 |
elif test -d /usr/local/include/netcdf.inc ; then |
90 |
INCLUDES='-I/usr/local/include' |
91 |
LIBS='-L/usr/local/lib64' |
92 |
fi |