Difference between revisions of "NetCDF"

From HPC users
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
  module avail netcdf
  module avail netcdf


Within the modules the interfaces, header files and libraries for Fortran, C and C++ are available. The libraries compiled with NetCDF 4 and HDF5 support, but without parallel support.  
Within the modules the interfaces, header files and libraries for Fortran, C and C++ are available. The libraries are compiled with NetCDF 4 and HDF5 support, but without parallel support.  


The ''intel'' and ''gcc'' versions are compiled with the Intel or the GNU compilers. This distiction is needed for Fortran because the ''.mod'' files are incompatible between ''gfortran' and ''ifort''.
The ''intel'' and ''gcc'' versions are compiled with the Intel or the GNU compilers. This distiction is needed for Fortran because the ''.mod'' files are incompatible between ''gfortran' and ''ifort''.


== Compilation and Linking ==
== Compilation and Linking ==
When loading the module for convinience the environment variables '''NETCDF_DIR''', '''NETCDF_INCDIR''' and '''NETCDF_LIBDIR''' are set to the main, include and library directory of NetCDF.
When loading the module for convinience the environment variables ''NETCDF_DIR'', ''NETCDF_INCDIR'' and ''NETCDF_LIBDIR'' are set to the main, include and library path of NetCDF, respectively. The extension of the search path for header/module files is simply done by the compiler option
 
-I$NETCDF_INCDIR
 
or in a ''Makefile''
 
-I$(NETCDF_INCDIR)
 
The libraries can be linked by the compiler options
 
  -L$NETCDF_LIBDIR -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz
 
When using the C++ or Fortran interface please use
 
  -L$NETCDF_LIBDIR -lnetcdf_c++4 -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz
 
or
 
  -L$NETCDF_LIBDIR -lnetcdff -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz
 
repectively. If you use a Makefile don't forget  the round bracket around the environment variable names (see above).
 
 
== External links ==
* [http://www.unidata.ucar.edu/software/netcdf/ NetCDF homepage]

Latest revision as of 17:36, 6 February 2015

The NetCDF package is a software and library to write machine independently large data sets. Different versions compiled with different compilers are available. A list is given by typing

module avail netcdf

Within the modules the interfaces, header files and libraries for Fortran, C and C++ are available. The libraries are compiled with NetCDF 4 and HDF5 support, but without parallel support.

The intel and gcc versions are compiled with the Intel or the GNU compilers. This distiction is needed for Fortran because the .mod files are incompatible between gfortran' and ifort.


Compilation and Linking

When loading the module for convinience the environment variables NETCDF_DIR, NETCDF_INCDIR and NETCDF_LIBDIR are set to the main, include and library path of NetCDF, respectively. The extension of the search path for header/module files is simply done by the compiler option

-I$NETCDF_INCDIR

or in a Makefile

-I$(NETCDF_INCDIR)

The libraries can be linked by the compiler options

 -L$NETCDF_LIBDIR -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

When using the C++ or Fortran interface please use

 -L$NETCDF_LIBDIR -lnetcdf_c++4 -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

or

 -L$NETCDF_LIBDIR -lnetcdff -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

repectively. If you use a Makefile don't forget the round bracket around the environment variable names (see above).


External links