Skip to content

Commit

Permalink
Merge pull request #76 from UCAR/develop
Browse files Browse the repository at this point in the history
Release merge from develop to master
  • Loading branch information
bartnijssen committed Jul 14, 2015
2 parents e26607f + 0543d6d commit f9d4141
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 77 deletions.
136 changes: 66 additions & 70 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,71 @@
#
# To troubleshoot your paths and setup, type 'make check'
#
# At a minimum you will need to set F_MASTER and FC. You will probably
# also have to specify the location of your netcdf and lapack libraries

#========================================================================
# PART 0: Define directory paths
# PART 0: User-configurable part
#========================================================================

# Define core directory below which everything resides. This is the
# parent directory of the 'build' directory
F_MASTER =

# Define the Fortran Compiler. If you are using gfortran, then this needs
# to be version 4.8 or higher

FC =

# Define the NetCDF and LAPACK libraries and path to include files. Note
# that the defaults paths defined are those that work for our compilers
# and settings. If none of this makes sense, please talk to your system
# administrator.

# Eventually we plan move to a real configure script, but for now we like
# to keep track of successful compilations of SUMMA on different platforms
# and with different compilers. If you are successful compiling SUMMA,
# please add your configuration (operating system and compiler plus
# part 0 of the Makefile) to the SUMMA wiki on github.

# gfortran compiler -- needs to be 4.8 or higher
# (works on Mac OS X with Macports)
ifeq "$(FC)" "gfortran-mp-4.8"
NCDF_PATH = /opt/local
LAPK_PATH = /opt/local
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack -lblas -latlas
endif

# Intel fortran compiler
ifeq "$(FC)" "ifort"
NCDF_PATH = /opt/netcdf-4.3.0+ifort-12.1
LAPK_PATH = /usr
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack
endif

LIBNETCDF = -L$(NCDF_PATH)/lib -lnetcdff
INCNETCDF = -I$(NCDF_PATH)/include

# Define compiler flags. If you use a different compiler,
# you will need to figure out what the equivalent flags are
# and may need to update this section
ifeq "$(FC)" "gfortran-mp-4.8"
FLAGS_NOAH = -ffree-form -fdefault-real-8 -ffree-line-length-none -fmax-errors=0 -g -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_COMM = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_SUMMA = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
endif
ifeq "$(FC)" "ifort"
FLAGS_NOAH = -warn nounused -autodouble -noerror_limit -FR -O0 -auto -WB -traceback -g -fltconsistency
FLAGS_COMM = -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
FLAGS_SUMMA = -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
endif

#========================================================================
# PART 1: Define directory paths
#========================================================================

# Core directory that contains source code
F_KORE_DIR = $(F_MASTER)/build/source

Expand All @@ -23,7 +79,7 @@ MOD_PATH = $(F_MASTER)/build
EXE_PATH = $(F_MASTER)/bin

#========================================================================
# PART 1: Assemble all of the SUMMA sub-routines
# PART 2: Assemble all of the SUMMA sub-routines
#========================================================================

# Define directories
Expand All @@ -34,8 +90,8 @@ DSHARE_DIR = $(F_KORE_DIR)/dshare
NUMREC_DIR = $(F_KORE_DIR)/numrec
NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
ENGINE_DIR = $(F_KORE_DIR)/engine
#
# Numerical Recipes utilities

# utilities
SUMMA_NRUTIL= \
nrtype.f90 \
nr_utility.f90
Expand All @@ -54,7 +110,6 @@ SUMMA_HOOKUP= \
summaFileManager.f90
HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))


# Data modules
SUMMA_DATAMS= \
var_lookup.f90 \
Expand Down Expand Up @@ -147,41 +202,6 @@ COMM_ALL = $(NRUTIL) $(NRPROC) $(HOOKUP) $(DATAMS) $(UTILMS)
# ... stitch together SUMMA programs
SUMMA_ALL = $(PRELIM) $(MODRUN) $(SOLVER) $(NETCDF)

#========================================================================
# PART 2: Define the libraries, driver programs, and executables
#========================================================================

# Define the Fortran Compiler
FC =

# Define the NetCDF libraries and path to include files
ifeq "$(FC)" "gfortran"
NCDF_PATH = /usr/local/netcdf-4.3.0/gcc-4.7.2
LAPK_PATH = /usr
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack -lblas -latlas
endif
ifeq "$(FC)" "gfortran-mp-4.8"
NCDF_PATH = /opt/local
LAPK_PATH = /opt/local
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack -lblas -latlas
endif
ifeq "$(FC)" "ifort"
NCDF_PATH = /opt/netcdf-4.3.0+ifort-12.1
LAPK_PATH = /usr
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack
endif
ifeq "$(FC)" "pgf90"
NCDF_PATH = /usr/local/netcdf-4.3.0/pgi-13.8
LAPK_PATH = /usr
# define the lapack libraries
LIBLAPACK = -L$(LAPK_PATH)/lib -llapack
endif
LIBNETCDF = -L$(NCDF_PATH)/lib -lnetcdff
INCNETCDF = -I$(NCDF_PATH)/include

# Define the driver routine
SUMMA_DRIVER= \
multi_driver.f90
Expand All @@ -191,36 +211,8 @@ DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
DRIVER__EX = summa.exe

#========================================================================
# PART 3: Compile the puppy
#========================================================================

# Define flags
ifeq "$(FC)" "gfortran"
FLAGS_NOAH = -ffree-form -fdefault-real-8 -ffree-line-length-none -fmax-errors=0 -g -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_COMM = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_SUMMA = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
endif
ifeq "$(FC)" "gfortran-mp-4.8"
FLAGS_NOAH = -ffree-form -fdefault-real-8 -ffree-line-length-none -fmax-errors=0 -g -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_COMM = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
FLAGS_SUMMA = -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
endif
ifeq "$(FC)" "ifort"
FLAGS_NOAH = -warn nounused -autodouble -noerror_limit -FR -O0 -auto -WB -traceback -g -fltconsistency
FLAGS_COMM = -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
FLAGS_SUMMA = -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
endif
ifeq "$(FC)" "pgf90"
FLAGS1 = -Mbackslash -g -Mchkptr -Mchkstk -Mpgicoff -Minform=inform -Ktrap=divz,inv -Mprof=lines,time
FLAGS_NOAH = -g -Mr8 -Mfree
FLAGS_COMM = -Mbackslash -g -Mchkptr -Mchkstk -Mpgicoff -Minform=inform -Ktrap=fp -traceback
FLAGS_SUMMA = -Mbackslash -g -Mbounds -Mchkptr -Mchkstk -Mpgicoff -Minform=inform -Ktrap=divz,inv,ovf -traceback
endif

#FLAGS = -O3 -W -v

#.SUFFIXES: .f .o .f90

# PART 3: Checks
#======================================================================
# make sure that the paths are defined. These are just some high level checks
ifndef F_MASTER
$(error F_MASTER is undefined)
Expand All @@ -235,6 +227,10 @@ ifndef NCDF_PATH
$(error NCDF_PATH is undefined)
endif

#========================================================================
# PART 4: compilation
#======================================================================

# Compile
all: compile_noah compile_comm compile_summa link clean install

Expand Down
2 changes: 1 addition & 1 deletion docs/howto/summa_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

SUMMA configuration is performed via a large number of configuration files. The format of these files is likely to change (and simplified) as we build out SUMMA's infrastructure. The following may be somewhat difficult to follow without a working example. We strongly recommend that you get the [test applications](http://ral.ucar.edu/projects/summa/datasets.php) to help you get started.
SUMMA configuration is performed via a large number of configuration files. The format of these files is likely to change (and simplified) as we build out SUMMA's infrastructure. The following may be somewhat difficult to follow without a working example. We strongly recommend that you get the [test applications](http://ral.ucar.edu/projects/summa) to help you get started.

In the following we will assume that your SUMMA source installation is in the directory `<localInstallation>` on your machine (this is not actually the name of the directory, but can be whatever you call) and that the test applications are installed in the directory `<localApplications>`. Note that these two directories can be the same, in which case everything would be in the same directory tree.

Expand Down
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ SUMMA's initial implementation is described in two papers published in [Water Re

We have successfully installed SUMMA on a number of Unix-like (*nix) operating systems, including Linux and Darwin (Mac OS X). To compile SUMMA, you will need:

* a Fortran compiler. We have successfully used the intel Fortran compiler (`ifort`), the Portland Group Fortran 90 compiler (`pgf90`), and the GNU Fortran compiler (`gfortran`), the latter of which is freely available. Since we do not use any compiler-specific extensions, you should be able to compile SUMMA with other Fortran compilers as well. If you do, please let us know and send us a copy of your Makefile.
* a Fortran compiler. We have successfully used the intel Fortran compiler (`ifort`) and the GNU Fortran compiler (`gfortran`, version 4.8 or higher), the latter of which is freely available. Since we do not use any compiler-specific extensions, you should be able to compile SUMMA with other Fortran compilers as well.

If you do not have a Fortran compiler, ou can install `gfortran` for free. The easiest way is to use a apackage manager. Which package manager depends on your *nix flavor. On OS X, you can use any of the free OS X package managers, including [MacPorts](http://www.macports.org), [fink](http://www.finkproject.org), or [homebrew](http://brew.sh). Note that `gfortran` is installed as part of the `gcc` compiler suite.
If you do not have a Fortran compiler, you can install `gfortran` for free. The easiest way is to use a package manager. Which package manager depends on your *nix flavor. On OS X, you can use any of the free OS X package managers, including [MacPorts](http://www.macports.org), [fink](http://www.finkproject.org), or [homebrew](http://brew.sh). Note that `gfortran` is installed as part of the `gcc` compiler suite.

* the NetCDF libraries. [NetCDF](http://www.unidata.ucar.edu/software/netcdf/) or the Network Common Data Format is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. They are widely used in the hydrometeorological community and eventually all SUMMA I/O will use NetCDF. Most *nix package managers include a NetCDF port. Note that you need to ensure that:

* You have NetCDF version 4.x;
* The NetCDF libraries are compiled with the same compiler as you plan to use for compiling SUMMA; and
* You have the NetCDF Fortran library installed (`libnetcdff.*`) and not just the C-version.

* the LAPACK — Linear Algebra PACKage library. [LAPACK](http://www.netlib.org/lapack/) provides a series of routines for linear algebra operations, including matrix solvers. How to install the library depends on your *nix variant and is not covered here. For example, on OS X you will get all the necessary LAPACK routines by installing the ATLAS software (again, this is easiest using a package manager).
* the LAPACK — Linear Algebra PACKage library. [LAPACK](http://www.netlib.org/lapack/) provides a series of routines for linear algebra operations, including matrix solvers. How to install the library depends on your *nix variant and is not covered here. For example, on OS X you will get all the necessary LAPACK routines by installing the ATLAS software (again, this is easiest using a package manager; note that ATLAS can take many hours to build the first time when you install it).

* a copy of the SUMMA source code from [this repo](https://github.com/UCAR/summa). You have a number of options:

Expand All @@ -59,9 +59,9 @@ Once you have all the above, you can compile SUMMA using the following steps:

1. Navigate to your local copy of the SUMMA directory and go to the `build` subdirectory;

1. Edit the `Makefile`. At the very least, you will need to set `F_MASTER` and `FC`. You may also need to set `NCDF_PATH` and `LAPK_PATH` and you may need to add some extra entries if you are using a different Fortran compiler or your setup is different (if someone wants to contribute an actual `configure` script that would be great);
1. Edit part 0 of the `Makefile`. At the very least, you will need to set `F_MASTER` and `FC`. You may also need to set `NCDF_PATH` and `LAPK_PATH` and you may need to add some extra entries if you are using a different Fortran compiler or your setup is different (if someone wants to contribute an actual `configure` script that would be great);

1. Type `make`. If all goes well, this will build SUMMA and move the executable `summa.exe` to the `bin` directory;
1. Type `make`. If all goes well, this will build SUMMA and move the executable `summa.exe` to the `bin` directory. You may get some warnings (depending on your compiler settings), but you should not get any errors;

1. Pay attention to the `make` output. You may need to set some environment variables (`LD_LIBRARY_PATH` in particular) to support dynamic linking;

Expand All @@ -74,7 +74,7 @@ Once you have all the above, you can compile SUMMA using the following steps:

If you get this far then SUMMA is installed correctly and functional.

Continue reading [SUMMA configuration](https://github.com/UCAR/summa/blob/master/docs/howto/summa_configuration.md) to learn more about how to configure SUMMA for your application. We strongly recommend that you get the [test applications](http://ral.ucar.edu/projects/summa/datasets.php) to help you get started.
Continue reading [SUMMA configuration](https://github.com/UCAR/summa/blob/master/docs/howto/summa_configuration.md) to learn more about how to configure SUMMA for your application. We strongly recommend that you get the [test applications](http://ral.ucar.edu/projects/summa) to help you get started.

## License

Expand Down

0 comments on commit f9d4141

Please sign in to comment.