Re: [netcdfgroup] Problem compiling netcdf4

With MPICH, you do need to use mpicc/mpif90. You may just be missing the mpif90/77, as Rob suggested. For example:

HDF-5
./configure --prefix=/opt/local/hdf5mpich --enable-parallel LIBS=-lz FC=mpif90 F90=mpif90 CC=mpicc F77=mpif77 --enable-fortran LIBS=-lz

netCDF4:
./configure --prefix=/opt/local/netcdf4mpich --enable-netcdf-4 -- enable-parallel-tests F77=mpif77 FC=mpif90 F90=mpif90 CC=mpicc --with- hdf5=/opt/local/hdf5mpich CPPFLAGS=-DpgiFortran --disable-cxx

-- Ted



On Sep 2, 2009, at 3:58 PM, Rob Latham wrote:

On Wed, Sep 02, 2009 at 04:50:29PM -0400, Carlos Moffat wrote:
Hello,

I'm trying to compile NetCDF v4.0.1 to run the ROMS model
(http://www.myroms.org) in a parallel configuration.

What I've done so far is to install MPICH2 with the configuration

./configure --enable-f90 --with-mpe --with-romio --prefix=/usr/local

looks good

and HDF5 (v1.8.3) with the options:

CC=mpicc LIBS="-lm -lz" CPPFLAGS="-DpgiFortran" ./configure
--enable-parallel --enable-fortran  --prefix=/usr/local

(I believe the "LIBS" options are not necessary here but they don't
hurt). A 'make check' works nicely here.

yup, this looks good too.

I have the intel fortran compiler installed (v11.0). When I compile
netcdf v4.0.1 with:

CC=mpicc CPPFLAGS="-DpgiFortran" LIBS="-lm -lz -lhdf5" ./configure
--enable-netcdf-4 --prefix=/usr/local

using 'make check', the the build fails with the output I've pasted
below. It looks like the HDF5 libraries were compiled without the
necessary MPI support, but my understanding is that the
'--enable-parallel' flag should do this. Am I missing something?

Actually the errors you get *confirm* that HDF5 was compiled with MPI
support: it's the HDF5 library that is requesting MPI symbols, but
there is no mpi library in your link command.

libtool: link: ifort -I../fortran -I../libsrc4 -I../f90 -g -o nf_test
test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o
util.o fortlib.o ../libsrc4/.libs/libnetcdf.a -lhdf5_hl -lm -lz - lhdf5 ../libsrc4/.libs/libnetcdf.a(nc4file.o): In function `nc_check_for_hdf5':
/home/cmoffat/Sandbox/netcdf-4.0.1/libsrc4/nc4file.c:141: undefined
reference to `MPI_File_open'

I don't know why libtool wants to link with ifort here. I think instead you
need to link with mpif90.  If you would prefer to link "by hand", then
you will have to add the '-L/path/to/mpi -lmpich2' commands to your
link step.

you could also compile/link with the 'h5pcc' script, but that's
essentially the mpi wrapper scripts with one or two more HDF5
libraries in there.  You've accomplished the same thing with your
'LIBS=' line when compiling netcdf4.

Maybe if you try setting the fortran compiler to mpif90 when you configure
netcdf 4 that will make things work better?

==rob

--
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA

_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: