Building NetCDF* with the Intel® Compilers

来源:互联网 发布:计算机算法有什么 编辑:程序博客网 时间:2024/06/06 03:04

  • Introduction
  • Version information
  • Obtaining the source code
  • Obtaining the latest version of Intel® compilers
  • Prerequisites
  • Configuration and set-up information
  • Building NetCDF on Linux*
  • Set environment variables
  • Run configuration utility
  • Make the libraries
  • Testing NetCDF on Linux*
  • Installing NetCDF on Linux*
  • Building NetCDF on Mac OS*
  • Set environment variables
  • Run configuration utility
  • Make the libraries
  • Testing NetCDF on Mac OS*
  • Installing NetCDF on Mac OS*
  • Known issues and limitations

Introduction

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:http://www.unidata.ucar.edu/software/netcdf/ †

Version information

This application note was created to help users of NetCDF 3.6.2 build the libraries with the latest versions of Intel Fortran Compilers, specifically, version 10.0. This application note will also cover use of the Intel C++ Compiler version 10.0.


Obtaining the source code

The source code download is under NetCDF-3.6.2 C/C++/Fortran Source Code and Documentation from this URL:http://www.unidata.ucar.edu/downloads/netcdf/netcdf-3_6_2/index.jsp† . For example, select "netcdf.tar.gz - netCDF-3.6.2 as a gzipped tar file" to download.


Obtaining the latest version of Intel® compilers

Intel® Compilers
http://software.intel.com/en-us/articles/intel-compilers/


Prerequisites

The Intel Fortran Compiler and the Intel C++ Compiler are required to build the NetCDF libraries.

Hardware: The steps in this guide have been tested on Intel® Core™2 Duo processorsSoftware: This guide applies to version 10.0 of the Intel Compilers.

Configuration and set-up information

The Intel Fortran and C++ Compilers should be in your $PATH environment variable. Also, your $LD_LIBRARY_PATH environment variable should include the directory for the libraries provided with the Intel Compilers. Using the bash shell, this can be done by sourcing the ifortvars.sh and iccvars.sh files in the compiler bin/ directory. For example:

$ source /opt/intel/cce/10.0.xxx/bin/iccvars.sh
$ source /opt/intel/fce/10.0.xxx/bin/ifortvars.sh

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

$ cd <work directory>
$ tar -xvzf netcdf-3.6.2.tar.gz

Below are the steps needed to build NetCDF on Linux. If you wish to build for Mac OS X, skip ahead by clicking on this link tobuilding NetCDF on Mac OS*.


Building NetCDF on Linux*

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.


Set environment variables

  • To build for Linux with the Intel Fortran Compiler and Intel C++ Compiler, export the following environment variables:
$ export CC=icc
$ export CXX=icpc
$ export CFLAGS='-O3 -xT -ip -no-prec-div -static'
$ export CXXFLAGS='-O3 -xT -ip -no-prec-div -static'

$ export F77=ifort
$ export FC=ifort
$ export F90=ifort
$ export FFLAGS='-O3 -xT -ip -no-prec-div -static'

$ export CPP='icc -E'
$ export CXXCPP='icpc -E'

Note that the -xT compiler option will generate code using SSE3 instructions that are not available on processors older than Intel Core™ 2 Duo processors. If you will be using the lib raries on systems with older Intel® processors, you will want to use the –xP, -xN, or –xW options. Consult the online compiler documentation installed with the compiler for details about these options. For the 11.0 compiler, -xssse3 is equivalent to -xT, -xsse3 is equivalent to -xP, -xsse2 is equivalent to -xN, and -msse2 is equivalent to -xW.

The -O3 option is available for both Intel® and non-Intel microprocessors but it may result in more optimizations for Intel microprocessors than for non-Intel microprocessors. For more information on processor-specific optimizations, seeIntel® compiler options for SSE generation and processor-specific optimizations.


Run configuration utility

After the environment variables are exported, perform the configuration step by changing your directory to the NetCDF source directory and running the configuration script

$ cd netcdf-3.6.2
$ ./configure

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 this configure command:

$ ./configure --prefix=/your/desired/install/directory

Make the libraries

When the configuration step completes successfully, you can build the libraries using ‘make’.

$ make

Testing NetCDF on Linux*

You can test your NetCDF libraries using ‘make check’.

$ make check

Installing NetCDF on Linux*

Install NetCDF libraries using ‘make install’.

$ make install

This will install the NetCDF libraries, include files, and utilities in the default location of /usr/local or the location specified in the configuration step with the --prefix= option.


Building NetCDF on Mac OS* (or skip back to Building NetCDF on Linux*)

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.


Set environment variables

  • To build for Mac OS with the Intel® Fortran Compiler and theIntel C++ Compiler on an IA-32 system, export the following environment variables:
$ export CC=icc
$ export CXX=icpc
$ export CFLAGS='-O3 -xP -ip -no-prec-div'
$ export CXXFLAGS='-O3 -xP -ip -no-prec-div '

$ export F77=ifort
$ export FFLAGS='-xP -O3 -ip -no-prec-div -mdynamic-no-pic'
  • To build for Mac OS with the Intel Fortran Compiler and the Intel C++ Compiler on an Intel® 64 system, export the following environment variables:
$ export CC=icc
$ export CXX=icpc
$ export CFLAGS='-O3 -xT -ip -no-prec-div -m64'
$ export CXXFLAGS='-O3 -xT -ip -no-prec-div -m64'

$ export F77=ifort
$ export FFLAGS='-O3 -xT -ip -no-prec-div -m64'

Run configuration utility

After the environment variables are exported, perform the configuration step by changing your directory to the NetCDF source directory and running the configuration script

$ cd netcdf-3.6.2
$ ./configure

Th e 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 this configure command:

$ ./configure --prefix=/your/desired/install/directory

Make the libraries

When the configuration step completes successfully, you can build the libraries using ‘make’.

$ make

Testing NetCDF on Mac OS*

You can test your NetCDF libraries using ‘make check’.

$ make check

Installing NetCDF on Mac OS*

Install NetCDF libraries using ‘make install’.

$ make install

This will install the NetCDF libraries, include files, and utilities in the default location of /usr/local or the location specified in the configuration step with the --prefix= option.


Known issues and limitations

On systems that support 32-bit and 64-bit compilation, ensure that the Fortran and C++ compilers are properly matched so that you are not mixing 32-bit and 64-bit object files. If you cannot complete the configuration step, verify that you have selectedcompatible pairs of 32-bit Fortran and C++ compilers or 64-bit Fortran and C++ compilers.

There is a known issue with the Intel C++ Compiler for Mac OS X version 10.0.016 when building a 64-bit version of netCDF. The symptom is that the 'make check' step will fail with incorrect results. To check your version of the Intel C++ Compiler for Mac OS X, enter the following command:

icc -V

and look for the "Package ID" string. The last portion of this string, the numeric digits, is your version number. This issue only affects the Intel C++ compiler for Mac OS X version 10.0.016 and only when building a 64-bit version of netCDF. As a work around on Mac OS X, only build the 32-bit version of netCDF or update your C++ compiler to a newer version (higher-numbered) of the compiler.
原创粉丝点击