BISMG:SarahS/install netcdf

How to install netcdf libraries on bluecrystalp3
You need to build the c and gfortran libraries separately
 * Download the c library from here
 * wget https://github.com/Unidata/netcdf-c/archive/v4.3.3-rc2.tar.gz


 * Download the fortran libraries from here
 * wget https://github.com/Unidata/netcdf-fortran/archive/v4.4.0.tar.gz


 * Uncompress the files tar -xvzf filename.gz


 * Build the c netcdf libraries in this directory mkdir netcdf. The built c and fortran libraries have different names so it should not cause a conflict
 * Call configure home dir.
 * CPPFLAGS=-I/cm/shared/libraries/gnu_builds/hdf5-1.8.12/include/ LDFLAGS="-L/cm/shared/libraries/gnu_builds/hdf5-1.8.12/lib -lhdf5_hl -lhdf5 -lz" ../netcdf-c-4.3.3-rc2/configure --prefix=/panfs/panasas01/geog/ggsrs/netcdf
 * make
 * make install
 * make check


 * Build the fortran netcdf libraries in this directory. Remember to link to the hdf5 libraries.
 * mkdir netcdff-build, cd netcdff-build
 * CPPFLAGS=-I/$HOME/netcdf/include/ LDFLAGS="-L/$HOME/netcdf/lib -lnetcdf -L/cm/shared/libraries/gnu_builds/hdf5-1.8.12/lib -lhdf5_hl -lhdf5 -lz" ../netcdf-fortran-4.4.0/configure --prefix=/panfs/panasas01/geog/ggsrs/netcdf
 * make
 * make install
 * make check


 * /panfs/panasas01/geog/ggsrs/netcdf should contain fortran and c netcdf libraries

For information on the netcdf library paths use these commands netcdf/bin/nf-config --fflags netcdf/bin/nf-config --flibs

How to install parallel version of the netcdf libraries on bluecrystalp3

 * Need to install parallel hdf5 and rebuild netcdf c and fortran netcdf libraries in parallel linking to parallel hdf5
 * Create directories for build libraries, phdf5, pnetcdf (put c and fortran libraries here)
 * Download parallel hdf5 from here http://www.hdfgroup.org/HDF5/release/obtainsrc.html
 * Add the parallel c compiler. module add mvapich2/gcc/64/1.7-qlc
 * Needed the CFLAGS=-fPIC when hdf5 in parallel or else it complains when I try to build the c library in parallel after.
 * CC=mpicc CXX=mpiCC CPPFLAGS=-I/panfs/panasas01/geog/ggsrs/phdf5-build/include/ LDFLAGS="-L/panfs/panasas01/geog/ggsrs/phdf5-build/lib -lhdf5_hl -lhdf5 -lz" CFLAGS=-fPIC ./configure --enable-pnetcdf --prefix=/panfs/panasas01/geog/ggsrs/pnetcdf
 * make && make install & make check


 * to make the c library in parallel do this
 * CC=mpicc CXX=mpiCC CPPFLAGS=-I/panfs/panasas01/geog/ggsrs/phdf5-build/include/ LDFLAGS="-L/panfs/panasas01/geog/ggsrs/phdf5-build/lib -lhdf5_hl -lhdf5 -lz" CFLAGS=-fPIC ./configure --prefix=/panfs/panasas01/geog/ggsrs/pnetcdf
 * make, make install, make check


 * to make the fortran library in parallel do this
 * CC=mpicc CXX=mpicc F90=mpif90 FC=mpif90 CPPFLAGS=-I/panfs/panasas01/geog/ggsrs/pnetcdf/include/ LDFLAGS="-L/panfs/panasas01/geog/ggsrs/pnetcdf/lib -lnetcdf -L/panfs/panasas01/geog/ggsrs/phdf5-build/lib -lhdf5_hl -lhdf5 -lz" ./configure --prefix=/panfs/panasas01/geog/ggsrs/pnetcdf
 * make, make install, make check