×

Owens Information Transition

Owens cluster will be decommissioned on February 3, 2025. Some pages may still reference Owens after Owens is decommissioned , and we are in the process of gradually updating the content. Thank you for your patience during this transition

NetCDF

NetCDF (Network Common Data Form) is an interface for array-oriented data access and a library that provides an implementation of the interface. The netcdf library also defines a machine-independent format for representing scientific data. Together, the interface, library, and format support the creation, access, and sharing of scientific data.

Availability and Restrictions

Versions

NetCDF is available on Pitzer and Owens Clusters. The versions currently available at OSC are:

Version Owens Pitzer Ascend Cardinal
4.3.3.1 X      
4.6.1 X X    
4.6.2 X X    
4.7.4 X* X*    
4.8.1 X X X* X
* Current default version

You can use module spider netcdf to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.

Additionally, the C++ interface version 4.3.0 and the Fortran interface version 4.4.2 is included in the netcdf/4.3.3.1 module.

On Cardinal the netcdf module is split into three parts: netcdf-c for the C interface, netcdf-fortran for the Fortran interface and netcdf-cxx4 for the C++ interface. You can load netcdf-c with  module load netcdf-c, netcdf-cxx4 with module load netcdf-cxx4, and netcdf-fortran with module load netcdf-fortran

Access

NetCDF is available to all OSC users. If you have any questions, please contact OSC Help.

Publisher/Vendor/Repository and License Type

University Corporation for Atmospheric Research, Open source

Usage

Usage on Owens

Set-up

Initalizing the system for use of the NetCDF is dependent on the system you are using and the compiler you are using. To load the default NetCDF, run the following command: module load netcdf. To use the parallel implementation of NetCDF, run the following command instead: module load pnetcdf. To load a particular version, use  module load netcdf/version. For example, use  module load netcdf/4.3.3.1 to load NetCDF version 4.3.3.1. You can use module spider netcdf to view available modules.

Building With NetCDF

With the netcdf library loaded, the following environment variables will be available for use:

Variable Use
$NETCDF_CFLAGS Use during your compilation step for C or C++ programs.
$NETCDF_FFLAGS Use during your compilation step for Fortran programs.
$NETCDF_LIBS Use when linking your program to NetCDF.

 

Similarly, when the pnetcdf module is loaded, the following environment variables will be available:

VARIABLE USE
$PNETCDF_CFLAGS Use during your compilation step for C programs.
$PNETCDF_FFLAGS Use during your compilation step for Fortran programs.
$PNETCDF_LIBS Use when linking your program to NetCDF.
 

 

For example, to build the code myprog.c with the netcdf library you would use:

icc -c $NETCDF_CFLAGS myprog.c
icc -o myprog myprog.o $NETCDF_LIBS

Batch Usage

When you log into owens.osc.edu you are actually logged into a linux box referred to as the login node. To gain access to the mutiple processors in the computing environment, you must submit your job to the batch system for execution. Batch jobs can request mutiple nodes/cores and compute time up to the limits of the OSC systems. Refer to Queues and Reservations and Batch Limit Rules for more info. 

Non-interactive Batch Job (Serial Run)
A batch script can be created and submitted for a serial or parallel run. You can create the batch script using any text editor you like in a working directory on the system of your choice. You must load the netcdf or pnetcdf module in your batch script before executing a program which is built with the netcdf library. Below is the example batch script that executes a program built with NetCDF:
#!/bin/bash
#SBATCH --job-name=job-name
#SBATCH --nodes=1 --ntasks-per-node=28
#SBATCH --account <project-account>

module load netcdf
cp foo.dat $TMPDIR
cd $TMPDIR
appname < foo.dat > foo.out
cp foo.out $SLURM_SUBMIT_DIR

Usage on Pitzer

Set-up

Initalizing the system for use of the NetCDF is dependent on the system you are using and the compiler you are using. To load the default NetCDF, run the following command: module load netcdf

Building With NetCDF

With the netcdf library loaded, the following environment variables will be available for use:

VARIABLE USE
$NETCDF_CFLAGS Use during your compilation step for C or C++ programs.
$NETCDF_FFLAGS Use during your compilation step for Fortran programs.
$NETCDF_LIBS Use when linking your program to NetCDF.

 

Similarly, when the pnetcdf module is loaded, the following environment variables will be available:

VARIABLE USE
$PNETCDF_CFLAGS Use during your compilation step for C programs.
$PNETCDF_FFLAGS Use during your compilation step for Fortran programs.
$PNETCDF_LIBS Use when linking your program to NetCDF.
 

 

For example, to build the code myprog.c with the netcdf library you would use:

icc -c $NETCDF_CFLAGS myprog.c
icc -o myprog myprog.o $NETCDF_LIBS

Batch Usage

When you log into owens.osc.edu you are actually logged into a linux box referred to as the login node. To gain access to the mutiple processors in the computing environment, you must submit your job to the batch system for execution. Batch jobs can request mutiple nodes/cores and compute time up to the limits of the OSC systems. Refer to Queues and Reservations and Batch Limit Rules for more info. 

Non-interactive Batch Job (Serial Run)
A batch script can be created and submitted for a serial or parallel run. You can create the batch script using any text editor you like in a working directory on the system of your choice. You must load the netcdf or pnetcdf module in your batch script before executing a program which is built with the netcdf library. Below is the example batch script that executes a program built with NetCDF:
#!/bin/bash 
#SBATCH --job-name=job-name
#SBATCH --nodes=1 --ntasks-per-node=48 
#SBATCH --account <project-account> 

module load netcdf 
cp foo.dat $TMPDIR 
cd $TMPDIR 
appname < foo.dat > foo.out 
cp foo.out $SLURM_SUBMIT_DIR

Usage on Cardinal

Set-up

Initalizing the system for use of the NetCDF is dependent on the system you are using and the compiler you are using. To load the default NetCDF C interface, run the following command: module load netcdf-c. The pnetcdf module is parallel-netcdf on Cardinal. To load parallel-netcdf, run the following command: module load parallel-netcdf 

Building With NetCDF

With any of the netcdf libraries loaded, the following environment variables will be available for use:

VARIABLE USE
$NETCDF_CFLAGS Use during your compilation step for C or C++ programs.
$NETCDF_FFLAGS Use during your compilation step for Fortran programs.
$NETCDF_LIBS Use when linking your program to NetCDF.

 

Similarly, when the parallel-netcdf module is loaded, the following environment variables will be available:

VARIABLE USE
$PNETCDF_CFLAGS Use during your compilation step for C programs.
$PNETCDF_FFLAGS Use during your compilation step for Fortran programs.
$PNETCDF_LIBS Use when linking your program to NetCDF.
 

 

For example, to build the code myprog.c with the netcdf library you would use:

icc -c $NETCDF_CFLAGS myprog.c
icc -o myprog myprog.o $NETCDF_LIBS

Batch Usage

When you log into owens.osc.edu you are actually logged into a linux box referred to as the login node. To gain access to the mutiple processors in the computing environment, you must submit your job to the batch system for execution. Batch jobs can request mutiple nodes/cores and compute time up to the limits of the OSC systems. Refer to Queues and Reservations and Batch Limit Rules for more info. 

Non-interactive Batch Job (Serial Run)
A batch script can be created and submitted for a serial or parallel run. You can create the batch script using any text editor you like in a working directory on the system of your choice. You must load the netcdf or parallel-netcdf module in your batch script before executing a program which is built with the netcdf library. Below is the example batch script that executes a program built with NetCDF C interface:
#!/bin/bash 
#SBATCH --job-name=job-name
#SBATCH --nodes=1 --ntasks-per-node=48 
#SBATCH --account <project-account> 

module load netcdf-c 
cp foo.dat $TMPDIR 
cd $TMPDIR 
appname < foo.dat > foo.out 
cp foo.out $SLURM_SUBMIT_DIR

Further Reading

See Also

Tag: 
Service: