NetCDF
NetCDF (Network Common Data Form) is an interface for array-oriented data access and a freely-distributed collection of software libraries for C, Fortran, C++, Perl and Java that provide implementations of the interface. The netCDF software was developed by Glenn Davis, Russ Rew, Steve Emmerson and Harvey Davies at the Unidata Program Center in Boulder, Colorado, and augmented by contributions from other netCDF users. The netCDF libraries define a machine-independent format for representing scientific data. Together, the interface, libraries, and format support the creation, access, and sharing of scientific data.
Which versions of netCDF are installed at LRZ?
On all Linux HPC Systems the C, C++, Fortran and Parallel netCDF APIs of netCDF are installed. We provide all libraries for both INTEL anc GCC compilers.
Depending on the system, the APIs are organized in different ways as explained in the following two paragraphs.
SuperMUC-NG and CoolMUC 2
As of June 2021 (spack release 21.1.1) the different APIs (C, C++, C++ legacy, Fortran and parallel-netCDF) together with HDF5 have been combined into bundle-packages called "netcdf-hdf5-all".
You can get a list of all available environment modules for netcdf with:
module av netcdf-hdf5-all
For a specific module, you can check the provided API and HDF5 versions via
~> module show netcdf-hdf5-all/MODULE_VERSION | grep VERSION
So e.g.:
module show netcdf-hdf5-all/4.6_hdf5-1.10-intel21-impi | grep VERSION setenv NETCDF_C_VERSION 4.6.3 setenv NETCDF_FORTRAN_VERSION 4.4.5 setenv NETCDF_CXX4_VERSION 4.3.1 setenv NETCDF_LEGACY_CXX_VERSION 4.2 setenv HDF5_VERSION 1.10.7 setenv PNETCDF_VERSION 1.11.2
The parallel modules also include pnetcdf and all packages are configured to use INTEL MPI.
For easier usage, each module sets several environment variables, which can be shown by
module show netcdf-hdf5-all
Here netcdf-hdf5-all reverts to the default module. The corresponding module ist loaded via:
module load netcdf-hdf5-all
Linux Clusters (except of CoolMUC 2)
You can get a list of all available environment modules for netCDF with:
module av netcdf
On the Linux Clusters (except of CoolMUC 2) the corresponding names of the environment modules are given in the following table:
Other Linux Clusters | |
---|---|
Module Names for GCC | Module Names for INTEL |
netCDF | |
netcdf/4.6.1-hdf5v1.8 netcdf/4.6.1-hdf5v1.10 netcdf/4.6.1-impi-hdf5v1.8-parallel netcdf/4.6.1-impi-hdf5v1.10-parallel | netcdf/4.6.1-intel-hdf5v1.8 netcdf/4.6.1-intel-hdf5v1.10 netcdf/4.6.1-intel-impi-hdf5v1.8-parallel netcdf/4.6.1-intel-impi-hdf5v1.10-parallel |
netCDF-4 C++ | |
netcdf-cxx4/4.3.0-hdf5v1.8 netcdf-cxx4/4.3.0-hdf5v1.10 netcdf-cxx4/4.3.0-impi-hdf5v1.8 netcdf-cxx4/4.3.0-impi-hdf5v1.10 | netcdf-cxx4/4.3.0-intel-hdf5v1.8 netcdf-cxx4/4.3.0-intel-hdf5v1.10 netcdf-cxx4/4.3.0-intel-impi-hdf5v1.8 netcdf-cxx4/4.3.0-intel-impi-hdf5v1.10 |
netCDF-Fortran | |
netcdf-fortran/4.4.4-hdf5v1.8 netcdf-fortran/4.4.4-hdf5v1.10 netcdf-fortran/4.4.4-impi-hdf5v1.8 netcdf-fortran/4.4.4-impi-hdf5v1.10 | netcdf-fortran/4.4.4-intel-hdf5v1.8 netcdf-fortran/4.4.4-intel-hdf5v1.10 netcdf-fortran/4.4.4-intel-impi-hdf5v1.8 netcdf-fortran/4.4.4-intel-impi-hdf5v1.10 |
Parallel netCDF | |
parallel-netcdf/1.8.1-impi | parallel-netcdf/1.8.1-intel-impi |
netCDF-3 C++Legacy (use only if you really need to) | |
netcdf-cxx/4.2-hdf5v1.8 netcdf-cxx/4.2-hdf5v1.10 netcdf-cxx/4.2-impi-hdf5v1.8-parallel netcdf-cxx/4.2-impi-hdf5v1.10-parallel | netcdf-cxx/4.2-intel-hdf5v1.8 netcdf-cxx/4.2-intel-hdf5v1.10 netcdf-cxx/4.2-intel-impi-hdf5v1.8-parallel netcdf-cxx/4.2-intel-impi-hdf5v1.10-parallel |
For easier usage, each module sets several environment variables, which can be shown by
module show netcdf module show netcdf-cxx4 module show netcdf-fortran module show pnetcdf module show netcdf-cxx
Here the module names revert to the default modules. A corresponding module is loaded via (e.g.):
module load netcdf/4.6.1-hdf5v1.10
Compilation for Serial Use
Make sure you load the appropriate module(s) (see above) first. For example, if you plan to use netCDF together with GCC on SuperMUC-NG or CoolMUC 2:
module load netcdf-hdf5-all/4.6_hdf5-1.10-gcc8-serial
For the other Linux clusters for use with INTEL one has to load for example:
module load netcdf/4.6.1-intel-hdf5v1.10 module load netcdf-cxx4/4.3.0-intel-hdf5v1.10 nodule load netcdf-fortran/4.4.4-intel-hdf5v1.10 module load netcdf-cxx/4.2-intel-hdf5v1.10
Of course, on the other Linux clusters you only need to load the modules for the APIs that you plan to use.
Compile your code with [Intel|GCC] as follows for the C, C++, Fortran and the legacy API:
[icc|gcc] -c $NETCDF_INC foo.c [icpc|g++] -c $NETCDF_CXX4_INC foo.cpp [ifort|gfortran] -c $NETCDF_FORTRAN_INC foo.f90 [icpc|g++] -c $NETCDF_LEGACY_CXX_INC foo.cpp # use only if really needed
Link your code with:
[icc|gcc] -o myprog.exe mainC.o foo.o $NETCDF_SHLIB [icpc|g++] -o myprog.exe mainCPP.o foo.o $NETCDF_CXX_SHLIB [ifort|gfortran] -o myprog.exe mainF.o foo.o $NETCDF_F90_SHLIB [icpc|g++] -o myprog.exe mainCPP.o foo.o $NETCDF_LEGACY_CXX_SHLIB # use only if really needed
Compilation for Parallel Use
Make sure you load the appropriate module first. For example, if you plan to use netCDF together with INTEL on SuperMUC-NG/CoolMUC 2:
module load netcdf-hdf5-all/4.6_hdf5-1.10-intel19-impi
For the other Linux clusters for use with GCC one has to load for example:
module load netcdf/4.6.1-impi-hdf5v1.10-parallel module load netcdf-cxx4/4.3.0-impi-hdf5v1.10 module load netcdf-fortran/4.4.4-impi-hdf5v1.10 module load netcdf-cxx/4.2-impi-hdf5v1.10-parallel # use only if really needed
Of course, on the other Linux clusters you only need to load the modules for the APIs that you plan to use.
For compilation then use the MPI compiler wrappers for [INTEL|GCC]:
[mpiicc|mpigcc] -c $NETCDF_INC foo.c [mpiicpc|mpigxx] -c $NETCDF_CXX4_INC foo.cpp [mpiifort|mpifc] -c $NETCDF_FORTRAN_INC foo.f90 [mpiicpc|mpigxx] -c $NETCDF_LEGACY_CXX_INC foo.cpp # use only if really needed
You can check with "MPICOMPILERWRAPPER --version"
if the wrapper uses to the correct compiler.
Linking is analogue:
[mpiicc|mpigcc] -o myprog.exe mainC.o foo.o $NETCDF_SHLIB [mpiicpc|mpigxx] -o myprog.exe mainCPP.o foo.o $NETCDF_CXX_SHLIB [mpiifort|mpifc] -o myprog.exe mainF.o foo.o $NETCDF_F90_SHLIB [mpiicpc|mpigxx] -o myprog.exe mainCPP.o foo.o $NETCDF_LEGACY_CXX_SHLIB
NetCDF Operators (NCO)
To make use of the NetCDF operators (NCO), please load the appropriate environment module. The available versions can be shown by:
module av nco
The default module is loaded by:
module load nco
Documentation
- Please refer to the netCDF Web Site for documentation of the interface. The manuals include a description of the integrated parallel facilities.
- Please refer to the PNetCDF Web Site for documentation of the pnetcdf interface.
- Documentation on the netCDF operators may be found on the NCO Web Site.