/[MITgcm]/MITgcm/tools/build_options/linux_amd64_gfortran
ViewVC logotype

Contents of /MITgcm/tools/build_options/linux_amd64_gfortran

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (show annotations) (download)
Thu Oct 14 23:54:58 2010 UTC (13 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62o, checkpoint62n, checkpoint62m
Changes since 1.9: +6 -4 lines
add "-fPIC" for big objects

1 #!/bin/bash
2
3 # $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_gfortran,v 1.9 2010/04/05 20:55:28 yunx Exp $
4 # $Name: $
5
6
7 # Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8
8 # with gcc-gfortran v4.3.x as shipped with Fedora Core 9,10
9 # It fixes the ' \' versus ' &' terminator ;
10 # with older versions (v4.0): namelist problems with syntax such as:
11 # fields(1,1) = 'UVELSLT ','VVELSLT ','WVELSLT ',
12 # which results in run-time errors.)
13
14 # OpenMP : Tested on dickens with gcc-gfortran v4.3.2 as shipped with FC 10
15 #-------
16 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
17 # and generally, needs to increase the thread stack-size:
18 # - sh,bash:
19 # > export OMP_NUM_THREADS=2
20 # > export GOMP_STACKSIZE=400m
21 # - csh,tcsh:
22 # > setenv OMP_NUM_THREADS 2
23 # > setenv GOMP_STACKSIZE 400m
24 #-------
25
26 FC=gfortran
27 F90C=gfortran
28 CC=gcc
29 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
30 CPP='cpp -traditional -P'
31 NOOPTFLAGS='-O0'
32 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
33 OMPFLAG='-fopenmp'
34
35 if test "x$DEVEL" != x ; then
36 FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check'
37 else
38 FFLAGS=''
39 fi
40
41 # Requires gfortran from 2006 onwards for -fconvert=big-endian
42 FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
43 # for big objects:
44 FFLAGS="$FFLAGS -fPIC"
45
46 if test "x$IEEE" = x ; then
47 # No need for IEEE-754
48 FOPTIM='-O3 -funroll-loops'
49 else
50 # Try to follow IEEE-754
51 # these may also be useful, but require specific gfortran versions:
52 # -Wnonstd-intrinsics for gfortran <= 4.3
53 # -Wintrinsics-std for gfortran >= 4.4
54 # -Wno-tabs for gfortran >= 4.3
55 FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
56 # to get plenty of warnings :
57 # FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
58 FOPTIM='-O0'
59 # for automatic testing with testreport (but no relation with IEEE arithmetic):
60 FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
61 fi
62 F90FLAGS=$FFLAGS
63 F90OPTIM=$FOPTIM
64 CFLAGS='-O0 -fPIC'
65
66 if [ "x$NETCDF_ROOT" != x ] ; then
67 INCLUDEDIR="${NETCDF_ROOT}/include"
68 INCLUDES="-I${NETCDF_ROOT}/include"
69 LIBDIR="${NETCDF_ROOT}/lib"
70 LIBS="-L${NETCDF_ROOT}/lib"
71 elif [ "x$NETCDF_HOME" != x ]; then
72 INCLUDEDIR="${NETCDF_HOME}/include"
73 INCLUDES="-I${NETCDF_HOME}/include"
74 LIBDIR="${NETCDF_HOME}/lib"
75 LIBS="-L${NETCDF_HOME}/lib"
76 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
77 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
78 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
79 INCLUDEDIR="${NETCDF_INC}"
80 INCLUDES="-I${NETCDF_INC}"
81 LIBDIR="${NETCDF_LIB}"
82 LIBS="-L${NETCDF_LIB}"
83 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
84 INCLUDEDIR="${NETCDF_INCDIR}"
85 INCLUDES="-I${NETCDF_INCDIR}"
86 LIBDIR="${NETCDF_LIBDIR}"
87 LIBS="-L${NETCDF_LIBDIR}"
88 elif test -d /usr/include/netcdf-3 ; then
89 INCLUDES='-I/usr/include/netcdf-3'
90 LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
91 elif test -d /usr/include/netcdf ; then
92 INCLUDES='-I/usr/include/netcdf'
93 elif test -d /usr/local/netcdf ; then
94 INCLUDES='-I/usr/local/netcdf/include'
95 LIBS='-L/usr/local/netcdf/lib'
96 elif test -d /usr/local/include/netcdf.inc ; then
97 INCLUDES='-I/usr/local/include'
98 LIBS='-L/usr/local/lib64'
99 fi

  ViewVC Help
Powered by ViewVC 1.1.22