Compile PIO with NetCDF 4 enabled

689 views
Skip to first unread message

huangw...@gmail.com

unread,
May 17, 2016, 10:48:35 AM5/17/16
to MPAS-Atmosphere Help
Hi, there,

I have been able to compile PIO 1.9.23 successfully, and it runs fine with netcdf. But I have problem to use iotype netcdf4.

here is the error message at run time:

WARNING: PIO was not built with NETCDF 4 support changing iotype to netcdf

I tried to compile hdf5, and netcdf 4 with parallel-enabled.

Could someone help me to build PIO properly?

Thanks,

Wei Huang

MPAS-Atmosphere Help

unread,
May 17, 2016, 4:55:53 PM5/17/16
to MPAS-Atmosphere Help
Hi, Wei.

Here are the steps that I've used with GNU, Intel, and PGI compilers on Linux to successfully build I/O libraries for MPAS with parallel netCDF4 support. For convenience, I've placed all of the source code for the required libraries into a directory identified by the LIBSRC environment variable. I've used the following library versions:

Cmake 3.4.0
zlib 1.2.8
HDF5 1.8.14
Parallel-netCDF 1.7.0
netCDF (C) 4.4.0
netCDF (Fortran) 4.4.3
PIO 1.9.23

########################################

# Set directory where library sources reside

########################################

export LIBSRC=/sysdisk1/duda/io_library_sources


########################################

# Set directory under which all libraries will be installed

########################################

export LIBBASE=/sysdisk1/duda/test_gcc



########################################

# Set up serial and MPI compilers

########################################

export SERIAL_FC=gfortran

export SERIAL_F77=gfortran

export SERIAL_CC=gcc

export SERIAL_CXX=g++

export MPI_FC=mpif90

export MPI_F77=mpif77

export MPI_CC=mpicc

export MPI_CXX=mpicxx


########################################

# Install cmake

########################################

tar xzvf ${LIBSRC}/cmake-3.4.0-rc3.tar.gz

cd cmake-3.4.0-rc3

export CC=$SERIAL_CC

export CXX=$SERIAL_CXX

export F77=$SERIAL_F77

export FC=$SERIAL_FC

./bootstrap --prefix=${LIBBASE}

gmake

gmake install

export PATH=${LIBBASE}/bin:$PATH

cd ..


########################################

# Install zlib

########################################

tar xzvf ${LIBSRC}/zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure --prefix=${LIBBASE}

make

make install

cd ..


########################################

# Install HDF5

########################################

tar xjvf ${LIBSRC}/hdf5-1.8.14.tar.bz2

cd hdf5-1.8.14

export FC=$MPI_FC

export CC=$MPI_CC

export CXX=$MPI_CXX

./configure --prefix=${LIBBASE} --enable-parallel --with-zlib=${LIBBASE} --enable-fortran

make

make check

make install

cd ..


########################################

# Install Parallel-netCDF

########################################

tar xjvf ${LIBSRC}/parallel-netcdf-1.7.0.tar.bz2

cd parallel-netcdf-1.7.0

export CC=$SERIAL_CC

export CXX=$SERIAL_CXX

export F77=$SERIAL_F77

export FC=$SERIAL_FC

export MPICC=$MPI_CC

export MPICXX=$MPI_CXX

export MPIF77=$MPI_F77

export MPIF90=$MPI_FC

./configure --prefix=${LIBBASE}

make

make testing

make install

export PNETCDF=${LIBBASE}/parallel-netcdf

cd ..


########################################

# Install netCDF (C library)

########################################

tar xzvf ${LIBSRC}/netcdf-4.4.0.tar.gz

cd netcdf-4.4.0

export CPPFLAGS="-I${LIBBASE}/include"

export LDFLAGS="-L${LIBBASE}/lib"

export LIBS="-lhdf5_hl -lhdf5 -lz -ldl"

export LD_LIBRARY_PATH=${LIBBASE}/lib:$LD_LIBRARY_PATH

export CC=$MPI_CC

./configure --prefix=${LIBBASE} --disable-dap --enable-netcdf4 --enable-pnetcdf --enable-parallel-tests --disable-shared

make

make check

make install

export NETCDF=${LIBBASE}/netcdf

cd ..


########################################

# Install netCDF (Fortran interface library)

########################################

tar xzvf ${LIBSRC}/netcdf-fortran-4.4.3.tar.gz

cd netcdf-fortran-4.4.3

export FC=$MPI_FC

export F77=$MPI_F77

export LIBS="-lnetcdf ${LIBS}"

./configure --prefix=${LIBBASE} --enable-parallel-tests --disable-shared

make

make check

make install

cd ..


########################################

# Install PIO

########################################

tar xzvf ${LIBSRC}/pio1_9_23.tar.gz

cd ParallelIO-pio1_9_23

cd pio

export PIOSRC=`pwd`

git clone https://github.com/PARALLELIO/genf90.git bin

git clone https://github.com/CESM-Development/CMake_Fortran_utils.git cmake

cd ../..

pushd $LIBBASE

mkdir pio-1.9.23

cd pio-1.9.23

cmake -DNETCDF_C_DIR=$NETCDF -DNETCDF_Fortran_DIR=$NETCDF -DPNETCDF_DIR=$PNETCDF -DCMAKE_VERBOSE_MAKEFILE=1 $PIOSRC

make

export PIO=`pwd`

popd


########################################

# Besides the NETCDF, PNETCDF, and PIO environment variables

# as set above, the following environment variables must be set before compiling MPAS

########################################


export MPAS_EXTERNAL_LIBS="-L${LIBBASE}/lib -lhdf5_hl -lhdf5 -ldl -lz"

export MPAS_EXTERNAL_INCLUDES="-I${LIBBASE}/include"


Hopefully something like this will work in your case.

Best regards,
Michael

huangw...@gmail.com

unread,
May 18, 2016, 9:21:32 AM5/18/16
to MPAS-Atmosphere Help, huangw...@gmail.com
Hi, Michael,

I followed the instructions you posted here, and I got MPAS output with
NetCDF4 format.

Thanks a lot.

Wei

Reply all
Reply to author
Forward
0 new messages