         NetCDF install How-To for CHIMERE under GNU/Linux systems.

                          $$$$$$$$$$$$$$$$



2005-06-08


Background
==========

Since version V200510 CHIMERE requires the netCDF package to work.
This note describes how to install netCDF for the supported compilers.

NetCDF installation has been tested with :
- ifort 32 bits (version 8.1.028)
- ifort 64 bits (version 8.1.027)
- g95   32 bits (version 4.0.0 20050129)
- g95   64 bits (version 4.0.1 20051102) default int 32 bits
- pgf90 32 bits (version 5.2.4)
- pgf90 64 bits (version 6.0-5)
- netcdf (version 3.6.0-p1)



Installation
============

A - download netCDF (source package) from the URL :

     ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.Z

    and save it in /tmp


B - Decompress and detar

$ cd /tmp
$ tar xvfz netcdf.tar.Z


C - Configure netCDF

At the time of writing of this How-To, the current version of netCDF
is 3.6.0-p1. If you downloaded a newer version, replace 3.6.0-p1 by the
new version number in the following text.

$ cd netcdf-3.6.0-p1/src

The configuration process depends on several environment variables
that you shall set according to your compiler.
Although it may be possible to link CHIMERE executables compiled
with compiler A with the netCDF library compiled with compiler B, we
strongly recommend to use the same compiler. The time you will
spend to install a new netCDF library is negligible compared to the 
time you could loose trying to match inconsistent libraries.

We suppose you want to install netcdf somewhere under /opt.
If you choose to install under /usr/local, or under you home directory,
replace /opt by your installation path in the following text.

We also suppose your shell is like bash or ksh. If you use csh, modify the
"export" statements according to your shell syntax.

C1 - ifort
==========

As root :
# mkdir /opt/netcdf-3.6.0-p1-ifort

As an ordinary user :
export FC=ifort
export F90=ifort
export FFLAGS="-mp -no-ipo"
export CPPFLAGS="-DNDEBUG -DpgiFortran"
./configure --prefix=/opt/netcdf-3.6.0-p1-ifort
make
make test

As root :
# make install


C2 - g95
========

As root :
# mkdir /opt/netcdf-3.6.0-p1-g95

As an ordinary user :
export CC='gcc'
export CXX='g++'
export CPPFLAGS='-DNDEBUG -DpgiFortran'
export CFLAGS='-O -g'
export FC='g95'
export F90='g95'
export FFLAGS='-O -g -fno-second-underscore'
export F90FLAGS='-O -g -fno-second-underscore'
./configure --prefix=/opt/netcdf-3.6.0-p1-g95
make
make test

As root :
# make install


C3 - pgf90
==========

Some versions of pgf90 prior to 5.2 have experienced problems
with the F90 inteface of netCDF.
Do not try to install a library for which "make test" has failed.

As root :
# mkdir /opt/netcdf-3.6.0-p1-pgf90

As an ordinary user :

export CC=/usr/bin/gcc
export CPPFLAGS='-DNDEBUG -DpgiFortran'
export CFLAGS=-O
export FC=pgf90
export FFLAGS="-O -w"
export CXX=g++
./configure --prefix=/opt/netcdf-3.6.0-p1-pgf90
make
make test

As root :
# make install


C4 - ifort 64 bit on Intel EMT64 or AMD Opteron
===============================================

As root :
# mkdir /opt/netcdf-3.6.0-p1-ifort

As an ordinary user :
export FC=ifort
export F90=ifort
export CFLAGS="-O -m64"
export FFLAGS="-mp -no-ipo"
export CPPFLAGS="-DNDEBUG -DpgiFortran"
./configure --prefix=/opt/netcdf-3.6.0-p1-ifort
make
make test

As root :
# make install


C5 - g95 64 bit on Intel EMT64 or AMD Opteron
=============================================

As root :
# mkdir /opt/netcdf-3.6.0-p1-g95-64

As an ordinary user :
export CC='gcc'
export CXX='g++'
export CPPFLAGS='-DNDEBUG -DpgiFortran'
export CFLAGS='-O -m64'
export FC='/usr/local/g95-64/bin/x86_64-unknown-linux-gnu-g95'
export F90='/usr/local/g95-64/bin/x86_64-unknown-linux-gnu-g95'
export FFLAGS='-O -g -fno-second-underscore'
export F90FLAGS='-O -g -fno-second-underscore'
./configure --prefix=/opt/netcdf-3.6.0-p1-g95-64
make
make test

As root :
# make install



CHIMERE configuration
=====================

At the top level of CHIMERE tree, you will find 6 files :

   Makefile.hdr.ifort
   Makefile.hdr.ifort-64
   Makefile.hdr.g95
   Makefile.hdr.g95-64
   Makefile.hdr.pgf90
   Makefile.hdr.pgf90-64

In the file corresponding to your compiler,
modify the line "NETCDF = " to point to your netCDF directory. 
For instance :

NETCDF = /opt/netcdf-3.6.0-p1-g95

Follow the comments in Makefile.hdr.xxxx for the other options.
Do not forget to link your compiler-specific Makefile.hdr.xxxx to
Makefile.hdr. for instance :

$ ln -sf Makefile.hdr.ifort Makefile.hdr
