fixed fortran parallel I/O flag bug

This commit is contained in:
Ed Hartnett 2011-06-02 22:46:15 +00:00
parent 2aaf368257
commit c199d81417
11 changed files with 33 additions and 31 deletions

View File

@ -407,7 +407,7 @@ AC_MSG_RESULT([$nc_build_f77])
# Do we want to build the fortran 77 API? Check for --disable-fortran
# for Russ, who can never remember --disable-f77..
AC_MSG_CHECKING([whether any Fortran API is desired])
AC_ARG_ENABLE([f77],
AC_ARG_ENABLE([fortran],
[AS_HELP_STRING([--disable-fortran],
[don't try to build the netCDF Fortran 77 or \
Fortran 90 APIs (same effect as --disable-f77)])])
@ -415,7 +415,6 @@ test "x$enable_fortran" = "xno" && nc_build_f77=no
AC_MSG_RESULT([$nc_build_f77])
# Do we want to build the fortran 90 API?
nc_build_f90=yes
AC_MSG_CHECKING([whether F90 API is desired])
AC_ARG_ENABLE([f90],
[AS_HELP_STRING([--disable-f90],

View File

@ -72,7 +72,7 @@
nf90_max_attrs = 8192, &
nf90_max_vars = 8192, &
nf90_max_name = 256, &
nf90_max_var_dims = nf90_max_dims
nf90_max_var_dims = 1024
!
! error codes:

View File

@ -724,15 +724,16 @@
if(present(count)) localCount (:size(count) ) = count(:)
if(present(stride)) localStride(:size(stride)) = stride(:)
if(present(map)) then
localMap (:size(map)) = map(:)
nf90_put_var_2D_FourByteInt = &
nf_put_varm_int(ncid, varid, localStart, localCount, localStride, localMap, int(values))
localMap (:size(map)) = map(:)
nf90_put_var_2D_FourByteInt = &
nf_put_varm_int(ncid, varid, localStart, localCount, localStride, localMap, int(values))
else if(present(stride)) then
nf90_put_var_2D_FourByteInt = &
nf_put_vars_int(ncid, varid, localStart, localCount, localStride, int(values))
nf90_put_var_2D_FourByteInt = &
nf_put_vars_int(ncid, varid, localStart, localCount, localStride, int(values))
else
nf90_put_var_2D_FourByteInt = &
nf_put_vara_int(ncid, varid, localStart, localCount, int(values))
print *, values(1, 1), values(1, 2), values(1, 3), values(1, 4)
nf90_put_var_2D_FourByteInt = &
nf_put_vara_int(ncid, varid, localStart, localCount, values)
end if
end function nf90_put_var_2D_FourByteInt

View File

@ -43,9 +43,6 @@ if USE_VALGRIND_TESTS
TESTS += run_valgrind_tests.sh
endif # USE_VALGRIND_TESTS
# These libraries need to be linked to our tests.
#LDADD = -lhdf5_hl -lhdf5 -lz -lm
# We must include these files in the distribution.
EXTRA_DIST = run_par_tests.sh run_valgrind_tests.sh \
ref_tst_h_compounds.h5 ref_tst_h_compounds2.h5 run_par_tests.sh \

View File

@ -22,6 +22,10 @@ nc_create_par(const char *path, int cmode, MPI_Comm comm,
NC_MPI_INFO data;
MPI_Comm comm_c = 0;
MPI_Info info_c = 0;
/* One of these two parallel IO modes must be chosen by the user. */
if (!(cmode & NC_MPIIO || cmode & NC_MPIPOSIX))
return NC_EINVAL;
#ifdef HAVE_MPI_COMM_F2C
comm_c = MPI_Comm_f2c(comm);
@ -47,6 +51,10 @@ nc_open_par(const char *path, int mode, MPI_Comm comm,
#else
NC_MPI_INFO mpi_data;
/* One of these two parallel IO modes must be chosen by the user. */
if (!(mode & NC_MPIIO || mode & NC_MPIPOSIX))
return NC_EINVAL;
mpi_data.comm = comm;
mpi_data.info = info;

View File

@ -9,7 +9,7 @@
include $(top_srcdir)/lib_flags.am
# Link to our assembled library.
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la # -lhdf5_hl -lhdf5 -lz
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
# These are netCDF-4 test programs.
NC4_TESTS = tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
@ -73,8 +73,8 @@ if USE_HDF4_FILE_TESTS
check_PROGRAMS += tst_interops3
TESTS += run_get_hdf4_files.sh tst_interops3
endif # USE_HDF4_FILE_TESTS
tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl \
-lhdf5 -lz
#tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl \
#-lhdf5 -lz
endif # USE_HDF4
# This will run a bunch of the test programs with valgrind, the memory
@ -123,18 +123,6 @@ MYD29.A2002185.0000.005.2007160150627.hdf \
MOD29.A2000055.0005.005.2006267200024.hdf
endif # HDF4_FILE_TESTS
# These linker flags will be applied to all test program compiles.
#LDADD = -lnetcdf
# if USE_HDF4
# LDADD += -lmfhdf -ldf -ljpeg
# endif # USE_HDF4
# LDADD += -lhdf5_hl -lhdf5 -lz -lm
# if USE_PNETCDF
# LDADD += -lpnetcdf
# endif

View File

@ -171,7 +171,7 @@ main(int argc, char **argv)
#endif /* USE_MPE */
/* Reopen the file and check it. */
if ((ret = nc_open_par(file_name, NC_NOWRITE, comm, info, &ncid)))
if ((ret = nc_open_par(file_name, NC_NOWRITE|NC_MPIIO, comm, info, &ncid)))
{
printf("ret = %d\n", ret);
ERR_RET;

View File

@ -54,6 +54,7 @@ program f90tst_parallel3
integer :: x, y, v
integer :: p, my_rank, ierr
integer :: start(MAX_DIMS), count(MAX_DIMS)
integer :: ret
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr)
@ -84,6 +85,12 @@ program f90tst_parallel3
end do
end do
! THis should fail, because I have not set either mpiposix or mpiio.
ret = nf90_create(FILE_NAME, nf90_netcdf4, ncid, &
comm = MPI_COMM_WORLD, info = MPI_INFO_NULL, cache_size = CACHE_SIZE, &
cache_nelems = CACHE_NELEMS, cache_preemption = CACHE_PREEMPTION)
if (ret /= nf90_einval) stop 8
! Create the netCDF file.
call check(nf90_create(FILE_NAME, IOR(nf90_netcdf4, nf90_mpiposix), ncid, &
comm = MPI_COMM_WORLD, info = MPI_INFO_NULL, cache_size = CACHE_SIZE, &

View File

@ -12,7 +12,6 @@ program f90tst_vars4
! This is the name of the data file we will create.
character (len = *), parameter :: FILE_NAME = "f90tst_vars4.nc"
! We are writing 2D data, a 6 x 12 grid.
integer, parameter :: MAX_DIMS = 2
integer, parameter :: NX = 40, NY = 4096
integer :: data_out(NY, NX), data_in(NY, NX)

View File

@ -101,6 +101,9 @@
if (retval .ne. nf_noerr) stop 9
! Reopen the file.
retval = nf_open_par(FILE_NAME, nf_nowrite,
$ MPI_COMM_WORLD, MPI_INFO_NULL, ncid)
if (retval .ne. nf_einval) stop 7
retval = nf_open_par(FILE_NAME, IOR(nf_nowrite, nf_mpiio),
$ MPI_COMM_WORLD, MPI_INFO_NULL, ncid)
if (retval .ne. nf_noerr) stop 10

View File

@ -3,7 +3,7 @@
# This shell runs some parallel I/O tests for the F90 API.
set -e
echo "Testing netCDF parallel I/O through the F90 API..."
echo "Testing netCDF parallel I/O through the F90 API."
mpiexec -n 4 ./f90tst_parallel
mpiexec -n 4 ./f90tst_parallel2
mpiexec -n 4 ./f90tst_parallel3