Building NetCDF* with the Intel® compilers

By Amanda K Sharp,

Published:01/24/2013   Last Updated:07/17/2015


This guide is intended to help Intel® Fortran Compiler customers build the NetCDF software libraries on Intel® architecture systems running Linux* or Mac OS*. This guide will also cover use of the Intel® C++ Compiler, although it is not required to build NetCDF.

NetCDF (Network Common Data Form) is a machine-independent, self-describing, binary data format standard for exchanging scientific data. Information about NetCDF can be obtained from the University Corporation for Atmospheric Research (UCAR), website:

Version Information

NetCDF 4.1.3 or later
Intel® C++ Compiler for Linux* or Mac OS* X
Intel® Fortran Compiler for Linux* or Mac OS* X

Obtaining the Source Code

The source code is available for download from

Obtaining the latest version of the Intel® compilers

Licensed users of the Intel® compilers may download the most recent versions of the compiler from the Intel® Software Development Products Registration Center. Evaluation versions of the Intel® compilers may be found at the Intel® Software Evaluation Center.


Additional software packages may be required when building NetCDF. Please check the NetCDF website for details.

Configuration and Setup Information

In order to use this guide, you will need to have the Intel® C++ Compiler and the Intel® Fortran Compiler installed on your build system. After installing the compilers, you will need to execute one of the following commands below, depending on your architecture, to set the environment variables.

source <compiler_install_dir>/bin/ ia32
source <compiler_install_dir>/bin/ intel64

After downloading the NetCDF tar file, extract the NetCDF source code in a work directory.

cd <work_directory>
tar -xvzf netcdf-

Note: The instructions below apply to both Linux* and Mac OS* X unless otherwise noted.

Building NetCDF

The NetCDF build process starts with a configuration step. The configuration script uses environment variables to select the compilers and compiler options to use when building NetCDF. Begin by setting the following environment variables.

For Linux*:

export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=ifort
export FC=ifort
export F90=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CPP='icc -E'
export CXXCPP='icpc -E'

For Mac OS* X:

export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div'
export F77=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -mdynamic-no-pic'

Note: The -xHost compiler option will generate code using the highest instruction set available on the build system's processor.

After the environment variables are exported, perform the configuration step by changing your directory to the NetCDF source directory and running the configuration script. The configuration script will set up the Makefiles that will be used to build the NetCDF libraries and utilities. It will also set up the installation directory for the default location of /usr/local. If you would like to install the libraries in another location, use the --prefix= option with the configure command:

cd netcdf-4.1.3
./configure --prefix=/your/desired/install/directory

When the configuration step completes successfully, you can build the libraries, test the build, and then install the software.

make check
make install

Known Issues and Limitations

At this time, there are no known issues with using the Intel compilers to build NetCDF. Please see the NetCDF website for all known issues and limitations.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at