编译并行netCDF时出错

时间:2015-03-09 13:59:47

标签: compilation compiler-errors hdf5 netcdf

我正在尝试使用并行版本的HDF5编译和安装netCDF。

首先我安装了一个最新的zlib,然后我安装了一个串行HDF5和一个并行的HDF5,以便

/ scratch / mycomputername / packages / ...包含HDF5和zlib lib,include,bin文件夹。

/ scratch / mycomputername / packages_parallel ...包含并行HDF5和zlib lib,include和bin文件夹。

*** ZLIB INSTALL:

./configure --prefix=/scratch/mycomputername/packages
make
make test
make install prefix=/scratch/mycomputername/packages

&安培;

./configure --prefix=/scratch/mycomputername/packages_parallel
make
make test
make install prefix=/scratch/mycomputername/packages_parallel

*** HDF5 INSTALL:

./configure --prefix=/scratch/mycomputername/packages --enable-fortran --with-zlib=/scratch/mycomputername/packages/include,/scratch/mycomputername/packages/lib
make
make check
make install prefix=/scratch/dione/packages

&安培;

./configure --prefix=/scratch/mycomputername/packages_parallel --enable-parallel --enable-fortran --with-zlib=/scratch/mycomputername/packages_parallel/include,/scratch/mycomputername/packages_parallel/lib
make
make check
make install prefix=/scratch/mycomputername/packages_parallel

***然后,安装我使用的串行netCDF

./configure --prefix=/scratch/mycomputername/packages CPPFLAGS=-I/scratch/mycomputername/packages/include LDFLAGS=-L/scratch/computername/packages/lib
make
make check
make install prefix=/scratch/mycomputername/packages

这成功了。

***但是,当我尝试为并行netCDF做同样的事情时,我遇到了错误。 我用了

./configure --prefix=/scratch/mycomputername/packages_parallel CPPFLAGS=-I/scratch/mycomputername/packages_parallel/include LDFLAGS=-L/scratch/mycomputername/packages_parallel/lib

我收到错误: checking hdf5.h usability ... no checking hdf5.h presence ... no checking for hdf5.h ... no configure: error: Compiling a test with HDF5 failed. Either hdf5.h cannot be found, or config.log should be checked for other reason

我也试过了 ./configure --prefix=/scratch/computername/packages_parallel --with-hdf5=/scratch/mycomputername/packages_parallel/ --with-zlib=/scratch/mycomputername/packages_parallel/lib 但我收到上面引用的错误消息。

有谁知道为什么并行版本可能无法找到HDF5库?

2 个答案:

答案 0 :(得分:2)

确保为编译和安装的每个包添加.profile或.bashrc文件的必要路径。例如,您需要在安装ZLIB之后添加它(假设安装目录是/ usr / local):

if [ -z "${ZLIBDIR}" ]
then
ZLIBDIR="/usr/local"; export ZLIBDIR
else
ZLIBDIR="/usr/local:${ZLIBDIR}"; export ZLIBDIR
fi

对于HDF5,我总是使用以下内容:

export HDF5_LIB_DIR="/usr/local/lib"
if [ -z "${LD_LIBRARY_PATH}" ]
then
LD_LIBRARY_PATH="/usr/local/lib"; export LD_LIBRARY_PATH
else
LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH
fi
if [ -z "${LIBDIR}" ]
then
LIBDIR="/usr/local/lib"; export LIBDIR
else
LIBDIR="/usr/local/lib:${LIBDIR}"; export LIBDIR
fi
export INCLUDE=/usr/local/lib:$Include
export PATH=/usr/local/bin:$PATH
export HDF5_LIB_DIR=/usr/local/lib
export HDF5DIR=/usr/local
export HDF5_DIR=/usr/local
export CPPFLAGS="-I$HDF5_DIR/include -I/usr/local/include"
export LDFLAGS="-L$HDF5_DIR/lib -L/usr/local/lib"

最后,安装NetCDF之后我使用:

export NETCDFHOME=/usr/local
export NETCDF_PREFIX=/usr/local
export NETCDF_LIB=/usr/local/lib
export NETCDF4_ROOT=/usr/local
export NETCDF4_DIR=/usr/local
export NETCDF_INC=/usr/local/include
export PATH=/usr/local/bin:$PATH

希望这会有所帮助。干杯,特隆德

答案 1 :(得分:1)

从netcdf README文件中,建议指定包含路径(CPPFLAGS)和链接器标志(LDFLAGS,库路径和其他库)。

当我包含pnetcdf,并将hdf5 include目录的路径添加到CPPFLAGS,以及hdf5 lib目录的路径以及mpi库的路径和 -lmpi 到LDFLAGS。

以下是一个命令中的所有内容:

CPPFLAGS="-I/usr/local/pnetcdf/include -I/usr/local/hdf5/include -I/usr/local/mpi/include" LDFLAGS="-L/usr/local/hdf5/lib -L/usr/local/pnetcdf/lib -L/usr/local/mpi/lib -lmpi" ./configure --prefix=/usr/local/netcdf --enable-netcdf4 --enable-pnetcdf