[pnetcdf] 01/06: new upstream 1.8.1
Alastair McKinstry
mckinstry at moszumanska.debian.org
Thu Apr 20 14:12:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository pnetcdf.
commit ec3ca6842de66de6356287ece5a40700b79485d7
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Thu Apr 20 13:58:35 2017 +0100
new upstream 1.8.1
---
INSTALL | 47 +-
Makefile.in | 15 +-
README.Fujitsu | 62 +
README.INTEL | 23 +
README.K-Computer | 67 +
README.consistency | 76 +
RELEASE_NOTES | 226 +-
aclocal.m4 | 20 +-
benchmarks/C/Makefile.in | 17 +-
benchmarks/C/aggregation.c | 93 +-
benchmarks/C/write_block_read_column.c | 63 +-
benchmarks/FLASH-IO/Makefile.in | 9 +-
benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.F90 | 15 +-
benchmarks/FLASH-IO/flash_benchmark_io.F90 | 34 +-
check_install.in | 91 +
configure | 110 +-
configure.in | 48 +-
examples/C/Makefile.in | 17 +-
examples/C/block_cyclic.c | 10 +-
examples/C/bput_varn_int64.c | 12 +-
examples/C/bput_varn_uint.c | 16 +-
examples/C/collective_write.c | 21 +-
examples/C/column_wise.c | 9 +-
examples/C/create_open.c | 9 +-
examples/C/fill_mode.c | 9 +-
examples/C/flexible_api.c | 10 +-
examples/C/get_info.c | 9 +-
examples/C/get_vara.c | 9 +-
examples/C/ghost_cell.c | 17 +-
examples/C/global_attributes.c | 11 +-
examples/C/hints.c | 16 +-
examples/C/i_varn_int64.c | 12 +-
examples/C/mput.c | 10 +-
examples/C/nonblocking_write.c | 18 +-
examples/C/nonblocking_write_in_def.c | 16 +-
examples/C/put_vara.c | 9 +-
examples/C/put_varn_float.c | 12 +-
examples/C/put_varn_int.c | 10 +-
examples/C/req_all.c | 7 +-
examples/C/transpose.c | 19 +-
examples/C/vard_int.c | 8 +-
examples/CXX/Makefile.in | 17 +-
examples/CXX/block_cyclic.cpp | 8 +-
examples/CXX/collective_write.cpp | 21 +-
examples/CXX/column_wise.cpp | 8 +-
examples/CXX/fill_mode.cpp | 10 +-
examples/CXX/flexible_api.cpp | 8 +-
examples/CXX/get_info.cpp | 8 +-
examples/CXX/get_vara.cpp | 8 +-
examples/CXX/hints.cpp | 14 +-
examples/CXX/nonblocking_write.cpp | 17 +-
examples/CXX/put_vara.cpp | 10 +-
examples/CXX/put_varn_float.cpp | 8 +-
examples/CXX/put_varn_int.cpp | 8 +-
examples/CXX/transpose.cpp | 12 +-
examples/CXX/vard_int.cpp | 8 +-
examples/F77/Makefile.in | 17 +-
examples/F90/Makefile.in | 17 +-
examples/tutorial/Makefile.in | 9 +-
examples/tutorial/pnetcdf-read-from-master.c | 50 +-
examples/tutorial/pnetcdf-write-from-master.c | 22 +-
examples/tutorial/pnetcdf-write-nb.c | 12 +-
macros.make.in | 18 +-
pnetcdf-config.in | 21 +-
rules.make | 8 +-
scripts/utils.m4 | 9 +-
src/Makefile.in | 26 +-
src/lib/Makefile.in | 8 +-
src/lib/attr.m4 | 126 +-
src/lib/bput.m4 | 59 +-
src/lib/depend | 2 +-
src/lib/dim.c | 14 +-
src/lib/error.c | 6 +-
src/lib/fill.c | 10 +-
src/lib/getput.m4 | 58 +-
src/lib/header.c | 140 +-
src/lib/i_getput.m4 | 8 +-
src/lib/i_varn.m4 | 71 +-
src/lib/m_getput_varx.m4 | 4 +-
src/lib/malloc.c | 16 +-
src/lib/mpincio.c | 14 +-
src/lib/mpinetcdf.c | 188 +-
src/lib/nc.c | 36 +-
src/lib/nc.h | 41 +-
src/lib/ncmpidtype.c | 3 +-
src/lib/nonblocking.c | 19 +-
src/lib/pnetcdf.h.in | 6225 +++++++++++---------
src/lib/subfile.c | 5 +-
src/lib/util.c | 193 +-
src/lib/var.c | 30 +-
src/lib/vard.c | 56 +-
src/lib/varn.m4 | 102 +-
src/libcxx/Makefile.in | 10 +-
src/libcxx/ncmpiFile.cpp | 5 +
src/libcxx/ncmpiFile.h | 2 +
src/libf/Makefile.in | 353 +-
src/libf/buildiface | 140 +-
src/libf/defs | 60 +-
src/libf/pnetcdf.inc.in | 10 +-
src/libf/strerrnof.f | 3 +
src/libf90/Makefile.in | 12 +-
src/libf90/api.f90.in | 8 +-
src/libf90/dims.f90 | 3 +-
src/libf90/file.f90 | 23 +-
src/libf90/visibility.f90 | 7 +-
src/utils/ncmpidiff/Makefile.in | 3 +-
src/utils/ncmpidiff/ncmpidiff.1 | 15 +-
src/utils/ncmpidiff/ncmpidiff.c | 27 +-
src/utils/ncmpidump/Makefile.in | 3 +-
src/utils/ncmpidump/dumplib.c | 5 +-
src/utils/ncmpidump/ncmpidump.c | 10 +-
src/utils/ncmpigen/Makefile.in | 3 +-
src/utils/ncmpivalid/Makefile.in | 3 +-
src/utils/ncmpivalid/ncmpivalid.c | 7 +-
src/utils/ncoffsets/ncoffsets.1 | 4 +-
src/utils/ncoffsets/ncoffsets.c | 15 +-
src/utils/pnetcdf_version/Makefile.in | 3 +-
src/utils/pnetcdf_version/pnetcdf_version.1 | 3 +-
test/C/pres_temp_4D_rd.c | 12 +-
test/C/pres_temp_4D_wr.c | 12 +-
test/CXX/nctst.cpp | 43 +-
test/CXX/test_classic.cpp | 10 +-
test/cdf_format/cdf_type.c | 15 +-
test/cdf_format/dim_cdf12.c | 12 +-
test/cdf_format/test_inq_format.c | 15 +-
test/common/testutils.c | 34 +-
test/common/testutils.h | 12 +-
test/fandc/csnap.c | 9 +-
test/header/header_consistency.c | 8 +-
test/largefile/large_var.c | 12 +-
test/nc_test/nc_test.c | 10 +-
test/nc_test/t_nc.c | 12 +-
test/nc_test/test_get.m4 | 116 +-
test/nc_test/test_put.m4 | 104 +-
test/nc_test/test_read.m4 | 26 +-
test/nc_test/test_write.m4 | 36 +-
test/nc_test/tests.h.m4 | 9 +-
test/nc_test/tst_atts.c | 12 +-
test/nc_test/tst_atts3.c | 44 +-
test/nc_test/tst_misc.c | 20 +-
test/nc_test/tst_names.c | 40 +-
test/nc_test/tst_nofill.c | 12 +-
test/nc_test/tst_norm.c | 16 +-
test/nc_test/tst_small.c | 45 +-
test/nc_test/util.c | 41 +-
test/nf90_test/test_get.m4 | 189 +-
test/nf90_test/test_iget.m4 | 172 +-
test/nf90_test/test_iput.m4 | 224 +-
test/nf90_test/test_put.m4 | 303 +-
test/nf_test/Makefile.in | 10 +-
test/nf_test/test_get.m4 | 194 +-
test/nf_test/test_iget.m4 | 177 +-
test/nf_test/test_iput.m4 | 241 +-
test/nf_test/test_put.m4 | 288 +-
test/nonblocking/Makefile.in | 26 +-
.../nonblocking/{bput_varn_uint.c => bput_varn.m4} | 397 +-
test/nonblocking/{column_wise.c => column_wise.m4} | 197 +-
test/nonblocking/depend | 2 +-
test/nonblocking/flexible_bput.c | 12 +-
test/nonblocking/i_varn_indef.c | 19 +-
test/nonblocking/i_varn_int64.c | 35 +-
test/nonblocking/interleaved.c | 12 +-
test/nonblocking/mcoll_perf.c | 22 +-
test/nonblocking/req_all.c | 12 +-
test/nonblocking/test_bput.c | 21 +-
test/nonblocking/wait_after_indep.c | 20 +-
test/subfile/test_subfile.c | 40 +-
test/testcases/Makefile.in | 6 +-
test/testcases/add_var.c | 12 +-
test/testcases/alignment_test.c | 13 +-
test/testcases/attrf.f | 4 +-
test/testcases/buftype_free.c | 12 +-
test/testcases/buftype_freef.f | 4 +-
test/testcases/check_striping.c | 19 +-
test/testcases/check_type.c | 12 +-
test/testcases/collective_error.c | 145 +-
test/testcases/erange_fill.m4 | 12 +-
test/testcases/flexible.c | 12 +-
test/testcases/flexible2.c | 12 +-
test/testcases/flexible_varm.c | 12 +-
test/testcases/inq_num_vars.c | 13 +-
test/testcases/inq_num_varsf.f90 | 4 +-
test/testcases/inq_recsize.c | 13 +-
test/testcases/inq_recsizef.f90 | 4 +-
test/testcases/ivarn.c | 18 +-
test/testcases/last_large_var.c | 12 +-
test/testcases/modes.c | 77 +-
test/testcases/ncmpi_vars_null_stride.c | 13 +-
test/testcases/noclobber.c | 12 +-
test/testcases/nonblocking.c | 12 +-
test/testcases/one_record.c | 14 +-
test/testcases/put_parameter.f | 4 +-
test/testcases/record.c | 31 +-
test/testcases/redef1.c | 19 +-
test/testcases/scalar.c | 20 +-
test/testcases/test_erange.c | 126 +-
test/testcases/test_vard.c | 15 +-
test/testcases/test_vardf.F | 4 +-
test/testcases/test_vardf90.f90 | 4 +-
test/testcases/test_varm.c | 20 +-
test/testcases/varn_contig.c | 18 +-
test/testcases/varn_int.c | 18 +-
test/testcases/varn_intf.f | 4 +-
test/testcases/varn_real.f90 | 4 +-
test/testcases/vectors.c | 22 +-
205 files changed, 7973 insertions(+), 6010 deletions(-)
diff --git a/INSTALL b/INSTALL
index d0eadef..1d045a7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -121,20 +121,57 @@ Here lists a few important options:
--enable-debug Enable PnetCDF internal debug mode. This also
enables safe mode. [default: disabled]
--disable-in-place-swap Disable memory in-place byte swap on Little Endian
- machines. [default: enabled]. See note below.
+ machines. [default: enabled]
--enable-coverage Compile with coverage support (gcc-based only).
[default: disabled]
- --disable-subfiling Turns off subfiling support. [default: disabled]
+ --enable-subfiling Enable subfiling support. [default: disabled]
+ --disable-erange-fill Disable use of fill value when out-of-range type
+ conversion causes NC_ERANGE error. [default:
+ enabled]
+ --enable-relax-coord-bound
+ Enable relaxed error NC_EINVALCOORDS to allow
+ coordinate start argument equal to dimension size
+ when argument count is zero. [default: disabled]
--disable-file-sync Disable MPI file sync if you know your file system
can provide data consistency. [default: enabled]
--enable-large-file-test
Enable testing for large (>4GB) file/variable I/O.
- This can run very slow. [default: disabled]
+ Note "make testing" can run very slow. [default:
+ disabled]
-Optional Packages:
--with-mpi=/path/to/implementation
installation prefix for MPI implementation
+Some influential environment variables:
+ RM Command for deleting files or directories. default: rm
+ MPICC MPI C compiler
+ MPICXX MPI C++ compiler
+ MPIF77 MPI Fortran 77 compiler
+ MPIF90 MPI Fortran 90 compiler
+ CC Overwritten by MPICC if MPICC is set
+ CXX Overwritten by MPICXX if MPICXX is set
+ F77 Overwritten by MPIF77 if MPIF77 is set
+ FC Overwritten by MPIF90 if MPIF90 is set
+ CFLAGS Debugging and optimization options for the C compiler
+ CPPFLAGS Preprocessor options for C and C++ compilers, e.g. -I<include
+ dir> if you have headers in a nonstandard directory <include dir>
+ CXXFLAGS Debugging and optimization options for the C compiler
+ FFLAGS Debugging and optimization options for the Fortran 77 compiler
+ FCFLAGS Debugging and optimization options for the Fortran 90 compiler
+ FPPFLAGS Preprocessor options for Fortran compilers, e.g. -I<include dir>
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPP C preprocessor
+ TEST_SEQRUN Run command (on one process) for make target check on
+ cross-compile environment. Example: "aprun -n 1". [default:
+ none]
+ TEST_MPIRUN MPI run command for make target ptest, [default: mpiexec -n NP]
+ TEST_OUTDIR Output file directory for make target ptest, [default: ./]
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
PnetCDF can automatically detect the available MPI compilers and compile flags.
If alternate compilers or flags are desired, they can be specified by the
following environment variables and/or configure options.
@@ -151,7 +188,7 @@ Some influential environment variables:
Note the compile flags, such as -O2 or -g, should be given in CFLAGS and
other flag environment variables. Please do not set them in compiler
- variable. For instance, setting MPICC="mpcc -O2" may result in the error
+ variable. For instance, setting MPICC="mpicc -O2" may result in the error
of compiler not found.
- For platform-specific build instructions, see one of the README.<ARCH>
diff --git a/Makefile.in b/Makefile.in
index b910ece..7730d8c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2615 2016-11-13 23:58:41Z wkliao $
+# $Id: Makefile.in 2743 2016-12-28 16:23:27Z wkliao $
#
# @configure_input@
@@ -36,7 +36,8 @@ DIST_GARBAGE = config.cache \
macros.make \
stamp-h \
pnetcdf.pc \
- pnetcdf-config
+ pnetcdf-config \
+ check_install
PACKING_LIST = Makefile.in \
aclocal.m4 \
@@ -49,17 +50,22 @@ PACKING_LIST = Makefile.in \
INSTALL \
README \
README.CRAY \
+ README.Fujitsu \
+ README.INTEL \
README.IBM \
+ README.K-Computer \
README.LINUX \
README.SGI \
README.SX \
+ README.consistency \
README.large_files \
RELEASE_NOTES \
pbs.script \
cobalt.script \
stamp-h.in \
pnetcdf_pc.in \
- pnetcdf-config.in
+ pnetcdf-config.in \
+ check_install.in
PACKING_SUBDIRS = $(SUBDIRS)
@@ -125,7 +131,7 @@ install: $(INSTALLDIRS) install_PKGCONFIG install_CONFIG
@echo '| PnetCDF is jointly developed by a team at Northwestern University and'
@echo '| Argonne National Laboratory.'
@echo '|'
- @echo '| Vist PnetCDF web sites for more information'
+ @echo '| Visit PnetCDF web sites for more information'
@echo '| http://cucis.ece.northwestern.edu/projects/PnetCDF'
@echo '| http://trac.mcs.anl.gov/projects/parallel-netcdf'
@echo '|'
@@ -138,6 +144,7 @@ PKGCONFIG_IN = pnetcdf_pc
PKGCONFIG = pnetcdf.pc
install_PKGCONFIG:
+ $(RM) -f $(PKGCONFIG)
$(SED) -e "s%INSTALL_PREFIX%${prefix}%g" $(PKGCONFIG_IN) > $(PKGCONFIG)
$(INSTALL) -d -m 755 $(LIBDIR)/pkgconfig
$(INSTALL_DATA) $(PKGCONFIG) $(LIBDIR)/pkgconfig/$(PKGCONFIG)
diff --git a/README.Fujitsu b/README.Fujitsu
new file mode 100644
index 0000000..63ef46f
--- /dev/null
+++ b/README.Fujitsu
@@ -0,0 +1,62 @@
+# $Id: README.Fujitsu 2713 2016-12-16 20:32:36Z wkliao $
+
+This file is for users who will edit file "configure.in" and run command
+"autoreconf" to regenerate file "configure".
+
+Autoconf 2.69 has a problem of checking the version of the Fujitsu Fortran
+compiler, which causes errors for building PnetCDF at the configure time.
+
+The fix and patch have been discussed and provided in the link below. PnetCDF
+users/developers are encouraged to apply to patch to their autoconf utility.
+
+Subject: Support Fujitsu in _AC_PROG_FC_V
+https://lists.gnu.org/archive/html/autoconf-patches/2013-11/msg00001.html
+
+----------------------------------------------------------------------
+Once the patch is applied and autoconf rebuilt, PnetCDF can be built with
+one of the following configure commands.
+
+ # for non-cross-compiling
+ ./configure --prefix=/path/to/install \
+ --with-mpi=/path/to/MPI/installation
+
+or
+ # for cross-compiling
+ ./configure --prefix=/path/to/install \
+ --with-mpi=/path/to/MPI/installation
+ cross_compiling="yes"
+
+or
+ # for cross-compiling and wth explicit MPI compiler names
+ ./configure --prefix=/path/to/install \
+ cross_compiling="yes" \
+ MPICC=/path/to/MPI/installation/mpifccpx \
+ MPICXX=/path/to/MPI/installation/mpiFCCpx \
+ MPIF77=/path/to/MPI/installation/mpifrtpx \
+ MPIF90=/path/to/MPI/installation/mpifrtpx
+
+or
+ # for cross-compiling and wth explicit MPI compiler names
+ # and optimization flags
+ ./configure --prefix=/path/to/install \
+ --host=sparc64-unknown-linux-gnu \
+ --build=x86_64-redhat-linux \
+ MPICC=mpifccpx \
+ MPICXX=mpiFCCpx \
+ MPIF77=mpifrtpx \
+ MPIF90=mpifrtpx \
+ CFLAGS="-Kfast" \
+ CXXFLAGS="-Kfast" \
+ FFLAGS="-Kfast" \
+ FCFLAGS="-Kfast" \
+ TEST_MPIRUN="mpiexec -n NP" \
+ TEST_SEQRUN="mpiexec -n 1"
+
+
+----------------------------------
+If the above patch is not (or unable to) applied to the autoconf utility,
+please add LDFLAGS="-L." to the command line when running configure. This is
+necessary to prevent the failure of building PnetCDF Fortran interfaces, due to
+Fujitsu Fortran compiler requires no "-L" for linking internal libraries.
+Adding "-L." to force the linker to use this flag.
+
diff --git a/README.INTEL b/README.INTEL
new file mode 100644
index 0000000..2f00d9a
--- /dev/null
+++ b/README.INTEL
@@ -0,0 +1,23 @@
+When using old versions of Intel MPI compilers (4.x), you might get the
+following error message.
+In file included from /opt/intel/impi/4.1.3/include/mpi.h(1279),
+ from ../lib/pnetcdf.h(10),
+ from ../../../trunk/src/libcxx/ncmpiType.h(2),
+ from ../../../trunk/src/libcxx/ncmpiType.cpp(2):
+/opt/intel/impi/4.1.3/include/mpicxx.h(95): error: #error directive: "SEEK_SET is
+#defined but must not be for the C++ binding of MPI. Include mpi.h before stdio.h"
+#error "SEEK_SET is #defined but must not be for the C++ binding of MPI. Include mpi.h before stdio.h"
+ ^
+
+A solution is to add the following C++ preprocessor flags at the configure
+command line, for example.
+./configure CXXCPPFLAGS="-DMPICH_IGNORE_CXX_SEEK -DMPICH_SKIP_MPICXX"
+
+
+Note that this error has been resolved when using newer Intel MPI
+compiler (5.x). See the two URLs below for more information.
+
+https://software.intel.com/en-us/articles/intel-cluster-toolkit-for-linux-error-when-compiling-c-aps-using-intel-mpi-library-compilation-driver-mpiicpc
+
+https://wiki.mpich.org/mpich/index.php/Frequently_Asked_Questions#Q:_I_get_compile_errors_saying_.22SEEK_SET_is_.23defined_but_must_not_be_for_the_C.2B.2B_binding_of_MPI.22
+
diff --git a/README.K-Computer b/README.K-Computer
new file mode 100644
index 0000000..09597d9
--- /dev/null
+++ b/README.K-Computer
@@ -0,0 +1,67 @@
+# $Id: README.K-Computer 2210 2015-11-29 02:06:41Z wkliao $
+
+===============================================================================
+ The K computer
+===============================================================================
+
+This file contains information of building PnetCDF on the K computer at the
+RIKEN Advanced Institute for Computational Science in Kobe, Japan.
+http://www.aics.riken.jp/en/k-computer/about/
+
+The MPI compilers on the K computer are wrappers of Fujitsu compilers:
+ Language MPI compiler Sequential compiler
+ ----------- -------------- --------------------
+ Fortran mpifrtpx (frtpx)
+ C mpifccpx (fccpx)
+ C++ mpiFCCpx (FCCpx)
+
+
+The K computer is a cross-compile system. Be sure to run configure with the
+--build and --host flags to put it in "cross compile mode". This will make
+configure use compile-only tests, instead of the usual compile-and-run tests
+(running tests on the K computer login node will not work.) Below shows a
+configure command that was used to build PnetCDF successfully on K.
+
+./configure --prefix=/path/to/install \
+ --host=sparc64-unknown-linux-gnu \
+ --build=x86_64-redhat-linux \
+ MPICC=mpifccpx \
+ MPICXX=mpiFCCpx \
+ MPIF77=mpifrtpx \
+ MPIF90=mpifrtpx \
+ CFLAGS="-Kfast" \
+ CXXFLAGS="-Kfast" \
+ FFLAGS="-Kfast" \
+ FCFLAGS="-Kfast" \
+ TEST_MPIRUN="mpiexec -n NP" \
+ TEST_SEQRUN="mpiexec -n 1"
+
+For users who would customize the source codes and edit configure.in, it is
+necessary to run command "autoreconf" to generate an updated "configure" file.
+However, there is a bug in autoconf 2.69 that causes building the PnetCDF
+Fortran interfaces to fail. Please read file README.Fujitsu for the bug patch
+to autoconf 2.69. If this bug fix is not applied to (or unable to due to
+permission issue) the autoconf utility, please add LDFLAGS="-L." to the
+configure command line. Adding LDFLAGS="-L." is necessary as the Fujitsu
+Fortran compiler requires no "-L" for its internal library files. Without
+this, configure command may fail.
+
+----------------
+Testing PnetCDF:
+----------------
+
+One way to run "make check" or "make ptest" on K's compute nodes is through an
+interactive job. An example command to submit an interactive job requesting
+4 nodes for 20 minutes is shown below.
+
+ pjsub --interact --rsc-list "node=4" --rsc-list "elapse=00:20:00" \
+ --sparam "wait-time=3600"
+
+Once in the interactive mode, run command
+ source /work/system/Env_base
+ make -s check
+ make -s ptest
+
+To exit the interactive mode, run command
+ exit
+
diff --git a/README.consistency b/README.consistency
new file mode 100644
index 0000000..879c8cc
--- /dev/null
+++ b/README.consistency
@@ -0,0 +1,76 @@
+---------------------------------------------
+Note on parallel I/O data consistency
+---------------------------------------------
+PnetCDF follows the same parallel I/O data consistency as MPI-IO standard.
+Refer the URL below for more information.
+http://www.mpi-forum.org/docs/mpi-2.2/mpi22-report/node296.htm#Node296
+
+Readers are also referred to the following paper.
+Rajeev Thakur, William Gropp, and Ewing Lusk, On Implementing MPI-IO Portably
+and with High Performance, in the Proceedings of the 6th Workshop on I/O in
+Parallel and Distributed Systems, pp. 23-32, May 1999.
+
+If users would like PnetCDF to enforce a stronger consistency, they should add
+NC_SHARE flag when open/create the file. By doing so, PnetCDF adds
+MPI_File_sync() after each MPI I/O calls.
+ * For PnetCDF collective APIs, an MPI_Barrier() will also be called right
+ after MPI_File_sync().
+ * For independent APIs, there is no need for calling MPI_Barrier().
+Users are warned that the I/O performance when using NC_SHARE flag could become
+significantly slower than not using it.
+
+If NC_SHARE is not set, then users are responsible for their desired data
+consistency. To enforce a stronger consistency, users can explicitly call
+ncmpi_sync(). In ncmpi_sync(), MPI_File_sync() and MPI_Barrier() are called.
+
+---------------------------------------------
+Note on header consistency in memory and file
+---------------------------------------------
+In data mode, changes to file header can happen in the following scenarios.
+ 1. Renaming variables, dimensions, or attributes, when users make calls to
+ ncmpi_rename_var(), ncmpi_rename_dim(), or ncmpi_rename_att().
+ 2. Overwriting an existing attribute with equal or smaller length, when users
+ make calls to ncmpi_put_att() and its family APIs.
+ 3. New records are created from put APIs.
+
+For cases 1 and 2, PnetCDF requires those APIs that change names or attributes
+be called collectively. Internally, PnetCDF calls ncmpii_write_header() to
+write (overwrite) the file header before these APIs return. Therefore, the file
+header in memory is sync-ed and updated in file. Note starting from version
+1.4.0, these APIs if called in data mode (independent or collective), they must
+be called collectively by all processes that open the file.
+
+For case 3, change to the number of records (numrecs) can happen in collective
+or independent data mode by put APIs.
+ * When in collective mode, PnetCDF sync numrecs in memory among all processes
+ followed by letting root write the new value to the file. This applies to
+ all collective blocking APIs and nonblocking ncmpi_wait_all().
+
+ * When in independent mode, PnetCDF updates numrecs in local memory and sets
+ the dirty bit NC_NDIRTY to the file flag locally. Sync in memory and update
+ to file will wait until a collective call to:
+ + ncmpi_end_indepi_data()
+ + ncmpi_sync_numrecs()
+ + ncmpi_sync()
+ + ncmpi_abort()
+ + ncmpi_redef()
+ + ncmpi_close()
+
+Some facts in PnetCDF implementation:
+1. The only part of file header that can be out-of-sync is numrecs. The
+ out-of-sync numrecs can only be caused by independent APIs.
+
+2. In collective data mode, header (including numrecs) is always sync-ed in
+ memory and updated in file before the collective API returns.
+
+3. Renaming is allowed in data mode. When called in data mode, they must be
+ called by all processes. The file header will be updated before the API
+ returns.
+
+4. ncmpi_put_att() and its family are allowed in data mode. When called in data
+ mode, they must be called by all processes. The file header will be updated
+ before the API returns.
+
+5. rename() and put_att() are not allowed to be called independently in data
+ mode.
+
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index d45c769..b6374a8 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -2,10 +2,216 @@ Parallel NetCDF Release Notes:
=====================================
-------------------------------------
-version 1.8.0.pre1 (November 15, 2016)
+version 1.8.1 (January 28, 2017)
-------------------------------------
- o The full list of updates can be found in
- http://trac.mcs.anl.gov/projects/parallel-netcdf/browser/tags/v1-8-0pre1/sneak_peek
+
+ This release is mainly for fixing the following bug.
+
+ o Bug fixes:
+ * Fortran parameters NF_MAX_DIMS, NF_MAX_ATTRS, NF_MAX_VARS, and NF_MAX_NAME
+ defined in the Fortran header file, pnetcdf.inc, were set to obsolete
+ values and have been fixed in this release to conform with their
+ corresponding C constants. Because these four parameters were not used
+ by PnetCDF internally, the end users can safely skip this release and
+ 1.8.1 should perform the same as 1.8.0. If your programs explicitly use
+ these four parameters, then updating to 1.8.1 is recommended.
+
+ o Other updates:
+ * To conform with GNU Coding Standards, the installation location for man
+ pages are changed to ${prefix}/share/man.
+ * Support of DESTDIR for Building Binary Packages has been added, as
+ suggested by sunpoet at FreeBSD.org. Ticket #25
+
+-------------------------------------
+version 1.8.0 (December 19, 2016)
+-------------------------------------
+
+ o New features
+ * Copy fill values to data elements that cause out-of-bound error (i.e.
+ NC_ERANGE.) In netCDF v4.4.1 and priors, type conversion for out-of-
+ bound elements proceeds even if the out-of-bound error is detected, and
+ the contents (in both files and read buffers) are left up to the user
+ to handle. See the URL below for details.
+ http://www.unidata.ucar.edu/software/netcdf/docs/group__error.html
+ Instead of carrying out the type conversion, PnetCDF fills the out-of-
+ bound data elements with their "fill values", as specified by the
+ variable's attribute "_FillValue" or default CDF fill values if the
+ attribute is not defined. Specifically, for PnetCDF put APIs, the value
+ of attribute _FillValue, if defined, will be used when writing to files.
+ For get APIs, the default CDF _FillValue corresponding to the internal
+ data type will be used to fill the read buffer. This feature can be
+ disabled by adding option "--disable-erange-fill" to the configure
+ command line. In this case, the conventional NetCDF method described
+ above is used.
+ * A new configure option --enable-relax-coord-bound is added to provide a
+ more relaxed boundary check for argument start. Traditionally, both
+ NetCDF and PnetCDF detect the error code NC_EINVALCOORDS when the value
+ of start is larger than or equal to the defined dimension size. This can
+ be inconvenient for some applications that make a zero-length request
+ with start being the dimension size, usually the last process. The new
+ configure option relaxes the boundary check by allowing the above
+ exception, i.e. start[i] can be the size of dimension i only when
+ count[i] is zero. The default of this feature is disabled. For more
+ detailed information, see discussion in:
+ http://lists.mcs.anl.gov/pipermail/parallel-netcdf/2016-March/001839.html
+ * New macros have been added to PnetCDF header file, pnetcdf.h, to indicate
+ the configurable options that were enabled/disabled. These macros are
+ PNETCDF_ERANGE_FILL, PNETCDF_SUBFILING, PNETCDF_RELAX_COORD_BOUND, and
+ PNETCDF_DEBUG_MODE. Their values are set to 1 when enabled, 0 otherwise.
+ * API ncmpi_inq_file_format can now detect HDF5 file signature and report
+ NC_FORMAT_NETCDF4.
+ * Enable ncmpidump to check whether input file is in HDF5 format when -k
+ option is used at the command line.
+ * In ncmpi_open, add a checking for HDF5 file signature and return error
+ code NC_ENOTNC3 if detected.
+
+ o New APIs
+ * ncmpi_strerrno, nfmpi_strerrno, nf90mpi_strerrno return the string name
+ of a NC error code.
+ * ncmpi_inq_path, nfmpi_inq_path, nf90mpi_inq_path for inquiring the file
+ pathname which was used to open/create the CDF file.
+
+ o New optimization
+ * Use Bernstein hash function for checking whether the name of a variable
+ or dimension has already been used.
+ * Replace the use of linked lists with arrays for storing the pending
+ nonblocking requests. This could save time for traversing the linked
+ list.
+
+ o Syntax changes
+ * ncmpi_cancel can now be called in define mode.
+
+ o Semantics updates
+ * For collective APIs, the following errors are considered fatal:
+ NC_EBADID, NC_EPERM, NC_EINDEFINE, NC_EINDEP, and NC_ENOTINDEP. Once
+ detects these errors the calling APIs return immediately. If the fatal
+ errors happen only to a subset of processes, the running program may
+ hang, due to other processes being waiting at an MPI collective call.
+ (Note hanging will never occur to independent APIs.) To debug a hanging
+ problem, users can run the program in safe mode by setting the
+ environment variable PNETCDF_SAFE_MODE to 1. In safe mode, error codes
+ are synchronized among all processes. Error codes other than the above,
+ if detected, are not as fatal. The processes encountering the non-fatal
+ errors will continue to the collective call but with zero-length
+ requests. Thus, the collective calls can nicely complete without hanging.
+ * Consistency check for header data (defining dimensions, variables, and
+ attributes) is moved to individual APIs and only enabled when safe mode
+ is enabled. Header data consistency check is no longer performed in
+ ncmpi_enddef. As a reminder, PnetCDF APIs that change header data are
+ all collective and their arguments are required to be consistent among
+ the calling processes.
+ * In netCDF-3, whether the contents of an NC_BYTE variable in CDF-1 or
+ CDF-2 files are signed or unsigned is determined by the calling APIs. See
+ http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
+ "In netcdf-3, we treat NC_BYTE as signed for the purposes of conversion
+ to short, int, long, float, or double. (Of course, no conversion takes
+ place when the internal type is signed char.) In the _uchar functions, we
+ treat NC_BYTE as if it were unsigned. Thus, no NC_ERANGE error can occur
+ converting between NC_BYTE and unsigned char." In other words, if called
+ from signed APIs, NC_BYTE variables are treated as signed. If called from
+ unsigned APIs (i.e. _uchar APIs, the only unsigned APIs in netCDF-3) they
+ are unsigned. NetCDF-3 specifically makes an exception to skip NC_ERANGE
+ check when calling _uchar APIs on NC_BYTE variables. However, in netCDF-4
+ and CDF-5, because of the introduction of the new data type NC_UBYTE, an
+ unsigned 8-bit integer, which makes NC_BYTE an signed 8-bit integer and
+ thus renders the above exception less sense. Starting from this release,
+ for CDF-5 files, regular NC_ERANGE check is performed in PnetCDF for all
+ APIs that access NC_BYTE variables. For CDF-1 and 2 files, PnetCDF still
+ honors that exception.
+ * Prior to version 1.7.0, any outstanding nonblocking requests detected at
+ file close are automatically cancelled without reporting an error.
+ Starting from this 1.8.0 release, error code NC_EPENDING will be returned
+ when pending requests are detected at the file close.
+ * API ncmpi_set_default_format is changed to an independent API. However,
+ it is expected to be called by all processes that intend to create a file
+ later. Inconsistency in default format setting will be detected at file
+ create time.
+
+ o New utility program
+ * Added pnetcdf-config shell script to display the options used in building
+ PnetCDF.
+
+ o New error code precedence
+ * When two or more errors are detected by the PnetCDF library (e.g. due to
+ the use of more than one bad API argument), the error code returned from
+ an API will follow the precedence below. In principle, the errors related
+ to ncid is the most serious, followed by varid.
+ For put attribute APIs:
+ NC_EBADID, NC_EPERM, NC_ENOTVAR, NC_EBADNAME, NC_EBADTYPE, NC_ECHAR,
+ NC_EINVAL, NC_ENOTINDEFINE, NC_ERANGE
+ For get attribute APIs:
+ NC_EBADID, NC_ENOTVAR, NC_EBADNAME, NC_ENOTATT, NC_ECHAR, NC_EINVAL,
+ NC_ERANGE
+ For put/get variable APIs:
+ NC_EBADID, NC_EPERM, NC_EINDEFINE, NC_ENOTVAR, NC_ECHAR,
+ NC_EINVALCOORDS, NC_EEDGE, NC_ESTRIDE, NC_EINVAL, NC_ERANGE
+
+ o New error code
+ * NC_EPENDING: Pending nonblocking request is found at file close.
+ * NC_EINVAL_OMODE: invalid file open mode. This separates the case from the
+ file create API which uses NC_EINVAL_CMODE mode. The error messages for
+ both error codes are revised accordingly.
+ * NC_EMULTIDEFINE_CMODE: inconsistent file create mode. This separates the
+ case from NC_EMULTIDEFINE_OMODE. The error messages for both error codes
+ are revised accordingly.
+ * The Fortran error codes corresponding to the above are also added.
+
+ o New test program
+ * test/testcases/scalar.c to test whether arguments start, count, stride,
+ and imap are properly ignored when getting/putting a scalar variable
+ * test/testcases/erange_fill.m4 to test the new configure-time feature of
+ --enable-erange-fill
+
+ o Other updates:
+ * Check file open/create mode for NC_DISKLESS and NC_MMAP and return error
+ code NC_EINVAL_OMODE/NC_EINVAL_CMODE if either of these two modes is
+ used. These modes are currently not supported.
+ * Clarify support for CDF-2 and CDF-5 formats. When the size of MPI_Offset
+ is less than 8 bytes, support for CDF-2 and CDF-5 is disabled.
+ * When using OpenMPI 2.0.1 to build PnetCDF, users may encounter an error
+ message of "test_write.c: file ./scratch.nc should not exist" or "FAILURE
+ at line 429 of test_ncmpi_abort in test_write.c: expecting NC_ENOENT or
+ NC_EFILE but got NC_NOERR" while running "make check". The cause is due
+ to a bug in OpenMPI 2.0.1 that fails to return the correct MPI error
+ class MPI_ERR_NO_SUCH_FILE when deleting a non-existing file. The bug fix
+ will appear in OpenMPI 2.0.2. See the OpenMPI bug report in
+ https://github.com/open-mpi/ompi/issues/2232
+ * When using OpenMPI 1.10.2 and 1.8.5 to build PnetCDF, users may encounter
+ an error message of "An error occurred in MPI_Type_create_hindexed" when
+ running "make check". This is due to a bug in OpenMPI that fails to
+ create a zero-size datatype in MPI_Type_create_hindexed. The bug fix has
+ appeared in the releases of 1.10.3, 1.8.6, and 2.0.1. See the bug report
+ in https://github.com/open-mpi/ompi/issues/1611
+ * When using SGI MPI with MPT 2.14 to build PnetCDF, users may encounter an
+ error message of "function:MPI_TYPE_CREATE_HVECTOR, Invalid argument".
+ The bug fix will appear in 2.15 to be released in November 2016.
+ * The quiet mode of utility program ncmpidiff, command-line option -q, now
+ print no message when two files or two variables in comparison are the
+ same.
+
+ o Interoperability with netCDF-4
+ * When using 1.8.0 release to build netCDF version 4.4.1.1 and earlier,
+ users may encounter errors with message like "test_put.c: NetCDF: Numeric
+ conversion not representable" from running command "make test". This is
+ due to an incorrect implementation of uchar APIs for accessing variables
+ of type NC_BYTE for CDF-2 files in both PnetCDF and NetCDF. If not using
+ such a special case, users can ignore this error. See more information
+ above under "Semantics updates".
+
+ o Bug fixes
+ * Fix to allow argument no_fill in API ncmpi_inq_var_fill to be NULL. See
+ r2609
+ * Fix to allow putting global attribute _FillValue. See r2560
+ * Fix some missing character string normalizations for names of attributes,
+ dimensions, and variables.
+ * Fix the return unlimited dimension ID of value -1, not 0, by Fortran API
+ nfmpi_inq_unlimdim when no unlimited dimension is defined. This conforms
+ with netCDF convention. See r2396 and r1372
+ * Fix string processing of the environment variables for PnetCDF I/O hints
+ See r2385
+ * Fix utility ncmpidiff to use collective read APIs in collective data mode
+ See r2382
+
-------------------------------------
version 1.7.0 (March 3, 2016)
@@ -61,7 +267,7 @@ version 1.7.0 (March 3, 2016)
netCDF file to a memory buffer of type signed char and 2) put a value
of -1 of signed char to a NC_UBYTE variable in a netCDF file
* test/testcases/check_type.c tests if the error codes can be correctly
- returned when conflicted in-memory and extenal data types are used.
+ returned when conflicted in-memory and external data types are used.
* test/testcases/put_parameter.f tests the use of immutable write buffer
(e.g. a buffer declared as PARAMETER). Note the buffer size must be
smaller than 4KB.
@@ -626,9 +832,9 @@ version 1.4.1 (December 23, 2013)
* For nfmpi_put_att and nf90mpi_put_att family, the intent modifier for
the put buffer arguments are now declared as INTENT(IN).
* For nfmpi_put_var* and nf90mpi_put_var family
- + On Big Endian machines, the the intent modifier for the put buffer
+ + On Big Endian machines, the intent modifier for the put buffer
arguments are now declared as INTENT(IN).
- + On Little Endian machines, the the intent modifier for the put buffer
+ + On Little Endian machines, the intent modifier for the put buffer
arguments are still declared as INTENT(INOUT). This is because PnetCDF
does in-place byte-swap on user's put buffer. If user's buffer is
declared as parameter, then segment fault can happen when PnetCDF
@@ -836,7 +1042,7 @@ version 1.4.0 (November 17, 2013)
* add build recipe for CRAY-XE6, Hopper @NERSC in README.CRAY
* add build recipe for CRAY-XC30, Edison @NERSC in README.CRAY
* add build recipe for Endeavour @ NASA in README.SGI
- * add declaration of flexible APIs for Fortran90
+ * add declaration of flexible APIs for Fortran 90
* "make testing" now hides most of the stdout. Use "make verbose_testing"
for verbose output.
* ncmpidump: add the command-line option "-k" to report the format of
@@ -853,7 +1059,7 @@ version 1.4.0 (November 17, 2013)
* Error codes and messages conform with netCDF's
o Bug fixes
- * Argument unlimdimid of nfmpi_inq() returns -1 when no unlimited length
+ * Argument unlimdimidp of nfmpi_inq() returns -1 when no unlimited length
dimension has been defined (to conform nf_inq()).
* Argument varid of nfmpi_inq_varoffset() is fixed to be the C's varid
plus one.
@@ -898,7 +1104,7 @@ version 1.3.0 (June 26, 2012)
- Bug fixes in new ncmpidiff tool.
- Small optimizations to reduce communication in library.
- Improved documentation, including more test programs and a QuickTutorial.
- - Bug fixes in our Fortran90 support.
+ - Bug fixes in our Fortran 90 support.
- Better compatibility with NetCDF-4: no need for a modified pnetcdf.h from
Unidata when building NetCDF-4 with PnetCDF support.
- PnetCDF now duplicates the MPI communicator internally, which fixed at
@@ -946,7 +1152,7 @@ version 1.3.0 (June 26, 2012)
- In testing with version 11.7 of the Portland Group compiler, some of the
Fortran test programs fail to compile if built with pgf77. The tests work
- if built with the Fortran90 compiler.
+ if built with the Fortran 90 compiler.
-------------------------------------
version 1.2.0 (August 19, 2010)
diff --git a/aclocal.m4 b/aclocal.m4
index 95243c7..8299646 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4 2554 2016-10-14 17:26:26Z wkliao $
+dnl $Id: aclocal.m4 2682 2016-12-07 06:30:01Z wkliao $
dnl UD macros for netcdf configure
@@ -28,8 +28,15 @@ AC_DEFUN(UD_PROG_M4,
${RM} -f conftest.err
;;
esac
- AC_MSG_RESULT($M4FLAGS)
+ if test "x$M4FLAGS" = x; then
+ AC_MSG_RESULT("none")
+ else
+ AC_MSG_RESULT($M4FLAGS)
+ fi
+ M4FFLAGS=`echo $M4FLAGS | sed 's/-s *//g'`
+ dnl AC_MSG_NOTICE(M4FFLAGS=$M4FFLAGS)
AC_SUBST(M4FLAGS)
+ AC_SUBST(M4FFLAGS)
])
dnl
@@ -1633,18 +1640,23 @@ AC_DEFUN([UD_CHECK_MPI_COMPILER], [
if test "x$MPI_INSTALL" != x ; then
UD_MSG_DEBUG(--with-mpi=$MPI_INSTALL is used)
if test "x$$1" = x ; then
- if test "x$$1" = x && (test -d "${MPI_INSTALL}/bin") ; then
+ dnl If $1 is not defined, first search under ${MPI_INSTALL}/bin
+ if test -d "${MPI_INSTALL}/bin" ; then
UD_MSG_DEBUG(search possible $1 under $MPI_INSTALL/bin)
AC_PATH_PROGS([$1], [$2], [], [$MPI_INSTALL/bin])
fi
+ dnl If no valid $1 can be found under ${MPI_INSTALL}/bin, search
+ dnl under ${MPI_INSTALL}
if test "x$$1" = x ; then
UD_MSG_DEBUG(search possible $1 under $MPI_INSTALL)
AC_PATH_PROGS([$1], [$2], [], [$MPI_INSTALL])
fi
else
+ dnl if $1 is defined, check whether the file exists
UD_MSG_DEBUG(check if file $$1 exists)
if ! test -f "$$1" ; then
- dnl file does not exist, check under MPI_INSTALL
+ dnl file does not exist in the current directory, check under
+ dnl MPI_INSTALL
UD_MSG_DEBUG(File $1= $$1 cannot be found ... check under $MPI_INSTALL)
if test -f "$MPI_INSTALL/$$1" ; then
UD_MSG_DEBUG(File $1= $$1 is found under $MPI_INSTALL)
diff --git a/benchmarks/C/Makefile.in b/benchmarks/C/Makefile.in
index a1c697d..70baed8 100644
--- a/benchmarks/C/Makefile.in
+++ b/benchmarks/C/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2215 2015-12-08 04:58:04Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -41,13 +41,14 @@ write_block_read_column: write_block_read_column.o $(LIBRARY)
TEST_MPIRUN_4 = $(subst NP,4,$(TEST_MPIRUN))
ptest: $(PROGS)
- @for i in $(PROGS); do ( \
- echo "-----------------------------------------------------" ; \
- echo "$(TEST_MPIRUN_4) ./$$i 10 $(TEST_OUTDIR)/testfile.nc" ; \
- echo "-----------------------------------------------------" ; \
- $(TEST_MPIRUN_4) ./$$i 10 $(TEST_OUTDIR)/testfile.nc \
- ; ) ; done
- @echo "-----------------------------------------------------"
+ @for i in $(PROGS); do { \
+ $(TEST_MPIRUN_4) ./$$i -q 10 $(TEST_OUTDIR)/testfile.nc ; \
+ if [ $$? = 0 ] ; then \
+ echo "PASS: C parallel run on 4 processes --------------- $$i"; \
+ else \
+ echo "FAILED: C parallel run on 4 processes ------------- $$i"; \
+ exit 1; \
+ fi ; } ; done
ptests:
diff --git a/benchmarks/C/aggregation.c b/benchmarks/C/aggregation.c
index e298c90..414813a 100644
--- a/benchmarks/C/aggregation.c
+++ b/benchmarks/C/aggregation.c
@@ -4,11 +4,14 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: aggregation.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: aggregation.c 2728 2016-12-18 17:49:20Z wkliao $ */
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <string.h> /* strcpy(), strncpy() */
+#include <unistd.h> /* getopt() */
+#include <errno.h>
+
#include <mpi.h>
#include <pnetcdf.h>
@@ -115,6 +118,8 @@
#define ERR(e) {if((e)!=NC_NOERR)printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(e));}
+static int debug;
+
/*----< print_info() >------------------------------------------------------*/
static
void print_info(MPI_Info *info_used)
@@ -142,7 +147,7 @@ int benchmark_write(char *filename,
MPI_Info *w_info_used,
double *timing) /* [6] */
{
- int i, j, k, verbose, rank, nprocs, err, num_reqs;
+ int i, j, k, rank, nprocs, err, num_reqs;
int ncid, cmode, varid[NVARS], dimid[6], *reqs, *sts, psizes[2];
void *buf[NVARS];
double start_t, end_t;
@@ -150,7 +155,6 @@ int benchmark_write(char *filename,
MPI_Offset gsizes[2], start[2], count[2];
MPI_Info info=MPI_INFO_NULL;
- verbose = 0;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &nprocs);
@@ -162,27 +166,26 @@ int benchmark_write(char *filename,
/* disable the fixed-size variable alignments */
MPI_Info_set(info, "nc_var_align_size", "1");
- /* initialize I/O buffer with random numbers */
- srand(rank);
+ /* initialize I/O buffer */
for (i=0; i<NVARS; i++) {
if (i % 4 == 0) {
int *int_b = (int*) malloc(len * len * sizeof(int));
- for (j=0; j<len*len; j++) int_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) int_b[j] = rank;
buf[i] = (void*)int_b;
}
else if (i % 4 == 1) {
float *flt_b = (float*) malloc(len * len * sizeof(float));
- for (j=0; j<len*len; j++) flt_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) flt_b[j] = rank;
buf[i] = (void*)flt_b;
}
else if (i % 4 == 2) {
short *shr_b = (short*) malloc(len * len * sizeof(short));
- for (j=0; j<len*len; j++) shr_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) shr_b[j] = rank;
buf[i] = (void*)shr_b;
}
else {
double *dbl_b = (double*) malloc(len * len * sizeof(double));
- for (j=0; j<len*len; j++) dbl_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) dbl_b[j] = rank;
buf[i] = (void*)dbl_b;
}
}
@@ -260,7 +263,7 @@ int benchmark_write(char *filename,
err = ncmpi_iput_vara_int(ncid, varid[i], start, count, int_b,
&reqs[k++]);
ERR(err)
- if (verbose) printf("block-block %d: start=%lld %lld count=%lld %lld\n",i,start[0],start[1],count[0],count[1]);
+ if (debug) printf("block-block %d: start=%lld %lld count=%lld %lld\n",i,start[0],start[1],count[0],count[1]);
}
else if (i % 4 == 1) {
float *flt_b = (float*) buf[i];
@@ -268,12 +271,12 @@ int benchmark_write(char *filename,
count[0] = len;
count[1] = 1;
for (j=0; j<len; j++) {
- start[1] = rank + j * nprocs;
+ start[1] = rank + (MPI_Offset)j * nprocs;
err = ncmpi_iput_vara_float(ncid, varid[i], start, count,
flt_b, &reqs[k++]);
ERR(err)
flt_b += len;
- if (verbose) printf("*-cyclic i=%d j=%d: start=%lld %lld count=%lld %lld\n",i,j,start[0],start[1],count[0],count[1]);
+ if (debug) printf("*-cyclic i=%d j=%d: start=%lld %lld count=%lld %lld\n",i,j,start[0],start[1],count[0],count[1]);
}
}
else if (i % 4 == 2) {
@@ -285,7 +288,7 @@ int benchmark_write(char *filename,
err = ncmpi_iput_vara_short(ncid, varid[i], start, count,
shr_b, &reqs[k++]);
ERR(err)
- if (verbose) printf("block-* i=0 start=%lld %lld count=%lld %lld\n",start[0],start[1],count[0],count[1]);
+ if (debug) printf("block-* i=0 start=%lld %lld count=%lld %lld\n",start[0],start[1],count[0],count[1]);
shr_b += len * (len/2);
start[1] = len/2;
@@ -293,7 +296,7 @@ int benchmark_write(char *filename,
err = ncmpi_iput_vara_short(ncid, varid[i], start, count,
shr_b, &reqs[k++]);
ERR(err)
- if (verbose) printf("block-* i=1 start=%lld %lld count=%lld %lld\n",start[0],start[1],count[0],count[1]);
+ if (debug) printf("block-* i=1 start=%lld %lld count=%lld %lld\n",start[0],start[1],count[0],count[1]);
}
else {
double *dbl_b = (double*) buf[i];
@@ -304,7 +307,7 @@ int benchmark_write(char *filename,
err = ncmpi_iput_vara_double(ncid, varid[i], start, count, dbl_b,
&reqs[k++]);
ERR(err)
- if (verbose) printf("*-block %d: start=%lld %lld count=%lld %lld\n",i,start[0],start[1],count[0],count[1]);
+ if (debug) printf("*-block %d: start=%lld %lld count=%lld %lld\n",i,start[0],start[1],count[0],count[1]);
}
}
num_reqs = k;
@@ -356,7 +359,7 @@ int benchmark_read(char *filename,
MPI_Info *r_info_used,
double *timing) /* [5] */
{
- int i, j, k, verbose, rank, nprocs, s_rank, err, num_reqs;
+ int i, j, k, rank, nprocs, s_rank, err, num_reqs;
int ncid, omode, varid[NVARS], *reqs, *sts, psizes[2];
void *buf[NVARS];
double start_t, end_t;
@@ -364,7 +367,6 @@ int benchmark_read(char *filename,
MPI_Offset start[2], count[2];
MPI_Info info=MPI_INFO_NULL;
- verbose = 0;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &nprocs);
s_rank = (rank + nprocs / 2 ) % nprocs;
@@ -395,7 +397,7 @@ int benchmark_read(char *filename,
/* Note that PnetCDF read the file in chunks of size 256KB, thus the read
* amount may be more than the file header size
*/
- if (verbose) {
+ if (debug) {
MPI_Offset h_size, h_extent;
ncmpi_inq_header_size(ncid, &h_size);
ncmpi_inq_header_extent(ncid, &h_extent);
@@ -434,7 +436,7 @@ int benchmark_read(char *filename,
count[0] = len;
count[1] = 1;
for (j=0; j<len; j++) {
- start[1] = s_rank + j * nprocs;
+ start[1] = s_rank + (MPI_Offset)j * nprocs;
err = ncmpi_iget_vara_float(ncid, varid[i], start, count,
flt_b, &reqs[k++]);
ERR(err)
@@ -510,9 +512,24 @@ int benchmark_read(char *filename,
return 1;
}
+static void
+usage(char *argv0)
+{
+ char *help =
+ "Usage: %s [-h | -q | -d] len file_name\n"
+ " [-h] Print help\n"
+ " [-q] Quiet mode\n"
+ " [-d] Debug mode\n"
+ " len: local variable of size len x len (default 10)\n"
+ " filename: output netCDF file name (default ./testfile.nc)\n";
+ fprintf(stderr, help, argv0);
+}
+
/*----< main() >--------------------------------------------------------------*/
int main(int argc, char** argv) {
- int rank, nprocs;
+ extern int optind;
+ char filename[256];
+ int i, rank, nprocs, verbose=1;
double timing[11], max_t[11];
MPI_Offset len, w_size=0, r_size=0, sum_w_size, sum_r_size;
MPI_Comm comm=MPI_COMM_WORLD;
@@ -522,15 +539,31 @@ int main(int argc, char** argv) {
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &nprocs);
- if (argc != 3) {
- if (!rank) printf("Usage: %s len filename\n",argv[0]);
- MPI_Finalize();
- return 0;
- }
- len = atoll(argv[1]);
+ /* get command-line arguments */
+ debug = 0;
+ while ((i = getopt(argc, argv, "hqd")) != EOF)
+ switch(i) {
+ case 'q': verbose = 0;
+ break;
+ case 'd': debug = 1;
+ break;
+ case 'h':
+ default: if (rank==0) usage(argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ argc -= optind;
+ argv += optind;
+
+ len = 10;
+ if (argc > 0) len = strtoll(argv[0],NULL,10);
+ len = (len <= 0) ? 10 : len;
+
+ if (argc > 1) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
- benchmark_write(argv[2], len, &w_size, &w_info_used, timing);
- benchmark_read (argv[2], len, &r_size, &r_info_used, timing+6);
+ benchmark_write(filename, len, &w_size, &w_info_used, timing);
+ benchmark_read (filename, len, &r_size, &r_info_used, timing+6);
MPI_Reduce(&timing, &max_t, 11, MPI_DOUBLE, MPI_MAX, 0, comm);
#ifdef MPI_OFFSET
@@ -540,7 +573,7 @@ int main(int argc, char** argv) {
MPI_Reduce(&w_size, &sum_w_size, 1, MPI_LONG_LONG, MPI_SUM, 0, comm);
MPI_Reduce(&r_size, &sum_r_size, 1, MPI_LONG_LONG, MPI_SUM, 0, comm);
#endif
- if (rank == 0) {
+ if (verbose && rank == 0) {
double bw = sum_w_size;
bw /= 1048576.0;
print_info(&w_info_used);
diff --git a/benchmarks/C/write_block_read_column.c b/benchmarks/C/write_block_read_column.c
index 27a9d78..cd205f0 100644
--- a/benchmarks/C/write_block_read_column.c
+++ b/benchmarks/C/write_block_read_column.c
@@ -4,11 +4,13 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: write_block_read_column.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: write_block_read_column.c 2728 2016-12-18 17:49:20Z wkliao $ */
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+#include <string.h> /* strcpy(), strncpy() */
+#include <unistd.h> /* getopt() */
+
#include <mpi.h>
#include <pnetcdf.h>
@@ -91,27 +93,26 @@ int benchmark_write(char *filename,
MPI_Info_set(info, "nc_header_read_chunk_size", "512"); /* size in bytes */
/* note that set the above values to 1 to disable the alignment */
- /* initialize I/O buffer with random numbers */
- srand(rank);
+ /* initialize I/O buffer */
for (i=0; i<NVARS; i++) {
if (i % 4 == 0) {
int *int_b = (int*) malloc(len * len * sizeof(int));
- for (j=0; j<len*len; j++) int_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) int_b[j] = rank;
buf[i] = (void*)int_b;
}
else if (i % 4 == 1) {
float *flt_b = (float*) malloc(len * len * sizeof(float));
- for (j=0; j<len*len; j++) flt_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) flt_b[j] = rank;
buf[i] = (void*)flt_b;
}
else if (i % 4 == 2) {
short *shr_b = (short*) malloc(len * len * sizeof(short));
- for (j=0; j<len*len; j++) shr_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) shr_b[j] = rank;
buf[i] = (void*)shr_b;
}
else {
double *dbl_b = (double*) malloc(len * len * sizeof(double));
- for (j=0; j<len*len; j++) dbl_b[j] = rank; /* rand(); */
+ for (j=0; j<len*len; j++) dbl_b[j] = rank;
buf[i] = (void*)dbl_b;
}
}
@@ -319,9 +320,23 @@ int benchmark_read(char *filename,
return 1;
}
+static void
+usage(char *argv0)
+{
+ char *help =
+ "Usage: %s [-h | -q] len file_name\n"
+ " [-h] Print help\n"
+ " [-q] Quiet mode\n"
+ " len: local variable of size len x len (default 10)\n"
+ " filename: output netCDF file name (default ./testfile.nc)\n";
+ fprintf(stderr, help, argv0);
+}
+
/*----< main() >--------------------------------------------------------------*/
int main(int argc, char** argv) {
- int rank, nprocs;
+ extern int optind;
+ char filename[256];
+ int i, rank, nprocs, verbose=1;;
double timing[10], max_t[10];
MPI_Offset len, w_size, r_size, sum_w_size, sum_r_size;
MPI_Comm comm=MPI_COMM_WORLD;
@@ -331,15 +346,27 @@ int main(int argc, char** argv) {
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &nprocs);
- if (argc != 3) {
- if (!rank) printf("Usage: %s len filename\n",argv[0]);
- MPI_Finalize();
- return 0;
- }
- len = atoll(argv[1]);
+ /* get command-line arguments */
+ while ((i = getopt(argc, argv, "hq")) != EOF)
+ switch(i) {
+ case 'q': verbose = 0;
+ break;
+ case 'h':
+ default: if (rank==0) usage(argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ argc -= optind;
+ argv += optind;
+
+ len = 10;
+ if (argc > 0) len = strtoll(argv[0],NULL,10);
+ len = (len <= 0) ? 10 : len;
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
- benchmark_write(argv[2], len, &w_size, &w_info_used, timing);
- benchmark_read (argv[2], len, &r_size, &r_info_used, timing+5);
+ benchmark_write(filename, len, &w_size, &w_info_used, timing);
+ benchmark_read (filename, len, &r_size, &r_info_used, timing+5);
MPI_Reduce(&timing, &max_t, 10, MPI_DOUBLE, MPI_MAX, 0, comm);
#ifdef MPI_OFFSET
@@ -349,7 +376,7 @@ int main(int argc, char** argv) {
MPI_Reduce(&w_size, &sum_w_size, 1, MPI_LONG_LONG, MPI_SUM, 0, comm);
MPI_Reduce(&r_size, &sum_r_size, 1, MPI_LONG_LONG, MPI_SUM, 0, comm);
#endif
- if (rank == 0) {
+ if (verbose && rank == 0) {
double bw = sum_w_size;
bw /= 1048576.0;
print_info(&w_info_used);
diff --git a/benchmarks/FLASH-IO/Makefile.in b/benchmarks/FLASH-IO/Makefile.in
index 032e791..33b4769 100644
--- a/benchmarks/FLASH-IO/Makefile.in
+++ b/benchmarks/FLASH-IO/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2219 2015-12-11 22:30:03Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -61,7 +61,12 @@ $(PROGS): $(OBJS)
TEST_MPIRUN_4 = $(subst NP,4,$(TEST_MPIRUN))
ptest: $(PROGS)
- $(TEST_MPIRUN_4) ./$(PROGS) $(TEST_OUTDIR)/flash_io_test_
+ $(TEST_MPIRUN_4) ./$(PROGS) -q $(TEST_OUTDIR)/flash_io_test_ ; \
+ if [ $$? = 0 ] ; then \
+ echo "PASS: F90 parallel run on 4 processes --------------- FLASH_IO"; \
+ else \
+ echo "FAILED: F90 parallel run on 4 processes ------------- FLASH_IO"; \
+ fi
ptests:
diff --git a/benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.F90 b/benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.F90
index 4c92054..0718177 100644
--- a/benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.F90
+++ b/benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.F90
@@ -246,7 +246,8 @@
integer ncid, cmode, file_info
integer(kind=MPI_OFFSET_KIND) starts(5), counts(4), put_size
- integer gsizes(5), subsizes(5), buftype, reqs(nvar+6), stats(nvar+6)
+ integer gsizes(5), subsizes(5), gstarts(5)
+ integer buftype, reqs(nvar+6), stats(nvar+6)
!-----------------------------------------------------------------------------
! compute the total number of blocks left of a given processor number
@@ -555,12 +556,12 @@
subsizes(3) = nyb
subsizes(4) = nzb
subsizes(5) = lnblocks
- starts(1) = 0
- starts(2) = nguard
- starts(3) = nguard*k2d
- starts(4) = nguard*k3d
- starts(5) = 0
- call MPI_Type_create_subarray(5, gsizes, subsizes, starts, &
+ gstarts(1) = 0
+ gstarts(2) = nguard
+ gstarts(3) = nguard*k2d
+ gstarts(4) = nguard*k3d
+ gstarts(5) = 0
+ call MPI_Type_create_subarray(5, gsizes, subsizes, gstarts, &
MPI_ORDER_FORTRAN, &
MPI_DOUBLE_PRECISION, buftype, &
err)
diff --git a/benchmarks/FLASH-IO/flash_benchmark_io.F90 b/benchmarks/FLASH-IO/flash_benchmark_io.F90
index bac2afa..42122f6 100644
--- a/benchmarks/FLASH-IO/flash_benchmark_io.F90
+++ b/benchmarks/FLASH-IO/flash_benchmark_io.F90
@@ -5,9 +5,9 @@
! performance.
!
-#ifndef MPI_OFFSET
-#define MPI_OFFSET MPI_INTEGER8
-#endif
+! #ifndef MPI_OFFSET
+! #define MPI_OFFSET MPI_INTEGER8
+! #endif
#ifdef NAGf90Fortran
USE F90_UNIX_ENV, only : iargc, getarg
@@ -23,7 +23,7 @@
#endif
integer i, argc, ierr
character(len=128) executable
- logical isArgvRight
+ logical verbose, isArgvRight
double precision time_io(3), time_begin
double precision chk_io, corner_io, nocorner_io
@@ -38,21 +38,25 @@
call MPI_Comm_Size (MPI_Comm_World, NumPEs, ierr)
MasterPE = 0
+ verbose = .TRUE.
! root process reads command-line arguments
if (MyPE .EQ. MasterPE) then
isArgvRight = .TRUE.
argc = IARGC()
call getarg(0, executable)
- if (argc .GT. 1) then
+ if (argc .GT. 2) then
print *, &
- 'Usage: ',trim(executable),' <ouput file base name>'
+ 'Usage: ',trim(executable),' [-q] <ouput file base name>'
isArgvRight = .FALSE.
else
+ ! default file name prefix
+ basenm = "flash_io_test_"
if (argc .EQ. 1) then
call getarg(1, basenm)
- else ! default file name prefix
- basenm = "flash_io_test_"
+ else
+ verbose = .FALSE.
+ call getarg(2, basenm)
endif
endif
endif
@@ -114,7 +118,7 @@
corner_io = plotfile_ncmpi_par(0,0.e0,.true.)
time_io(3) = MPI_Wtime() - time_begin
- call report_io_performance(local_blocks, time_io, chk_io, &
+ call report_io_performance(verbose, local_blocks, time_io, chk_io, &
corner_io, nocorner_io)
999 call MPI_Finalize(ierr)
@@ -159,11 +163,12 @@
!---------------------------------------------------------------------------
! print I/O performance numbers
!---------------------------------------------------------------------------
- subroutine report_io_performance(local_blocks, time_io, chk_io, &
- corner_io, nocorner_io)
+ subroutine report_io_performance(verbose, local_blocks, time_io, &
+ chk_io, corner_io, nocorner_io)
use pnetcdf
#include "common.fh"
+ logical verbose
integer local_blocks
double precision time_io(3)
double precision chk_io, corner_io, nocorner_io
@@ -198,7 +203,7 @@
MasterPE, MPI_COMM_WORLD, ierr)
corner_io = bw
- if (MyPE .EQ. MasterPE) then
+ if (verbose .AND. MyPE .EQ. MasterPE) then
striping_factor = 0
striping_unit = 0
@@ -256,7 +261,7 @@
if (ierr .EQ. NF_NOERR) then
call MPI_Reduce(malloc_size, sum_size, 1, MPI_OFFSET, MPI_SUM, &
MasterPE, MPI_COMM_WORLD, ierr)
- if (MyPE .EQ. MasterPE) &
+ if (verbose .AND. MyPE .EQ. MasterPE) &
print 1002, &
'maximum heap memory allocted by PnetCDF internally is', &
sum_size/1048576, ' MiB'
@@ -264,7 +269,8 @@
ierr = nfmpi_inq_malloc_size(malloc_size)
call MPI_Reduce(malloc_size, sum_size, 1, MPI_OFFSET, MPI_SUM, &
MasterPE, MPI_COMM_WORLD, ierr)
- if (MyPE .EQ. MasterPE .AND. sum_size .GT. 0_MPI_OFFSET_KIND) &
+ if (verbose .AND. MyPE .EQ. MasterPE .AND. &
+ sum_size .GT. 0_MPI_OFFSET_KIND) &
print 1002, &
'heap memory allocated by PnetCDF internally has ', &
sum_size/1048576, ' MiB yet to be freed'
diff --git a/check_install.in b/check_install.in
new file mode 100644
index 0000000..565a6e5
--- /dev/null
+++ b/check_install.in
@@ -0,0 +1,91 @@
+#! /bin/sh
+#
+# Copyright (C) 2016, Northwestern University and Argonne National Laboratory
+# See COPYRIGHT notice in top-level directory.
+#
+# $Id: check_install.in 2788 2016-12-29 03:14:39Z wkliao $
+#
+# @configure_input@
+
+prefix="@prefix@"
+
+if test $# -eq 1 ; then
+ prefix=$1
+elif test $# -eq 0 ; then
+ if test "x$prefix" = "x" ; then
+ echo "This utility checks the PnetCDF install files" >& 2
+ echo "Usage: $0 install_path" >&2
+ exit 1
+ fi
+fi
+
+installdir=$prefix
+nerrs=0
+
+headerfiles="pnetcdf pnetcdf.h pnetcdf.inc pnetcdf.mod"
+for f in $headerfiles
+do
+ installfile=$installdir/include/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+libfiles="libpnetcdf.a"
+for f in $libfiles
+do
+ installfile=$installdir/lib/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+pkgfiles="pnetcdf.pc"
+for f in $pkgfiles
+do
+ installfile=$installdir/lib/pkgconfig/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+binfiles="ncmpidiff ncmpidump ncmpigen ncmpivalid ncoffsets pnetcdf-config pnetcdf_version"
+for f in $binfiles
+do
+ installfile=$installdir/bin/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+man1files="ncmpidiff.1 ncmpigen.1 ncoffsets.1 ncmpidump.1 ncmpivalid.1 pnetcdf_version.1"
+for f in $man1files
+do
+ installfile=$installdir/share/man/man1/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+man3files="pnetcdf.3 pnetcdf_f77.3 pnetcdf_f90.3"
+for f in $man3files
+do
+ installfile=$installdir/share/man/man3/$f
+ if ! test -e $installfile ; then
+ echo "Error: file NOT found: $installfile" >& 2
+ nerrs=`expr $nerrs + 1`
+ fi
+done
+
+if test $nerrs = 0 ; then
+ echo "PASS -- all PnetCDF files appear in $installdir"
+else
+ echo "FAIL -- $nerrs error(s) found" >& 2
+ exit 1
+fi
+
diff --git a/configure b/configure
index 1df7457..ea29587 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.in Id: configure.in 2625 2016-11-15 23:10:49Z wkliao .
+# From configure.in Id: configure.in 2853 2017-01-28 07:47:58Z wkliao .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for parallel-netcdf 1.8.0.pre1.
+# Generated by GNU Autoconf 2.69 for parallel-netcdf 1.8.1.
#
# Report bugs to <parallel-netcdf at mcs.anl.gov>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='parallel-netcdf'
PACKAGE_TARNAME='parallel-netcdf'
-PACKAGE_VERSION='1.8.0.pre1'
-PACKAGE_STRING='parallel-netcdf 1.8.0.pre1'
+PACKAGE_VERSION='1.8.1'
+PACKAGE_STRING='parallel-netcdf 1.8.1'
PACKAGE_BUGREPORT='parallel-netcdf at mcs.anl.gov'
PACKAGE_URL=''
@@ -625,6 +625,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
+CONFIG_DATE
SEQ_CC
TEST_OUTDIR
TEST_MPIRUN
@@ -671,6 +672,7 @@ NMFLAGS
NM
ARFLAGS
AR
+M4FFLAGS
M4FLAGS
M4
EGREP
@@ -701,7 +703,6 @@ FCFLAGS_f90
FCFLAGS_F
FCFLAGS_f
FC_DEFINE
-FPPFLAGS
FPP
F90PPFLAGS_F90
F90PPFLAGS_f90
@@ -733,6 +734,7 @@ OBJEXT
EXEEXT
ac_ct_CC
LDFLAGS
+FPPFLAGS
FCFLAGS
FFLAGS
CXXFLAGS
@@ -830,6 +832,7 @@ CPPFLAGS
CXXFLAGS
FFLAGS
FCFLAGS
+FPPFLAGS
LDFLAGS
LIBS
CCC
@@ -1377,7 +1380,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures parallel-netcdf 1.8.0.pre1 to adapt to many kinds of systems.
+\`configure' configures parallel-netcdf 1.8.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1442,7 +1445,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of parallel-netcdf 1.8.0.pre1:";;
+ short | recursive ) echo "Configuration of parallel-netcdf 1.8.1:";;
esac
cat <<\_ACEOF
@@ -1500,12 +1503,13 @@ Some influential environment variables:
F77 Overwritten by MPIF77 if MPIF77 is set
FC Overwritten by MPIF90 if MPIF90 is set
CFLAGS Debugging and optimization options for the C compiler
- CPPFLAGS Preprocessor options for the C and C++ compilers, e.g.
- -I<include dir> if you have headers in a nonstandard directory
- <include dir>
+ CPPFLAGS Preprocessor options for C and C++ compilers, e.g. -I<include
+ dir> if you have headers in a nonstandard directory <include
+ dir>
CXXFLAGS Debugging and optimization options for the C compiler
FFLAGS Debugging and optimization options for the Fortran 77 compiler
FCFLAGS Debugging and optimization options for the Fortran 90 compiler
+ FPPFLAGS Preprocessor options for Fortran compilers, e.g. -I<include dir>
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
@@ -1582,7 +1586,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-parallel-netcdf configure 1.8.0.pre1
+parallel-netcdf configure 1.8.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2479,7 +2483,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by parallel-netcdf $as_me 1.8.0.pre1, which was
+It was created by parallel-netcdf $as_me 1.8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2871,7 +2875,7 @@ PNETCDF_VERSION_PRE=`echo ${PACKAGE_VERSION} | cut -d. -f4`
PNETCDF_VERSION=${PACKAGE_VERSION}
-SVN_DATE="$LastChangedDate: 2016-11-15 17:10:49 -0600 (Tue, 15 Nov 2016) $"
+SVN_DATE="$LastChangedDate: 2017-01-28 01:47:58 -0600 (Sat, 28 Jan 2017) $"
PNETCDF_RELEASE_DATE2=`echo $SVN_DATE | cut -d' ' -f2`
PNETCDF_RELEASE_DATE=`echo $SVN_DATE | cut -d' ' -f6,7,8 | cut -d')' -f1`
@@ -3039,6 +3043,7 @@ fi
+
if test "x$MPICC" = x && test "x$CC" != x ; then MPICC=$CC ; fi
if test "x$MPICXX" = x && test "x$CXX" != x ; then MPICXX=$CXX ; fi
if test "x$MPIF77" = x && test "x$F77" != x ; then MPIF77=$F77 ; fi
@@ -3085,7 +3090,7 @@ $as_echo "$as_me: DEBUG: --with-mpi=$MPI_INSTALL is used" >&6;}
if test "x$MPICC" = x ; then
- if test "x$MPICC" = x && (test -d "${MPI_INSTALL}/bin") ; then
+ if test -d "${MPI_INSTALL}/bin" ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPICC under $MPI_INSTALL/bin" >&5
$as_echo "$as_me: DEBUG: search possible MPICC under $MPI_INSTALL/bin" >&6;}
@@ -3138,7 +3143,7 @@ fi
done
fi
- if test "x$MPICC" = x ; then
+ if test "x$MPICC" = x ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPICC under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: search possible MPICC under $MPI_INSTALL" >&6;}
@@ -3192,14 +3197,14 @@ done
fi
else
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: check if file $MPICC exists" >&5
$as_echo "$as_me: DEBUG: check if file $MPICC exists" >&6;}
fi
if ! test -f "$MPICC" ; then
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: File MPICC= $MPICC cannot be found ... check under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: File MPICC= $MPICC cannot be found ... check under $MPI_INSTALL" >&6;}
fi
@@ -4574,7 +4579,7 @@ $as_echo "$as_me: DEBUG: --with-mpi=$MPI_INSTALL is used" >&6;}
if test "x$MPICXX" = x ; then
- if test "x$MPICXX" = x && (test -d "${MPI_INSTALL}/bin") ; then
+ if test -d "${MPI_INSTALL}/bin" ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPICXX under $MPI_INSTALL/bin" >&5
$as_echo "$as_me: DEBUG: search possible MPICXX under $MPI_INSTALL/bin" >&6;}
@@ -4627,7 +4632,7 @@ fi
done
fi
- if test "x$MPICXX" = x ; then
+ if test "x$MPICXX" = x ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPICXX under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: search possible MPICXX under $MPI_INSTALL" >&6;}
@@ -4681,14 +4686,14 @@ done
fi
else
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: check if file $MPICXX exists" >&5
$as_echo "$as_me: DEBUG: check if file $MPICXX exists" >&6;}
fi
if ! test -f "$MPICXX" ; then
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: File MPICXX= $MPICXX cannot be found ... check under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: File MPICXX= $MPICXX cannot be found ... check under $MPI_INSTALL" >&6;}
fi
@@ -5296,7 +5301,7 @@ $as_echo "$as_me: DEBUG: --with-mpi=$MPI_INSTALL is used" >&6;}
if test "x$MPIF77" = x ; then
- if test "x$MPIF77" = x && (test -d "${MPI_INSTALL}/bin") ; then
+ if test -d "${MPI_INSTALL}/bin" ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPIF77 under $MPI_INSTALL/bin" >&5
$as_echo "$as_me: DEBUG: search possible MPIF77 under $MPI_INSTALL/bin" >&6;}
@@ -5349,7 +5354,7 @@ fi
done
fi
- if test "x$MPIF77" = x ; then
+ if test "x$MPIF77" = x ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPIF77 under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: search possible MPIF77 under $MPI_INSTALL" >&6;}
@@ -5403,14 +5408,14 @@ done
fi
else
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: check if file $MPIF77 exists" >&5
$as_echo "$as_me: DEBUG: check if file $MPIF77 exists" >&6;}
fi
if ! test -f "$MPIF77" ; then
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: File MPIF77= $MPIF77 cannot be found ... check under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: File MPIF77= $MPIF77 cannot be found ... check under $MPI_INSTALL" >&6;}
fi
@@ -5573,7 +5578,7 @@ $as_echo "$as_me: DEBUG: --with-mpi=$MPI_INSTALL is used" >&6;}
if test "x$MPIF90" = x ; then
- if test "x$MPIF90" = x && (test -d "${MPI_INSTALL}/bin") ; then
+ if test -d "${MPI_INSTALL}/bin" ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPIF90 under $MPI_INSTALL/bin" >&5
$as_echo "$as_me: DEBUG: search possible MPIF90 under $MPI_INSTALL/bin" >&6;}
@@ -5626,7 +5631,7 @@ fi
done
fi
- if test "x$MPIF90" = x ; then
+ if test "x$MPIF90" = x ; then
if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: search possible MPIF90 under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: search possible MPIF90 under $MPI_INSTALL" >&6;}
@@ -5680,14 +5685,14 @@ done
fi
else
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: check if file $MPIF90 exists" >&5
$as_echo "$as_me: DEBUG: check if file $MPIF90 exists" >&6;}
fi
if ! test -f "$MPIF90" ; then
- if test "x${_DEBUG}" = xyes ; then
+ if test "x${_DEBUG}" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: DEBUG: File MPIF90= $MPIF90 cannot be found ... check under $MPI_INSTALL" >&5
$as_echo "$as_me: DEBUG: File MPIF90= $MPIF90 cannot be found ... check under $MPI_INSTALL" >&6;}
fi
@@ -5847,7 +5852,7 @@ if test "x${enable_fortran}" = xyes ; then
as_fn_error $? "
------------------------------------------------------------
Fortran support is explicitly requested, but configure
- cannot find a Fortran77 or Fortran90 compiler. Please
+ cannot find a Fortran 77 or Fortran 90 compiler. Please
specify the locations of the compilers either with the
MPIF77 MPIF90 environment variables or the --with-mpi
configure flag.
@@ -8996,8 +9001,15 @@ $as_echo_n "checking m4 flags... " >&6; }
${RM} -f conftest.err
;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $M4FLAGS" >&5
+ if test "x$M4FLAGS" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"none\"" >&5
+$as_echo "\"none\"" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $M4FLAGS" >&5
$as_echo "$M4FLAGS" >&6; }
+ fi
+ M4FFLAGS=`echo $M4FLAGS | sed 's/-s *//g'`
+
@@ -14012,9 +14024,16 @@ fi
+# Configuration Date
+if test "x$SOURCE_DATE_EPOCH" != "x" ; then
+ CONFIG_DATE="`date -u -d "${SOURCE_DATE_EPOCH}"`"
+else
+ CONFIG_DATE="`date`"
+fi
+
ac_config_headers="$ac_config_headers src/libf/nfconfig_inc"
-ac_config_files="$ac_config_files macros.make Makefile pnetcdf_pc pnetcdf-config src/Makefile src/lib/Makefile src/lib/pnetcdf.h src/utils/Makefile src/utils/ncmpidump/Makefile src/utils/ncmpidiff/Makefile src/utils/ncmpigen/Makefile src/utils/ncmpivalid/Makefile src/utils/pnetcdf_version/Makefile src/utils/ncoffsets/Makefile test/Makefile test/common/Makefile test/nc_test/Makefile test/C/Makefile test/fandc/Makefile test/testcases/Makefile test/nonblocking/Makefile test/header/Makefile [...]
+ac_config_files="$ac_config_files macros.make Makefile pnetcdf_pc src/Makefile src/lib/Makefile src/lib/pnetcdf.h src/utils/Makefile src/utils/ncmpidump/Makefile src/utils/ncmpidiff/Makefile src/utils/ncmpigen/Makefile src/utils/ncmpivalid/Makefile src/utils/pnetcdf_version/Makefile src/utils/ncoffsets/Makefile test/Makefile test/common/Makefile test/nc_test/Makefile test/C/Makefile test/fandc/Makefile test/testcases/Makefile test/nonblocking/Makefile test/header/Makefile test/cdf_format [...]
# The following dependency is for configure.in and configure
@@ -14022,6 +14041,11 @@ ac_config_files="$ac_config_files macros.make Makefile pnetcdf_pc pnetcdf-config
ac_config_files="$ac_config_files stamp-h"
+ac_config_files="$ac_config_files pnetcdf-config"
+
+ac_config_files="$ac_config_files check_install"
+
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -14535,7 +14559,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by parallel-netcdf $as_me 1.8.0.pre1, which was
+This file was extended by parallel-netcdf $as_me 1.8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14597,7 +14621,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-parallel-netcdf config.status 1.8.0.pre1
+parallel-netcdf config.status 1.8.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -14724,7 +14748,6 @@ do
"macros.make") CONFIG_FILES="$CONFIG_FILES macros.make" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"pnetcdf_pc") CONFIG_FILES="$CONFIG_FILES pnetcdf_pc" ;;
- "pnetcdf-config") CONFIG_FILES="$CONFIG_FILES pnetcdf-config" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;;
"src/lib/pnetcdf.h") CONFIG_FILES="$CONFIG_FILES src/lib/pnetcdf.h" ;;
@@ -14771,6 +14794,8 @@ do
"benchmarks/FLASH-IO/Makefile") CONFIG_FILES="$CONFIG_FILES benchmarks/FLASH-IO/Makefile" ;;
"test/subfile/Makefile") CONFIG_FILES="$CONFIG_FILES test/subfile/Makefile" ;;
"stamp-h") CONFIG_FILES="$CONFIG_FILES stamp-h" ;;
+ "pnetcdf-config") CONFIG_FILES="$CONFIG_FILES pnetcdf-config" ;;
+ "check_install") CONFIG_FILES="$CONFIG_FILES check_install" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -15324,6 +15349,8 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
case $ac_file$ac_mode in
"stamp-h":F) echo timestamp > stamp-h ;;
+ "pnetcdf-config":F) chmod u+x pnetcdf-config ;;
+ "check_install":F) chmod u+x check_install ;;
esac
done # for ac_tag
@@ -15383,10 +15410,13 @@ echo \
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Features: Support for large files (> 4 GB) - ${msg_large_files}
- Build C++ APIs - ${has_mpicxx}
Build Fortran APIs - ${enable_fortran}
- Enable request aggregation in nonblocking APIs - ${enable_aggregation}
+ Build C++ APIs - ${has_mpicxx}
Build CDF-2 and CDF-5 support - ${enable_cdf_2_n_5}"
+if test "x${enable_aggreg}" = xno; then
+ echo "\
+ Request aggregation in nonblocking APIs - $no"
+fi
if test "x${enable_erange_fill}" = xno; then
echo "\
Fill variables when NC_ERANGE occurs - no"
@@ -15461,10 +15491,10 @@ if test "x${LIBS}" != x ; then
fi
echo "\
- Now type 'make' to build the library and utility tools.
- Type 'make [<target>]'
+ Now type 'make' to build the library and utility tools and then
+ type 'make [<target>]' for testing and installation,
where the optional <target> is:
- testing - test PnetCDF build for sequential run
+ check - test PnetCDF build for sequential run
ptest - test PnetCDF build for parallel run
install - install PnetCDF
------------------------------------------------------------------------------"
diff --git a/configure.in b/configure.in
index 72f0210..bad66e9 100644
--- a/configure.in
+++ b/configure.in
@@ -1,10 +1,10 @@
-AC_REVISION($Id: configure.in 2625 2016-11-15 23:10:49Z wkliao $)dnl
+AC_REVISION($Id: configure.in 2853 2017-01-28 07:47:58Z wkliao $)dnl
dnl -*- Mode: shell-script-mode; -*-
dnl Process this file with GNU autoconf(1) to produce a configure script.
dnl
AC_PREREQ([2.59])
-AC_INIT([parallel-netcdf],[1.8.0.pre1],[parallel-netcdf at mcs.anl.gov])
+AC_INIT([parallel-netcdf],[1.8.1],[parallel-netcdf at mcs.anl.gov])
dnl ncconfig.h.in will be created by autoreconf (autoheader)
AC_CONFIG_HEADERS([src/lib/ncconfig.h])
@@ -26,7 +26,7 @@ PNETCDF_VERSION=${PACKAGE_VERSION}
dnl Do not change the following line, It is set by SVN automatically.
dnl It defines PNETCDF_RELEASE_DATE, a string that will be used in
dnl ncmpi_inq_libvers() to generate release date
-SVN_DATE="$LastChangedDate: 2016-11-15 17:10:49 -0600 (Tue, 15 Nov 2016) $"
+SVN_DATE="$LastChangedDate: 2017-01-28 01:47:58 -0600 (Sat, 28 Jan 2017) $"
PNETCDF_RELEASE_DATE2=`echo $SVN_DATE | cut -d' ' -f2`
PNETCDF_RELEASE_DATE=`echo $SVN_DATE | cut -d' ' -f6,7,8 | cut -d')' -f1`
@@ -133,10 +133,11 @@ AC_ARG_VAR(CXX, Overwritten by MPICXX if MPICXX is set)
AC_ARG_VAR(F77, Overwritten by MPIF77 if MPIF77 is set)
AC_ARG_VAR(FC, Overwritten by MPIF90 if MPIF90 is set)
AC_ARG_VAR(CFLAGS, Debugging and optimization options for the C compiler)
-AC_ARG_VAR(CPPFLAGS, [Preprocessor options for the C and C++ compilers, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>])
+AC_ARG_VAR(CPPFLAGS, [Preprocessor options for C and C++ compilers, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>])
AC_ARG_VAR(CXXFLAGS, Debugging and optimization options for the C compiler)
AC_ARG_VAR(FFLAGS, Debugging and optimization options for the Fortran 77 compiler)
AC_ARG_VAR(FCFLAGS, Debugging and optimization options for the Fortran 90 compiler)
+AC_ARG_VAR(FPPFLAGS, [Preprocessor options for Fortran compilers, e.g. -I<include dir>])
dnl Check if MPICC, MPICXX, MPIF77, MPIF90 are set by the user.
dnl If not, set MPICC equal to CC. Similarly, for MPICXX, MPIF77, and MPIF90
@@ -340,7 +341,7 @@ if test "x${enable_fortran}" = xyes ; then
AC_MSG_ERROR([
------------------------------------------------------------
Fortran support is explicitly requested, but configure
- cannot find a Fortran77 or Fortran90 compiler. Please
+ cannot find a Fortran 77 or Fortran 90 compiler. Please
specify the locations of the compilers either with the
MPIF77 MPIF90 environment variables or the --with-mpi
configure flag.
@@ -521,7 +522,7 @@ if test "x${enable_fortran}" = xyes ; then
AC_SUBST(FPP)
AC_SUBST(FPPFLAGS)
- dnl compiler command-line define preprocess flag, result in FC_DEFINE
+ dnl compiler command-line define preprocessor flag, result in FC_DEFINE
UD_FC_PP_DEFINE
dnl check compiler flags for file extensions in .f .F .f90 .F90
@@ -596,7 +597,7 @@ if test "x${enable_fortran}" = xyes ; then
fi
dnl check Fortran parameter modifier for 8-byte integer type
- dnl We need this to set the max constants for UINT INT64 and UINT64
+ dnl We need this to set the max constants for UINT, INT64, and UINT64
UD_FC_CONSTANT_MODIFIER
UD_MSG_DEBUG([ac_cv_fc_constant_modifier=$ac_cv_fc_constant_modifier])
PNF_INT8_MODIFIER=""
@@ -871,8 +872,8 @@ if test "x${ac_cv_c_bigendian}" = xyes ; then
fi
AC_SUBST(is_bigendian)
-dnl For big endian, put buffer needs no byte swap and hence can be declared as
-dnl INTENT(IN). For little endian, put buffer may be used for byte swap in
+dnl For big Endian, put buffer needs no byte swap and hence can be declared as
+dnl INTENT(IN). For little Endian, put buffer may be used for byte swap in
dnl place and hence must be declared as INTENT(INOUT).
dnl This will configure/produce the file src/libf90/api.f90
if test "x${ac_cv_c_bigendian}" = xyes || (test "x${in_place_swap}" = xno) ; then
@@ -993,7 +994,7 @@ fi
dnl
dnl Below is to check if a Fortran compiler produces module files with upper
-dnl case file name, eg. PNETCDF.mod. However, this does not work for Mac OSX
+dnl case file name, e.g. PNETCDF.mod. However, this does not work for Mac OSX
dnl file system which is case insensitive
dnl
if test "x${enable_fortran}" = xyes ; then
@@ -1025,7 +1026,7 @@ dnl
dnl GNU coverage
dnl
dnl This is for internal testing only. It should not be enabled for building a
-dnl production PnetCDF. This is because when run an executable compiled with
+dnl production PnetCDF. This is because running an executable compiled with
dnl coverage will produce an output file named "gmon.out". Since coverage is
dnl not parallelized, running a program compiled with coverage may cause
dnl problems on concurrently writing to gmon.out in conflicts, possible
@@ -1211,11 +1212,17 @@ dnl find if gcc is available for compiling ncoffsets to run in sequential
AC_PATH_PROG([SEQ_CC], [gcc], [$MPICC])
AC_SUBST(SEQ_CC)
+# Configuration Date
+if test "x$SOURCE_DATE_EPOCH" != "x" ; then
+ AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date -u -d "${SOURCE_DATE_EPOCH}"`"
+else
+ AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`"
+fi
+
AC_CONFIG_HEADERS([src/libf/nfconfig_inc])
AC_CONFIG_FILES(macros.make \
Makefile \
pnetcdf_pc \
- pnetcdf-config \
src/Makefile \
src/lib/Makefile \
src/lib/pnetcdf.h \
@@ -1266,6 +1273,10 @@ AC_CONFIG_FILES(macros.make \
# See autoconf manual 2.69, Section 4.8.5 Automatic Remaking
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
+dnl add executable permission to pnetcdf-config and check_install
+AC_CONFIG_FILES([pnetcdf-config], [chmod u+x pnetcdf-config])
+AC_CONFIG_FILES([check_install], [chmod u+x check_install])
+
AC_OUTPUT
echo "------------------------------------------------------------------------------"
@@ -1285,10 +1296,13 @@ echo \
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Features: Support for large files (> 4 GB) - ${msg_large_files}
- Build C++ APIs - ${has_mpicxx}
Build Fortran APIs - ${enable_fortran}
- Enable request aggregation in nonblocking APIs - ${enable_aggregation}
+ Build C++ APIs - ${has_mpicxx}
Build CDF-2 and CDF-5 support - ${enable_cdf_2_n_5}"
+if test "x${enable_aggreg}" = xno; then
+ echo "\
+ Request aggregation in nonblocking APIs - $no"
+fi
if test "x${enable_erange_fill}" = xno; then
echo "\
Fill variables when NC_ERANGE occurs - no"
@@ -1363,10 +1377,10 @@ if test "x${LIBS}" != x ; then
fi
echo "\
- Now type 'make' to build the library and utility tools.
- Type 'make @<:@<target>@:>@'
+ Now type 'make' to build the library and utility tools and then
+ type 'make @<:@<target>@:>@' for testing and installation,
where the optional <target> is:
- testing - test PnetCDF build for sequential run
+ check - test PnetCDF build for sequential run
ptest - test PnetCDF build for parallel run
install - install PnetCDF
------------------------------------------------------------------------------"
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index e58e9be..f95adfe 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2384 2016-03-30 22:20:58Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -129,31 +129,34 @@ TEST_MPIRUN_8 = $(subst NP,8,$(TEST_MPIRUN))
TEST_MPIRUN_3 = $(subst NP,3,$(TEST_MPIRUN))
ptest4: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_4) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C parallel run on 4 processes --------------- $$i"; \
else \
echo "FAILED: C parallel run on 4 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest8: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_8) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C parallel run on 8 processes --------------- $$i"; \
else \
echo "FAILED: C parallel run on 8 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest3: $(PROGS)
- @for i in $(PROGS) ; do ( \
+ @for i in $(PROGS) ; do { \
$(TEST_MPIRUN_3) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C parallel run on 3 processes --------------- $$i"; \
else \
echo "FAILED: C parallel run on 3 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest: ptest4
ptests: ptest3 ptest4 ptest8
diff --git a/examples/C/block_cyclic.c b/examples/C/block_cyclic.c
index 3dc3975..34b26e7 100644
--- a/examples/C/block_cyclic.c
+++ b/examples/C/block_cyclic.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: block_cyclic.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: block_cyclic.c 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example, generalized from column_wise.c, makes a number of nonblocking
@@ -68,7 +68,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <assert.h>
#include <mpi.h>
@@ -100,7 +100,7 @@ usage(char *argv0)
int main(int argc, char** argv) {
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, j, verbose=1, rank, nprocs, err, num_reqs, nerrs=0;
int ncid, cmode, varid, dimid[2], *reqs, *sts, **buf;
MPI_Offset myNX, G_NX, myOff, block_start, block_len;
@@ -123,7 +123,9 @@ int main(int argc, char** argv) {
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy (filename, "testfile.nc");
/* set an MPI-IO hint to disable file offset alignment for fixed-size
* variables */
diff --git a/examples/C/bput_varn_int64.c b/examples/C/bput_varn_int64.c
index f34b6ea..100478b 100644
--- a/examples/C/bput_varn_int64.c
+++ b/examples/C/bput_varn_int64.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: bput_varn_int64.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: bput_varn_int64.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests nonblocking buffered write varn APIs, including
@@ -82,8 +82,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <string.h> /* strcpy() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -110,6 +110,7 @@
static MPI_Offset *** calloc_3D(size_t z, size_t y, size_t x)
{
+ if (z*y*x == 0) return NULL;
int _j, _k;
MPI_Offset ***buf = (MPI_Offset***) malloc(z * sizeof(MPI_Offset**));
MPI_Offset **bufy = (MPI_Offset**) malloc(z*y * sizeof(MPI_Offset*));
@@ -182,7 +183,7 @@ static int check_contents(int ncid, int *varid)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc", exec[256];
+ char filename[256], *exec;
int i, j, k, n, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid[4], dimid[2], nreqs, reqs[4], sts[4];
long long *buffer[4];
@@ -193,7 +194,7 @@ int main(int argc, char** argv)
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- strcpy(exec, argv[0]);
+ exec = argv[0];
/* get command-line arguments */
while ((i = getopt(argc, argv, "hq")) != EOF)
@@ -207,7 +208,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy (filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
printf("Warning: %s is intended to run on 4 processes\n",exec);
diff --git a/examples/C/bput_varn_uint.c b/examples/C/bput_varn_uint.c
index d801291..7ab48dc 100644
--- a/examples/C/bput_varn_uint.c
+++ b/examples/C/bput_varn_uint.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: bput_varn_uint.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: bput_varn_uint.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests nonblocking buffered write varn APIs, including
@@ -15,8 +15,8 @@
* The compile and run commands are given below, together with an ncmpidump of
* the output file.
*
- * % mpicc -O2 -o i_varn_uint i_varn_uint.c -lpnetcdf
- * % mpiexec -n 4 ./i_varn_uint /pvfs2/wkliao/testfile.nc
+ * % mpicc -O2 -o bput_varn_uint bput_varn_uint.c -lpnetcdf
+ * % mpiexec -n 4 ./bput_varn_uint /pvfs2/wkliao/testfile.nc
* % ncmpidump /pvfs2/wkliao/testfile.nc
* netcdf testfile {
* // file format: CDF-5 (big variables)
@@ -58,8 +58,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <string.h> /* strcpy() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -86,6 +86,7 @@
static MPI_Offset *** calloc_3D(size_t z, size_t y, size_t x)
{
+ if (z*y*x == 0) return NULL;
int _j, _k;
MPI_Offset ***buf = (MPI_Offset***) malloc(z * sizeof(MPI_Offset**));
MPI_Offset **bufy = (MPI_Offset**) malloc(z*y * sizeof(MPI_Offset*));
@@ -158,7 +159,7 @@ static int check_contents(int ncid, int *varid)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc", exec[256];
+ char filename[256], *exec;
int i, j, k, n, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid[4], dimid[2], nreqs, reqs[4], sts[4];
unsigned int *buffer[4];
@@ -169,7 +170,7 @@ int main(int argc, char** argv)
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- strcpy(exec, argv[0]);
+ exec = argv[0];
/* get command-line arguments */
while ((i = getopt(argc, argv, "hq")) != EOF)
@@ -183,7 +184,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
printf("Warning: %s is intended to run on 4 processes\n",exec);
diff --git a/examples/C/collective_write.c b/examples/C/collective_write.c
index 4cf603b..95611b0 100644
--- a/examples/C/collective_write.c
+++ b/examples/C/collective_write.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: collective_write.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: collective_write.c 2728 2016-12-18 17:49:20Z wkliao $ */
/*
* This example mimics the coll_perf.c from ROMIO.
@@ -35,8 +35,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
+#include <string.h> /* strcpy() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -95,7 +96,7 @@ void print_info(MPI_Info *info_used)
int main(int argc, char **argv)
{
extern int optind;
- char *filename="testfile.nc", str[512];
+ char filename[256], str[512];
int i, j, rank, nprocs, len, ncid, bufsize, verbose=1, err, nerrs=0;
int *buf[NUM_VARS], psizes[NDIMS], dimids[NDIMS], varids[NUM_VARS];
double write_timing, max_write_timing, write_bw;
@@ -119,9 +120,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) filename = argv[0]; /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
+
len = 10;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++)
psizes[i] = 0;
@@ -133,17 +137,16 @@ int main(int argc, char **argv)
bufsize = 1;
for (i=0; i<NDIMS; i++) {
- gsizes[i] = len * psizes[i];
+ gsizes[i] = (MPI_Offset)len * psizes[i];
starts[i] *= len;
counts[i] = len;
bufsize *= len;
}
- /* allocate buffer and initialize with random numbers */
- srand(rank);
+ /* allocate buffer and initialize with non-zero numbers */
for (i=0; i<NUM_VARS; i++) {
buf[i] = (int *) malloc(bufsize * sizeof(int));
- for (j=0; j<bufsize; j++) buf[i][j] = rand();
+ for (j=0; j<bufsize; j++) buf[i][j] = rank * i + 123 + j;
}
MPI_Barrier(MPI_COMM_WORLD);
diff --git a/examples/C/column_wise.c b/examples/C/column_wise.c
index 97df6c5..7e89e4b 100644
--- a/examples/C/column_wise.c
+++ b/examples/C/column_wise.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: column_wise.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: column_wise.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example makes a number of nonblocking API calls, each writes a single
@@ -60,7 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -88,7 +88,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename = "testfile.nc";
+ char filename[256];
int i, j, verbose=1, rank, nprocs, err, nerrs=0, myNX, G_NX, myOff, num_reqs;
int ncid, cmode, varid, dimid[2], *reqs, *sts, **buf;
MPI_Offset start[2], count[2];
@@ -110,7 +110,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
/* set an MPI-IO hint to disable file offset alignment for fixed-size
* variables */
diff --git a/examples/C/create_open.c b/examples/C/create_open.c
index 24e9521..293dccd 100644
--- a/examples/C/create_open.c
+++ b/examples/C/create_open.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: create_open.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: create_open.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use ncmpi_create() to create a new file and
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -52,7 +52,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, rank, verbose=1, err, nerrs=0;
int ncid, cmode, omode;
@@ -71,7 +71,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
if (verbose && rank == 0) printf("%s: example of file create and open\n",__FILE__);
diff --git a/examples/C/fill_mode.c b/examples/C/fill_mode.c
index 1630eeb..f7ef29a 100644
--- a/examples/C/fill_mode.c
+++ b/examples/C/fill_mode.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: fill_mode.c 2602 2016-11-08 18:55:02Z wkliao $ */
+/* $Id: fill_mode.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use
@@ -57,9 +57,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -109,8 +108,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
- else strcpy(filename, "testfile.nc");
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
diff --git a/examples/C/flexible_api.c b/examples/C/flexible_api.c
index 770a09f..ad8ea41 100644
--- a/examples/C/flexible_api.c
+++ b/examples/C/flexible_api.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: flexible_api.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: flexible_api.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -73,9 +73,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -103,7 +102,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, j, rank, nprocs, verbose=1, err, nerrs=0, req, status, ghost_len=3;
int ncid, cmode, varid0, varid1, dimid[3], *buf_zy;
int array_of_sizes[2], array_of_subsizes[2], array_of_starts[2];
@@ -127,7 +126,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
if (verbose && rank == 0) printf("%s: example of using flexible APIs\n",__FILE__);
diff --git a/examples/C/get_info.c b/examples/C/get_info.c
index ba5514b..0714b57 100644
--- a/examples/C/get_info.c
+++ b/examples/C/get_info.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: get_info.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: get_info.c 2717 2016-12-18 01:20:47Z wkliao $ */
/*
* prints all MPI-IO hints used
@@ -38,7 +38,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -89,7 +89,7 @@ void print_info(MPI_Info *info_used)
int main(int argc, char **argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, rank, ncid, verbose=1, err, nerrs=0;
MPI_Info info_used;
@@ -108,7 +108,8 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
/* create the file */
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER|NC_64BIT_DATA,
diff --git a/examples/C/get_vara.c b/examples/C/get_vara.c
index 4e0e6c3..0d18df3 100644
--- a/examples/C/get_vara.c
+++ b/examples/C/get_vara.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: get_vara.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: get_vara.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example is the read counterpart of example put_vara.c. It shows how to
@@ -55,7 +55,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -86,7 +86,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc", str_att[NC_MAX_NAME];
+ char filename[256], str_att[NC_MAX_NAME];
int i, rank, nprocs, err, nerrs=0, verbose=1, ncid, varid, dimid[2], *buf;
float *float_att;
MPI_Offset len, global_ny, global_nx, local_ny, local_nx;
@@ -108,7 +108,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
/* open an existing file for reading -------------------------------------*/
err = ncmpi_open(MPI_COMM_WORLD, filename, NC_NOWRITE, MPI_INFO_NULL, &ncid);
diff --git a/examples/C/ghost_cell.c b/examples/C/ghost_cell.c
index d89a103..754d8f8 100644
--- a/examples/C/ghost_cell.c
+++ b/examples/C/ghost_cell.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: ghost_cell.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: ghost_cell.c 2717 2016-12-18 01:20:47Z wkliao $ */
/*
* This example shows how to use varm API to write a 2D array buffer with ghost
@@ -69,7 +69,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strlen() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -97,11 +97,11 @@ usage(char *argv0)
int main(int argc, char **argv)
{
extern int optind;
- char *filename="testfile.nc";
- int i, j, rank, nprocs, len, ncid, bufsize, verbose=1, err, nerrs=0;
+ char filename[256];
+ int i, j, rank, nprocs, ncid, bufsize, verbose=1, err, nerrs=0;
int psizes[2], local_rank[2], dimids[2], varid, nghosts;
int *buf, *buf_ptr;
- MPI_Offset gsizes[2], starts[2], counts[2], imap[2];
+ MPI_Offset len, gsizes[2], starts[2], counts[2], imap[2];
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -119,9 +119,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) filename = argv[0]; /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
+
len = 4;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = strtoll(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 4 : len;
/* calculate number of processes along each dimension */
psizes[0] = psizes[1] = 0;
diff --git a/examples/C/global_attributes.c b/examples/C/global_attributes.c
index b09bf4a..51382df 100644
--- a/examples/C/global_attributes.c
+++ b/examples/C/global_attributes.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: global_attributes.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: global_attributes.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example creates a new file and add 2 global attributes, one is of text
@@ -33,7 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strlen(), strcpy() */
+#include <string.h> /* strcpy(), strncpy(), strlen() */
#include <unistd.h> /* getopt() */
#include <time.h> /* time() localtime(), asctime() */
#include <mpi.h>
@@ -65,9 +65,9 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
char str_att[128], att_name[NC_MAX_NAME];
- int i, rank, err, nerrs=0, verbose=0, ncid, cmode, omode, ngatts;
+ int i, rank, err, nerrs=0, verbose=1, ncid, cmode, omode, ngatts;
short short_att[10], digit[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
time_t ltime;
@@ -86,7 +86,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
/* create a new file for writing ----------------------------------------*/
cmode = NC_CLOBBER;
diff --git a/examples/C/hints.c b/examples/C/hints.c
index 0d36fc9..293fc79 100644
--- a/examples/C/hints.c
+++ b/examples/C/hints.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: hints.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: hints.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example sets two PnetCDF hints:
@@ -30,9 +30,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -77,17 +76,17 @@ int print_hints(int ncid,
MPI_Info_get_valuelen(info_used, "nc_header_align_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, "nc_header_align_size", len+1, value, &flag);
- h_align = atoll(value);
+ h_align = strtoll(value,NULL,10);
}
MPI_Info_get_valuelen(info_used, "nc_var_align_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, "nc_var_align_size", len+1, value, &flag);
- v_align = atoll(value);
+ v_align = strtoll(value,NULL,10);
}
MPI_Info_get_valuelen(info_used, "nc_header_read_chunk_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, "nc_header_read_chunk_size", len+1, value,&flag);
- h_chunk = atoll(value);
+ h_chunk = strtoll(value,NULL,10);
}
MPI_Info_free(&info_used);
@@ -115,7 +114,7 @@ int print_hints(int ncid,
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid0, varid1, dimid[3], *buf_zy;
float *buf_yx;
@@ -138,7 +137,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy (filename, "testfile.nc");
MPI_Info_create(&info);
MPI_Info_set(info, "nc_header_align_size", "1024"); /* size in bytes */
diff --git a/examples/C/i_varn_int64.c b/examples/C/i_varn_int64.c
index 964edff..f382aa8 100644
--- a/examples/C/i_varn_int64.c
+++ b/examples/C/i_varn_int64.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: i_varn_int64.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: i_varn_int64.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests nonblocking varn APIs, including
@@ -59,8 +59,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <string.h> /* strcpy() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -87,6 +87,7 @@
static MPI_Offset *** calloc_3D(size_t z, size_t y, size_t x)
{
+ if (z*y*x == 0) return NULL;
int _j, _k;
MPI_Offset ***buf = (MPI_Offset***) malloc(z * sizeof(MPI_Offset**));
MPI_Offset **bufy = (MPI_Offset**) malloc(z*y * sizeof(MPI_Offset*));
@@ -159,7 +160,7 @@ static int check_contents(int ncid, int *varid)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc", exec[256];
+ char filename[256], *exec;
int i, j, k, n, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid[4], dimid[2], nreqs, reqs[4], sts[4];
long long *buffer[4];
@@ -170,7 +171,7 @@ int main(int argc, char** argv)
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- strcpy(exec, argv[0]);
+ exec = argv[0];
/* get command-line arguments */
while ((i = getopt(argc, argv, "hq")) != EOF)
@@ -184,7 +185,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy (filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
printf("Warning: %s is intended to run on 4 processes\n",exec);
diff --git a/examples/C/mput.c b/examples/C/mput.c
index a4eb700..07ebdef 100644
--- a/examples/C/mput.c
+++ b/examples/C/mput.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: mput.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: mput.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use a single call of ncmpi_mput_vara_all() to
@@ -43,9 +43,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -74,7 +73,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid, dimid[2], num_reqs, *buffer, **bufs, *nvarids;
MPI_Offset w_len, **starts=NULL, **counts=NULL, *bufcounts;
@@ -97,7 +96,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
printf("Warning: this program is intended to run on 4 processes\n");
diff --git a/examples/C/nonblocking_write.c b/examples/C/nonblocking_write.c
index 40bd5cd..f43ae21 100644
--- a/examples/C/nonblocking_write.c
+++ b/examples/C/nonblocking_write.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: nonblocking_write.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: nonblocking_write.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* This example is similar to collective_write.c but using nonblocking APIs.
* It creates a netcdf file in CD-5 format and writes a number of
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
int nprocs, len, *buf[NUM_VARS], bufsize, rank;
int gsizes[NDIMS], psizes[NDIMS];
double write_timing, max_write_timing, write_bw;
- char *filename="testfile.nc", str[512];
+ char filename[256], str[512];
int ncid, dimids[NDIMS], varids[NUM_VARS], req[NUM_VARS], st[NUM_VARS];
MPI_Offset starts[NDIMS], counts[NDIMS], write_size, sum_write_size;
MPI_Offset bbufsize;
@@ -114,9 +114,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) filename = argv[0]; /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
+
len = 10;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++) psizes[i] = 0;
@@ -133,11 +136,10 @@ int main(int argc, char **argv)
bufsize *= len;
}
- /* allocate buffer and initialize with random numbers */
- srand(rank);
+ /* allocate buffer and initialize with some non-zero numbers */
for (i=0; i<NUM_VARS; i++) {
buf[i] = (int *) malloc(bufsize * sizeof(int));
- for (j=0; j<bufsize; j++) buf[i][j] = rand();
+ for (j=0; j<bufsize; j++) buf[i][j] = rank * i + 123 + j;
}
MPI_Barrier(MPI_COMM_WORLD);
diff --git a/examples/C/nonblocking_write_in_def.c b/examples/C/nonblocking_write_in_def.c
index 8650192..aa7363d 100644
--- a/examples/C/nonblocking_write_in_def.c
+++ b/examples/C/nonblocking_write_in_def.c
@@ -35,7 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
int nprocs, len, *buf[NUM_VARS], bufsize, rank;
int gsizes[NDIMS], psizes[NDIMS];
double write_timing, max_write_timing, write_bw;
- char *filename="testfile.nc", str[512];
+ char filename[256], str[512];
int ncid, dimids[NDIMS], varids[NUM_VARS];
MPI_Offset start[NDIMS], count[NDIMS], write_size, sum_write_size;
MPI_Offset bbufsize;
@@ -116,9 +116,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) filename = argv[0]; /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
+
len = 10;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++) psizes[i] = 0;
@@ -135,11 +138,10 @@ int main(int argc, char **argv)
bufsize *= len;
}
- /* allocate buffer and initialize with random numbers */
- srand(rank);
+ /* allocate buffer and initialize with some non-zero numbers */
for (i=0; i<NUM_VARS; i++) {
buf[i] = (int *) malloc(bufsize * sizeof(int));
- for (j=0; j<bufsize; j++) buf[i][j] = rand();
+ for (j=0; j<bufsize; j++) buf[i][j] = rank * i + 123 + j;
}
MPI_Barrier(comm);
diff --git a/examples/C/put_vara.c b/examples/C/put_vara.c
index f747f57..1d7d362 100644
--- a/examples/C/put_vara.c
+++ b/examples/C/put_vara.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_vara.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_vara.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use ncmpi_put_vara_int_all() to write a 2D
@@ -55,10 +55,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <time.h> /* time() localtime(), asctime() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -110,8 +109,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
- else strcpy(filename, "testfile.nc");
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
diff --git a/examples/C/put_varn_float.c b/examples/C/put_varn_float.c
index 4504257..18fb81c 100644
--- a/examples/C/put_varn_float.c
+++ b/examples/C/put_varn_float.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_varn_float.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_varn_float.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use a single call of ncmpi_put_varn_float_all()
@@ -35,9 +35,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -65,7 +64,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid, dimid[2], num_reqs;
float *buffer;
@@ -87,9 +86,10 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
- if (nprocs != 4 && rank == 0 && verbose)
+ if (verbose && nprocs != 4 && rank == 0)
printf("Warning: this program is intended to run on 4 processes\n");
/* create a new file for writing ----------------------------------------*/
diff --git a/examples/C/put_varn_int.c b/examples/C/put_varn_int.c
index 1db1015..ae42386 100644
--- a/examples/C/put_varn_int.c
+++ b/examples/C/put_varn_int.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_varn_int.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_varn_int.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use a single call of ncmpi_put_varn_int_all() to
@@ -43,9 +43,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
-#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -73,7 +72,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename="testfile.nc";
+ char filename[256];
int i, j, rank, nprocs, verbose=1, err, nerrs=0;
int ncid, cmode, varid, dimid[2], num_reqs, *buffer;
MPI_Offset w_len, **starts=NULL, **counts=NULL;
@@ -94,7 +93,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
printf("Warning: this program is intended to run on 4 processes\n");
diff --git a/examples/C/req_all.c b/examples/C/req_all.c
index 70edc9d..8011fcf 100644
--- a/examples/C/req_all.c
+++ b/examples/C/req_all.c
@@ -52,7 +52,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -80,7 +80,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char *filename = "testfile.nc";
+ char filename[256];
int i, j, verbose=1, rank, nprocs, err, nerrs=0, myNX, G_NX, myOff;
int ncid, cmode, varid, dimid[2], **buf;
MPI_Offset start[2], count[2];
@@ -102,7 +102,8 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) filename = argv[0]; /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
/* set an MPI-IO hint to disable file offset alignment for fixed-size
* variables */
diff --git a/examples/C/transpose.c b/examples/C/transpose.c
index 749098e..cdc00c0 100644
--- a/examples/C/transpose.c
+++ b/examples/C/transpose.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: transpose.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: transpose.c 2717 2016-12-18 01:20:47Z wkliao $ */
/*
* This example shows how to use varm API to write six 3D integer array
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* strlen() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -61,7 +61,7 @@ usage(char *argv0)
int main(int argc, char **argv)
{
extern int optind;
- char *filename="testfile.nc", str[512];
+ char filename[256], str[512];
int i, j, k, rank, nprocs, len, ncid, bufsize, verbose=1, err, nerrs=0;
int *buf, psizes[NDIMS], dimids[NDIMS], dimidsT[NDIMS];
int XYZ_id, XZY_id, YZX_id, YXZ_id, ZYX_id, ZXY_id;
@@ -85,9 +85,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) filename = argv[0]; /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
+
len = 2;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 2 : len;
for (i=0; i<NDIMS; i++)
psizes[i] = 0;
@@ -115,9 +118,9 @@ int main(int argc, char **argv)
bufsize = 1;
for (i=0; i<NDIMS; i++) {
- gsizes[i] = (len + i) * psizes[i]; /* global array size */
- starts[i] *= (len + i); /* start indices */
- counts[i] = (len + i); /* array elements */
+ gsizes[i] = (MPI_Offset)(len + i) * psizes[i]; /* global array size */
+ starts[i] *= (MPI_Offset)(len + i); /* start indices */
+ counts[i] = (MPI_Offset)(len + i); /* array elements */
bufsize *= (len + i);
}
diff --git a/examples/C/vard_int.c b/examples/C/vard_int.c
index 57e98f7..73a900f 100644
--- a/examples/C/vard_int.c
+++ b/examples/C/vard_int.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: vard_int.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: vard_int.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use the vard API ncmpi_put_vard() and
@@ -44,7 +44,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <string.h>
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -96,8 +96,8 @@ int main(int argc, char **argv) {
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
- else strcpy(filename, "testfile.nc");
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
diff --git a/examples/CXX/Makefile.in b/examples/CXX/Makefile.in
index 5f68a5d..3cb9aca 100644
--- a/examples/CXX/Makefile.in
+++ b/examples/CXX/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2014, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2236 2015-12-18 03:49:41Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -93,31 +93,34 @@ TEST_MPIRUN_8 = $(subst NP,8,$(TEST_MPIRUN))
TEST_MPIRUN_3 = $(subst NP,3,$(TEST_MPIRUN))
ptest4: $(PAR_PROGS)
- @for i in $(PAR_PROGS); do ( \
+ @for i in $(PAR_PROGS); do { \
$(TEST_MPIRUN_4) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C++ parallel run on 4 processes --------------- $$i"; \
else \
echo "FAILED: C++ parallel run on 4 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest8: $(PAR_PROGS)
- @for i in $(PAR_PROGS) ; do ( \
+ @for i in $(PAR_PROGS) ; do { \
$(TEST_MPIRUN_8) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C++ parallel run on 8 processes --------------- $$i"; \
else \
echo "FAILED: C++ parallel run on 8 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest3: $(PAR_PROGS)
- @for i in $(PAR_PROGS) ; do ( \
+ @for i in $(PAR_PROGS) ; do { \
$(TEST_MPIRUN_3) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: C++ parallel run on 3 processes --------------- $$i"; \
else \
echo "FAILED: C++ parallel run on 3 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest: ptest4
ptests: ptest3 ptest4 ptest8
diff --git a/examples/CXX/block_cyclic.cpp b/examples/CXX/block_cyclic.cpp
index ae989ea..76a2d66 100644
--- a/examples/CXX/block_cyclic.cpp
+++ b/examples/CXX/block_cyclic.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: block_cyclic.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: block_cyclic.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example, generalized from column_wise.cpp, makes a number of nonblocking
@@ -72,7 +72,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -102,7 +102,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, j, verbose=1, rank, nprocs, num_reqs;
int *reqs, *sts, **buf;
MPI_Offset myNX, G_NX, myOff, block_start, block_len;
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/collective_write.cpp b/examples/CXX/collective_write.cpp
index 876c08e..ca1b07c 100644
--- a/examples/CXX/collective_write.cpp
+++ b/examples/CXX/collective_write.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: collective_write.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: collective_write.cpp 2717 2016-12-18 01:20:47Z wkliao $ */
/*
* This example mimics the coll_perf.c from ROMIO.
@@ -39,7 +39,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -93,7 +93,7 @@ void print_info(MPI_Info *info_used)
int main(int argc, char **argv)
{
extern int optind;
- char filename[128], str[512];
+ char filename[256], str[512];
int i, j, rank, nprocs, len, bufsize, verbose=1;
int *buf[NUM_VARS], psizes[NDIMS];
double write_timing, max_write_timing, write_bw;
@@ -118,10 +118,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
+
len = 10;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++)
psizes[i] = 0;
@@ -133,17 +135,16 @@ int main(int argc, char **argv)
bufsize = 1;
for (i=0; i<NDIMS; i++) {
- gsizes[i] = len * psizes[i];
+ gsizes[i] = (MPI_Offset)len * psizes[i];
starts[i] *= len;
- counts[i] = len;
+ counts[i] = (MPI_Offset)len;
bufsize *= len;
}
- /* allocate buffer and initialize with random numbers */
- srand(rank);
+ /* allocate buffer and initialize with some non-zero numbers */
for (i=0; i<NUM_VARS; i++) {
buf[i] = (int *) malloc(bufsize * sizeof(int));
- for (j=0; j<bufsize; j++) buf[i][j] = rand();
+ for (j=0; j<bufsize; j++) buf[i][j] = rank * i + 123 + j;
}
MPI_Barrier(MPI_COMM_WORLD);
diff --git a/examples/CXX/column_wise.cpp b/examples/CXX/column_wise.cpp
index 2128f06..7a875df 100644
--- a/examples/CXX/column_wise.cpp
+++ b/examples/CXX/column_wise.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: column_wise.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: column_wise.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example makes a number of nonblocking API calls, each writes a single
@@ -65,7 +65,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -93,7 +93,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, j, verbose=1, rank, nprocs, myNX, G_NX, myOff, num_reqs;
int *reqs, *sts, **buf;
vector<MPI_Offset> start(2), count(2);
@@ -114,7 +114,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/fill_mode.cpp b/examples/CXX/fill_mode.cpp
index c1c648f..774b8a0 100644
--- a/examples/CXX/fill_mode.cpp
+++ b/examples/CXX/fill_mode.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: fill_mode.cpp 2602 2016-11-08 18:55:02Z wkliao $ */
+/* $Id: fill_mode.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use
@@ -63,7 +63,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <time.h> /* time() localtime(), asctime() */
@@ -93,7 +93,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128], str_att[128];
+ char filename[256], str_att[256];
int i, j, verbose=1, rank, nprocs, buf[NY][NX];
MPI_Offset global_ny, global_nx;
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
@@ -134,7 +134,7 @@ int main(int argc, char** argv)
asctime_r(localtime(<ime), str_att);
/* make sure the time string are consistent among all processes */
- MPI_Bcast(str_att, 128, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_Bcast(str_att, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
ncFile.putAtt(string("history"), string(str_att));
diff --git a/examples/CXX/flexible_api.cpp b/examples/CXX/flexible_api.cpp
index d637ecf..c572182 100644
--- a/examples/CXX/flexible_api.cpp
+++ b/examples/CXX/flexible_api.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: flexible_api.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: flexible_api.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -76,7 +76,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -105,7 +105,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, rank, nprocs, verbose=1, ghost_len=3;
int *buf_zy;
float *buf_yx;
@@ -127,7 +127,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/get_info.cpp b/examples/CXX/get_info.cpp
index e595a72..f6fc8f7 100644
--- a/examples/CXX/get_info.cpp
+++ b/examples/CXX/get_info.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: get_info.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: get_info.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/*
* prints all MPI-IO hints used
@@ -42,7 +42,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -87,7 +87,7 @@ void print_info(MPI_Info *info_used)
int main(int argc, char **argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, rank, verbose=1;
MPI_Info info_used;
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/get_vara.cpp b/examples/CXX/get_vara.cpp
index dadbdb7..4896afb 100644
--- a/examples/CXX/get_vara.cpp
+++ b/examples/CXX/get_vara.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: get_vara.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: get_vara.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example is the read counterpart of example put_vara.cpp. It shows how to
@@ -59,7 +59,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -84,7 +84,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128], str_att[NC_MAX_NAME];
+ char filename[256], str_att[NC_MAX_NAME];
int i, rank, nprocs, err, verbose=1;
MPI_Offset len, global_ny, global_nx, local_ny, local_nx;
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/hints.cpp b/examples/CXX/hints.cpp
index de66529..608947d 100644
--- a/examples/CXX/hints.cpp
+++ b/examples/CXX/hints.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: hints.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: hints.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example sets two PnetCDF hints:
@@ -34,7 +34,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -83,17 +83,17 @@ void print_hints(NcmpiFile &ncFile,
MPI_Info_get_valuelen(info_used, (char*)"nc_header_align_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, (char*)"nc_header_align_size", len+1, value, &flag);
- h_align = atoll(value);
+ h_align = strtoll(value,NULL,10);
}
MPI_Info_get_valuelen(info_used, (char*)"nc_var_align_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, (char*)"nc_var_align_size", len+1, value, &flag);
- v_align = atoll(value);
+ v_align = strtoll(value,NULL,10);
}
MPI_Info_get_valuelen(info_used, (char*)"nc_header_read_chunk_size", &len, &flag);
if (flag) {
MPI_Info_get(info_used, (char*)"nc_header_read_chunk_size", len+1, value,&flag);
- h_chunk = atoll(value);
+ h_chunk = strtoll(value,NULL,10);
}
MPI_Info_free(&info_used);
@@ -120,7 +120,7 @@ void print_hints(NcmpiFile &ncFile,
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, rank, nprocs, verbose=1, *buf_zy;
float *buf_yx;
vector<MPI_Offset> start(2), count(2);
@@ -142,7 +142,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
diff --git a/examples/CXX/nonblocking_write.cpp b/examples/CXX/nonblocking_write.cpp
index 1992ef1..1626a09 100644
--- a/examples/CXX/nonblocking_write.cpp
+++ b/examples/CXX/nonblocking_write.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: nonblocking_write.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: nonblocking_write.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* This example is similar to collective_write.c but using nonblocking APIs.
* It creates a netcdf file in CD-5 format and writes a number of
@@ -38,7 +38,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -96,7 +96,7 @@ int main(int argc, char **argv)
int nprocs, len, *buf[NUM_VARS], bufsize, rank;
int gsizes[NDIMS], psizes[NDIMS];
double write_timing, max_write_timing, write_bw;
- char filename[128], str[512];
+ char filename[256], str[512];
int req[NUM_VARS], st[NUM_VARS];
MPI_Offset write_size, sum_write_size;
vector<MPI_Offset> starts(NDIMS), counts(NDIMS);
@@ -119,10 +119,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
+
len = 10;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++) psizes[i] = 0;
@@ -139,11 +141,10 @@ int main(int argc, char **argv)
bufsize *= len;
}
- /* allocate buffer and initialize with random numbers */
- srand(rank);
+ /* allocate buffer and initialize with some non-zero numbers */
for (i=0; i<NUM_VARS; i++) {
buf[i] = (int *) malloc(bufsize * sizeof(int));
- for (j=0; j<bufsize; j++) buf[i][j] = rand();
+ for (j=0; j<bufsize; j++) buf[i][j] = rank * i + 123 + j;
}
MPI_Barrier(MPI_COMM_WORLD);
diff --git a/examples/CXX/put_vara.cpp b/examples/CXX/put_vara.cpp
index 6312ef0..43b9151 100644
--- a/examples/CXX/put_vara.cpp
+++ b/examples/CXX/put_vara.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_vara.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_vara.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use NcmpiVar::putVar_all() to write a 2D
@@ -58,7 +58,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <time.h> /* time() localtime(), asctime() */
@@ -88,7 +88,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128], str_att[128];
+ char filename[256], str_att[256];
int i, j, verbose=1, rank, nprocs, buf[NY][NX];
float float_att[100];
MPI_Offset global_ny, global_nx;
@@ -109,7 +109,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
try {
@@ -130,7 +130,7 @@ int main(int argc, char** argv)
asctime_r(localtime(<ime), str_att);
/* make sure the time string are consistent among all processes */
- MPI_Bcast(str_att, 128, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_Bcast(str_att, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
ncFile.putAtt(string("history"), string(str_att));
diff --git a/examples/CXX/put_varn_float.cpp b/examples/CXX/put_varn_float.cpp
index af6c743..d98161e 100644
--- a/examples/CXX/put_varn_float.cpp
+++ b/examples/CXX/put_varn_float.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_varn_float.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_varn_float.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use a single call of NcmpiVar::putVarn_all()
@@ -39,7 +39,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -68,7 +68,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, verbose=1, rank, nprocs, num_reqs;
float *buffer;
MPI_Offset **starts=NULL;
@@ -89,7 +89,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
diff --git a/examples/CXX/put_varn_int.cpp b/examples/CXX/put_varn_int.cpp
index 23c9ee6..d3d4c8e 100644
--- a/examples/CXX/put_varn_int.cpp
+++ b/examples/CXX/put_varn_int.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: put_varn_int.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: put_varn_int.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use a single call of NcmpiVar::putVarn_all() to
@@ -47,7 +47,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -76,7 +76,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, j, rank, nprocs, verbose=1;
int num_reqs, *buffer;
MPI_Offset w_len, **starts=NULL, **counts=NULL;
@@ -97,7 +97,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
if (nprocs != 4 && rank == 0 && verbose)
diff --git a/examples/CXX/transpose.cpp b/examples/CXX/transpose.cpp
index 4c820fa..e498fb0 100644
--- a/examples/CXX/transpose.cpp
+++ b/examples/CXX/transpose.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: transpose.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: transpose.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/*
* This example shows how to use varm API to write six 3D integer array
@@ -35,7 +35,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strlen() */
+#include <string.h> /* strlen(), strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -71,7 +71,7 @@ usage(char *argv0)
int main(int argc, char **argv)
{
extern int optind;
- char filename[128], str[512];
+ char filename[256], str[512];
int i, j, k, rank, nprocs, len, bufsize, verbose=1;
int *buf, psizes[NDIMS];
vector<MPI_Offset> gsizes(NDIMS), starts(NDIMS), counts(NDIMS), imap(NDIMS);
@@ -93,10 +93,12 @@ int main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (argc >= 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc >= 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
+
len = 2;
- if (argc >= 2) len = atoi(argv[1]); /* optional argument */
+ if (argc >= 2) len = (int)strtol(argv[1],NULL,10); /* optional argument */
+ len = (len <= 0) ? 10 : len;
for (i=0; i<NDIMS; i++)
psizes[i] = 0;
diff --git a/examples/CXX/vard_int.cpp b/examples/CXX/vard_int.cpp
index b2a94c4..71453e7 100644
--- a/examples/CXX/vard_int.cpp
+++ b/examples/CXX/vard_int.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: vard_int.cpp 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: vard_int.cpp 2728 2016-12-18 17:49:20Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use the vard API ncmpi_put_vard() and
@@ -48,7 +48,7 @@
#include <iostream>
using namespace std;
-#include <string.h> /* strcpy() */
+#include <string.h> /* strcpy(), strncpy() */
#include <unistd.h> /* getopt() */
#include <pnetcdf>
@@ -76,7 +76,7 @@ usage(char *argv0)
int main(int argc, char** argv)
{
extern int optind;
- char filename[128];
+ char filename[256];
int i, j, verbose=1;
int rank, nprocs, array_of_blocklengths[2], buf[NY][NX];
int array_of_sizes[2], array_of_subsizes[2], array_of_starts[2];
@@ -100,7 +100,7 @@ int main(int argc, char** argv)
}
argc -= optind;
argv += optind;
- if (argc == 1) strcpy(filename, argv[0]); /* optional argument */
+ if (argc == 1) snprintf(filename, 256, "%s", argv[0]);
else strcpy(filename, "testfile.nc");
vector <MPI_Offset> start(2), count(2);
diff --git a/examples/F77/Makefile.in b/examples/F77/Makefile.in
index edd25b0..59d29c4 100644
--- a/examples/F77/Makefile.in
+++ b/examples/F77/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2477 2016-09-06 01:16:50Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -98,31 +98,34 @@ TEST_MPIRUN_8 = $(subst NP,8,$(TEST_MPIRUN))
TEST_MPIRUN_3 = $(subst NP,3,$(TEST_MPIRUN))
ptest4: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_4) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F77 parallel run on 4 processes --------------- $$i"; \
else \
echo "FAILED: F77 parallel run on 4 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest8: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_8) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F77 parallel run on 8 processes --------------- $$i"; \
else \
echo "FAILED: F77 parallel run on 8 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest3: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_3) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F77 parallel run on 3 processes --------------- $$i"; \
else \
echo "FAILED: F77 parallel run on 3 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest: ptest4
ptests: ptest3 ptest4 ptest8
diff --git a/examples/F90/Makefile.in b/examples/F90/Makefile.in
index e5736fc..b4a0b38 100644
--- a/examples/F90/Makefile.in
+++ b/examples/F90/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2236 2015-12-18 03:49:41Z wkliao $
+# $Id: Makefile.in 2698 2016-12-11 20:02:52Z wkliao $
#
# @configure_input@
@@ -86,31 +86,34 @@ TEST_MPIRUN_8 = $(subst NP,8,$(TEST_MPIRUN))
TEST_MPIRUN_3 = $(subst NP,3,$(TEST_MPIRUN))
ptest4: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_4) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F90 parallel run on 4 processes --------------- $$i"; \
else \
echo "FAILED: F90 parallel run on 4 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest8: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_8) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F90 parallel run on 8 processes --------------- $$i"; \
else \
echo "FAILED: F90 parallel run on 8 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest3: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_3) ./$$i -q $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: F90 parallel run on 3 processes --------------- $$i"; \
else \
echo "FAILED: F90 parallel run on 3 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest: ptest4
ptests: ptest3 ptest4 ptest8
diff --git a/examples/tutorial/Makefile.in b/examples/tutorial/Makefile.in
index 8043ad4..1b9b7ad 100644
--- a/examples/tutorial/Makefile.in
+++ b/examples/tutorial/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2318 2016-02-04 00:18:26Z wkliao $
+# $Id: Makefile.in 2742 2016-12-28 16:22:17Z wkliao $
#
# @configure_input@
@@ -89,7 +89,7 @@ pnetcdf-write-bufferedf: pnetcdf-write-bufferedf.o $(LIBRARY)
$(LINK.F90) $< $(F90LDFLAGS) $(LIBS)
pnetcdf-write-bufferedf77: pnetcdf-write-bufferedf77.o $(LIBRARY)
- $(LINK.F77) $< $(FLDFLAGS) $(LIBS)
+ $(LINK.F90) $< $(FLDFLAGS) $(LIBS)
pnetcdf-permute: pnetcdf-permute.o $(LIBRARY)
$(LINK.c) $< $(LDFLAGS) $(LIBS)
@@ -97,13 +97,14 @@ pnetcdf-permute: pnetcdf-permute.o $(LIBRARY)
TEST_MPIRUN_4 = $(subst NP,4,$(TEST_MPIRUN))
ptest4: $(PROGS)
- @for i in $(PROGS); do ( \
+ @for i in $(PROGS); do { \
$(TEST_MPIRUN_4) ./$$i $(TEST_OUTDIR)/testfile.nc ; \
if [ $$? = 0 ] ; then \
echo "PASS: parallel run on 4 processes --------------- $$i"; \
else \
echo "FAILED: parallel run on 4 processes ------------- $$i"; \
- fi ; ) ; done
+ exit 1; \
+ fi ; } ; done
ptest: ptest4
ptests: ptest4
diff --git a/examples/tutorial/pnetcdf-read-from-master.c b/examples/tutorial/pnetcdf-read-from-master.c
index 983504c..3c01090 100644
--- a/examples/tutorial/pnetcdf-read-from-master.c
+++ b/examples/tutorial/pnetcdf-read-from-master.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: pnetcdf-read-from-master.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: pnetcdf-read-from-master.c 2670 2016-12-03 17:25:10Z wkliao $ */
/* simple demonstration of pnetcdf
* text attribute on dataset
@@ -45,16 +45,25 @@
#define MPI_OFFSET MPI_LONG_LONG_INT
#endif
-static void handle_error(int status, int lineno)
+#define MPI_ERR(err) { \
+ if (err != MPI_SUCCESS) { \
+ char err_string[MPI_MAX_ERROR_STRING+1]; \
+ int err_len; \
+ MPI_Error_string(err, err_string, &err_len); \
+ fprintf(stderr, "Rank %d: Error at line %d (%s)\n",rank,__LINE__,err_string); \
+ } \
+}
+
+static void handle_error(int err, int lineno)
{
- fprintf(stderr, "Error at line %d: %s\n", lineno, ncmpi_strerror(status));
+ fprintf(stderr, "Error at line %d: %s\n", lineno, ncmpi_strerror(err));
MPI_Abort(MPI_COMM_WORLD, 1);
}
int main(int argc, char **argv) {
- int i, j=0, rank, nprocs, ret;
+ int i, j=0, rank, nprocs, err;
int ncfile, ndims, nvars, ngatts, unlimited, var_ndims, var_natts;;
int dimids[NC_MAX_VAR_DIMS];
char varname[NC_MAX_NAME+1];
@@ -74,17 +83,17 @@ int main(int argc, char **argv) {
}
if (rank == 0) {
- ret = ncmpi_open(MPI_COMM_SELF, argv[1],
+ err = ncmpi_open(MPI_COMM_SELF, argv[1],
NC_NOWRITE, MPI_INFO_NULL, &ncfile);
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ if (err != NC_NOERR) handle_error(err, __LINE__);
/* reader knows nothing about dataset, but we can interrogate with
* query routines: ncmpi_inq tells us how many of each kind of
* "thing" (dimension, variable, attribute) we will find in the
* file */
- ret = ncmpi_inq(ncfile, &ndims, &nvars, &ngatts, &unlimited);
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ err = ncmpi_inq(ncfile, &ndims, &nvars, &ngatts, &unlimited);
+ if (err != NC_NOERR) handle_error(err, __LINE__);
/* we do not really need the name of the dimension or the variable
* for reading in this example. we could, in a different example,
@@ -95,28 +104,30 @@ int main(int argc, char **argv) {
/* netcdf dimension identifiers are allocated sequentially starting
* at zero; same for variable identifiers */
for(i=0; i<ndims; i++) {
- ret = ncmpi_inq_dimlen(ncfile, i, &(dim_sizes[i]) );
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ err = ncmpi_inq_dimlen(ncfile, i, &(dim_sizes[i]) );
+ if (err != NC_NOERR) handle_error(err, __LINE__);
}
}
/* need to inform other MPI processors how many variables we will send */
- MPI_Bcast(&nvars, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&nvars, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
for(i=0; i<nvars; i++) {
/* rank 0 will find out the size of each variable, read it, and
* broadcast it to the rest of the processors */
if (rank == 0) {
- ret = ncmpi_inq_var(ncfile, i, varname, &type, &var_ndims, dimids,
+ err = ncmpi_inq_var(ncfile, i, varname, &type, &var_ndims, dimids,
&var_natts);
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ if (err != NC_NOERR) handle_error(err, __LINE__);
for (j=0, var_size=1; j<var_ndims; j++) {
var_size *= dim_sizes[dimids[j]];
}
}
/* oddity: there's no predefined MPI_Offset type */
- MPI_Bcast(&var_size, 1, MPI_OFFSET, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&var_size, 1, MPI_OFFSET, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
data = (int*) calloc(var_size, sizeof(int));
@@ -131,8 +142,8 @@ int main(int argc, char **argv) {
* data is quite small, but almost always the underlying
* MPI-IO library can do a better job */
- ret = ncmpi_get_var_int_all(ncfile, j, data);
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ err = ncmpi_get_var_int_all(ncfile, j, data);
+ if (err != NC_NOERR) handle_error(err, __LINE__);
break;
default:
/* we can do this for all the known netcdf types but this
@@ -142,7 +153,8 @@ int main(int argc, char **argv) {
}
/*and finally all processors have the data */
- MPI_Bcast(data, var_size, MPI_INT, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(data, var_size, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
/* Here, every process can do computation on the local buffer, data,
or copy the contents to somewhere else */
@@ -151,8 +163,8 @@ int main(int argc, char **argv) {
}
if (rank == 0) {
- ret = ncmpi_close(ncfile);
- if (ret != NC_NOERR) handle_error(ret, __LINE__);
+ err = ncmpi_close(ncfile);
+ if (err != NC_NOERR) handle_error(err, __LINE__);
free(dim_sizes);
}
diff --git a/examples/tutorial/pnetcdf-write-from-master.c b/examples/tutorial/pnetcdf-write-from-master.c
index d4add24..5f840e1 100644
--- a/examples/tutorial/pnetcdf-write-from-master.c
+++ b/examples/tutorial/pnetcdf-write-from-master.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: pnetcdf-write-from-master.c 2245 2015-12-20 18:39:52Z wkliao $ */
+/* $Id: pnetcdf-write-from-master.c 2640 2016-11-18 21:08:08Z wkliao $ */
/* simple demonstration of pnetcdf
* text attribute on dataset
@@ -48,7 +48,7 @@ static void handle_error(int status, int lineno)
}
int main(int argc, char **argv) {
- int ret, ncfile, nprocs, rank, dimid, varid1, varid2, ndims=1;
+ int ret, ncid=0, nprocs, rank, dimid, varid1=0, varid2=0, ndims=1;
MPI_Offset start, count=1;
char buf[13] = "Hello World\n";
int *data=NULL;
@@ -66,22 +66,22 @@ int main(int argc, char **argv) {
if (rank == 0) {
ret = ncmpi_create(MPI_COMM_SELF, argv[1],
- NC_CLOBBER|NC_64BIT_OFFSET, MPI_INFO_NULL, &ncfile);
+ NC_CLOBBER|NC_64BIT_OFFSET, MPI_INFO_NULL, &ncid);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_def_dim(ncfile, "d1", nprocs, &dimid);
+ ret = ncmpi_def_dim(ncid, "d1", nprocs, &dimid);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_def_var(ncfile, "v1", NC_INT, ndims, &dimid, &varid1);
+ ret = ncmpi_def_var(ncid, "v1", NC_INT, ndims, &dimid, &varid1);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_def_var(ncfile, "v2", NC_INT, ndims, &dimid, &varid2);
+ ret = ncmpi_def_var(ncid, "v2", NC_INT, ndims, &dimid, &varid2);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_put_att_text(ncfile, NC_GLOBAL, "string", 13, buf);
+ ret = ncmpi_put_att_text(ncid, NC_GLOBAL, "string", 13, buf);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_enddef(ncfile);
+ ret = ncmpi_enddef(ncid);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
/* first reason this approach is not scalable: need to allocate
@@ -100,13 +100,13 @@ int main(int argc, char **argv) {
* amount of data is quite small, but almost always the underlying
* MPI-IO library can do a better job */
start=0, count=nprocs;
- ret = ncmpi_put_vara_int_all(ncfile, varid1, &start, &count, data);
+ ret = ncmpi_put_vara_int_all(ncid, varid1, &start, &count, data);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_put_vara_int_all(ncfile, varid2, &start, &count, data);
+ ret = ncmpi_put_vara_int_all(ncid, varid2, &start, &count, data);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
- ret = ncmpi_close(ncfile);
+ ret = ncmpi_close(ncid);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
free(data);
diff --git a/examples/tutorial/pnetcdf-write-nb.c b/examples/tutorial/pnetcdf-write-nb.c
index a639213..39be571 100644
--- a/examples/tutorial/pnetcdf-write-nb.c
+++ b/examples/tutorial/pnetcdf-write-nb.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: pnetcdf-write-nb.c 2388 2016-03-31 16:08:41Z wkliao $ */
+/* $Id: pnetcdf-write-nb.c 2717 2016-12-18 01:20:47Z wkliao $ */
/* simple demonstration of pnetcdf
* text attribute on dataset
@@ -36,10 +36,12 @@
}
*/
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h> /* strncpy() */
+#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
-#include <stdio.h>
static void handle_error(int status, int lineno)
{
@@ -50,7 +52,7 @@ static void handle_error(int status, int lineno)
int main(int argc, char **argv) {
int ret, ncfile, nprocs, rank, dimid, varid1, varid2, ndims=1;
- char buf[13] = "Hello World\n";
+ char filename[256], buf[13] = "Hello World\n";
int data1, data2, requests[2], statuses[2];
MPI_Offset start, count=1;
MPI_Info info;
@@ -69,7 +71,9 @@ int main(int argc, char **argv) {
MPI_Info_create(&info);
MPI_Info_set(info, "nc_var_align_size", "1");
- ret = ncmpi_create(MPI_COMM_WORLD, argv[1],
+ snprintf(filename, 256, "%s", argv[1]);
+
+ ret = ncmpi_create(MPI_COMM_WORLD, filename,
NC_CLOBBER|NC_64BIT_OFFSET, info, &ncfile);
if (ret != NC_NOERR) handle_error(ret, __LINE__);
diff --git a/macros.make.in b/macros.make.in
index dfc784d..dbbf188 100644
--- a/macros.make.in
+++ b/macros.make.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: macros.make.in 2615 2016-11-13 23:58:41Z wkliao $
+# $Id: macros.make.in 2745 2016-12-28 17:02:41Z wkliao $
#
# @configure_input@
#
@@ -20,17 +20,25 @@ LN_S = @LN_S@
# Installation Directories:
# SRCDIR = @SRCDIR@
prefix = @prefix@
-INCDIR = $(prefix)/include
-LIBDIR = $(prefix)/lib
-BINDIR = $(prefix)/bin
-MANDIR = $(prefix)/man
BUILDDIR = @BUILDDIR@
LIBRARY = @BUILDDIR@/src/lib/libpnetcdf.a
+ifdef DESTDIR
+INCDIR = $(DESTDIR)/$(prefix)/include
+LIBDIR = $(DESTDIR)/$(prefix)/lib
+BINDIR = $(DESTDIR)/$(prefix)/bin
+MANDIR = $(DESTDIR)/$(prefix)/share/man
+else
+INCDIR = $(prefix)/include
+LIBDIR = $(prefix)/lib
+BINDIR = $(prefix)/bin
+MANDIR = $(prefix)/share/man
+endif
# Useful tools
M4 = @M4@
M4FLAGS = @M4FLAGS@ -I at abs_top_srcdir@/scripts -DPNETCDF
+M4FFLAGS = @M4FFLAGS@ -I at abs_top_srcdir@/scripts -DPNETCDF
EGREP = @EGREP@
# AC_PROG_SED and AC_PROG_GREP are only available on autoconf 2.60 and later
diff --git a/pnetcdf-config.in b/pnetcdf-config.in
index 0f70e87..f44c498 100644
--- a/pnetcdf-config.in
+++ b/pnetcdf-config.in
@@ -49,19 +49,20 @@ FCLIBS="@FCLIBS@"
F90LIBS="@F90LIBS@"
FLDFLAGS="@FLDFLAGS@"
F90LDFLAGS="@F90LDFLAGS@"
-LDFLAGS="@LDFLAGS@ -L${libdir}"
+LDFLAGS="@LDFLAGS@"
LIBS="@LIBS@"
version="@PACKAGE_NAME@ @PNETCDF_VERSION@"
CC=${MPICC}
F77=${MPIF77}
F90=${MPIF90}
-CFLAGS="-I${includedir} ${CFLAGS}"
-LIBS="-lpnetcdf ${LIBS}"
has_fortran="@has_fortran@"
has_cxx="@has_mpicxx@"
+config_date="@CONFIG_DATE@"
+release_date="@PNETCDF_RELEASE_DATE@"
+
usage()
{
cat <<EOF
@@ -85,7 +86,7 @@ Available values for OPTION include:
--f90 Fortran 90 compiler
--f90flags Fortran 90 compiler flags
--ldflags Linker options
- --libs library linking information for PnetCDF
+ --libs Libraries used to build PnetCDF
--relax-coord-bound Whether using a relaxed coordinate boundary check
--in-place-swap Whether using buffer in-place Endianness byte swap
--erange-fill Whether using fill values for NC_ERANGE error
@@ -95,6 +96,8 @@ Available values for OPTION include:
--includedir Include directory
--libdir Library directory
--version Library version
+ --release-date Date of PnetCDF source was released
+ --config-date Date of PnetCDF library was configured
EOF
exit $1
}
@@ -159,6 +162,8 @@ fi
echo " --includedir -> $includedir"
echo " --libdir -> $libdir"
echo " --version -> $version"
+ echo " --release-date -> $release_date"
+ echo " --config-date -> $config_date"
}
if test $# -eq 0; then
@@ -308,6 +313,14 @@ else
fi
;;
+ --release-date)
+ echo "$release_date"
+ ;;
+
+ --config-date)
+ echo "$config_date"
+ ;;
+
*)
echo "unknown option: $1"
usage 1
diff --git a/rules.make b/rules.make
index 6261fb0..e21bbf3 100644
--- a/rules.make
+++ b/rules.make
@@ -1,4 +1,4 @@
-# $Id: rules.make 2624 2016-11-15 23:10:00Z wkliao $
+# $Id: rules.make 2650 2016-11-24 02:55:40Z wkliao $
# The purpose of this file is to contain common make(1) rules.
# It should be processed by every execution of the that utility.
@@ -57,13 +57,13 @@
$(M4) $(M4FLAGS) $< >$@
.m4.F:
- $(M4) $(M4FLAGS) $< >$@
+ $(M4) $(M4FFLAGS) $< >$@
.m4.f90:
- $(M4) $(M4FLAGS) $< >$@
+ $(M4) $(M4FFLAGS) $< >$@
.m4.F90:
- $(M4) $(M4FLAGS) $< >$@
+ $(M4) $(M4FFLAGS) $< >$@
################################################################################
diff --git a/scripts/utils.m4 b/scripts/utils.m4
index 7bbc8bc..ea94bb8 100644
--- a/scripts/utils.m4
+++ b/scripts/utils.m4
@@ -86,10 +86,11 @@ define(`ArgKind', `ifelse(
dnl
dnl arguments passed to a function for APIs of different kinds
dnl
-define(`ArgStartCount', `ifelse(
- `$1', `', `NULL, NULL',
- `$1', `1', `start, NULL',
- `start, count')')dnl
+define(`ArgStartCountStride', `ifelse(
+ `$1', `', `NULL, NULL, NULL',
+ `$1', `1', `start, NULL, NULL',
+ `$1', `a', `start, count, NULL',
+ `start, count, stride')')dnl
dnl
define(`ArgStrideMap', `ifelse(
`$1', `s', `stride, NULL',
diff --git a/src/Makefile.in b/src/Makefile.in
index ed50fc2..6efc3a8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2285 2015-12-30 20:48:25Z wkliao $
+# $Id: Makefile.in 2676 2016-12-05 03:11:14Z wkliao $
#
# @configure_input@
@@ -19,28 +19,34 @@ ifeq (@has_fortran@, yes)
OPT_DIRS += libf
OPT_DIRS += libf90
endif
-SUBDIRS = lib utils $(OPT_DIRS)
+OBJ_SUBDIRS = lib $(OPT_DIRS)
+
+SUBDIRS = $(OBJ_SUBDIRS) utils
PACKING_LIST = Makefile.in
PACKING_SUBDIRS = lib libcxx libf libf90 utils
-all: $(SUBDIRS) library
-$(SUBDIRS):
- $(MAKE) $(MFLAGS) -C $@
+all: $(OBJ_SUBDIRS) library utils
+
+$(OBJ_SUBDIRS):
+ $(MAKE) $(MFLAGS) -C $@ objs
-library: $(SUBDIRS)
- @set -e; for i in $(OPT_DIRS); do ( $(MAKE) $(MFLAGS) -C $$i library; ) ; done
+library: $(OBJ_SUBDIRS)
+ @set -e; for i in $(OBJ_SUBDIRS); do ( $(MAKE) $(MFLAGS) -C $$i library; ) ; done
# utils must be built after lib
-utils: lib
+utils: library
+ $(MAKE) $(MFLAGS) -C utils
+
+INSTALL_SUBDIRS = $(SUBDIRS)
-INSTALLDIRS = $(SUBDIRS:%=install-%)
+INSTALLDIRS = $(INSTALL_SUBDIRS:%=install-%)
install: $(INSTALLDIRS)
$(INSTALLDIRS): all
$(MAKE) $(MFLAGS) -C $(@:install-%=%) install
-UNINSTALLDIRS = $(SUBDIRS:%=uninstall-%)
+UNINSTALLDIRS = $(INSTALL_SUBDIRS:%=uninstall-%)
uninstall: $(UNINSTALLDIRS)
$(UNINSTALLDIRS):
$(MAKE) $(MFLAGS) -C $(@:uninstall-%=%) uninstall
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 079e7aa..b1fb33e 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2614 2016-11-12 19:50:02Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -93,6 +93,12 @@ DIST_GARBAGE = ncconfig.h pnetcdf.h
all: $(LIBRARY)
+objs: $(LIB_OBJS)
+
+library:
+ $(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
+ $(RANLIB) $(LIBRARY)
+
$(LIBRARY): $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
$(RANLIB) $(LIBRARY)
diff --git a/src/lib/attr.m4 b/src/lib/attr.m4
index 49ed74d..9ebf467 100644
--- a/src/lib/attr.m4
+++ b/src/lib/attr.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: attr.m4 2589 2016-10-30 17:42:43Z wkliao $ */
+/* $Id: attr.m4 2722 2016-12-18 06:20:38Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -105,11 +105,11 @@ ncmpii_new_x_NC_attr(NC_string *strp,
/*----< ncmpii_new_NC_attr() >------------------------------------------------*/
/*
- * Formerly
-NC_new_attr(name,type,count,value)
+ * IN: name is an already normalized attribute name (NULL terminated)
+ * OUT: attrp->xvalue is malloc-ed with a space of an aligned size
*/
static NC_attr *
-ncmpii_new_NC_attr(const char *name, /* normalized attribute name (NULL terminated) */
+ncmpii_new_NC_attr(const char *name,
nc_type type,
MPI_Offset nelems)
{
@@ -226,7 +226,7 @@ incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
assert(ncap != NULL);
- if(ncap->nalloc == 0)
+ if (ncap->nalloc == 0)
{
assert(ncap->ndefined == 0);
vp = (NC_attr **) NCI_Malloc(sizeof(NC_attr*) * NC_ARRAY_GROWBY);
@@ -235,7 +235,7 @@ incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
ncap->value = vp;
ncap->nalloc = NC_ARRAY_GROWBY;
}
- else if(ncap->ndefined +1 > ncap->nalloc)
+ else if (ncap->ndefined +1 > ncap->nalloc)
{
vp = (NC_attr **) NCI_Realloc(ncap->value,
(size_t)(ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_attr*));
@@ -245,7 +245,7 @@ incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
ncap->nalloc += NC_ARRAY_GROWBY;
}
- if(newelemp != NULL)
+ if (newelemp != NULL)
{
ncap->value[ncap->ndefined] = newelemp;
ncap->ndefined++;
@@ -258,7 +258,7 @@ static NC_attr *
elem_NC_attrarray(const NC_attrarray *ncap, MPI_Offset elem)
{
assert(ncap != NULL);
- if((elem < 0) || ncap->ndefined == 0 || elem >= ncap->ndefined)
+ if ((elem < 0) || ncap->ndefined == 0 || elem >= ncap->ndefined)
return NULL;
assert(ncap->value != NULL);
@@ -308,7 +308,7 @@ ncmpii_NC_findattr(const NC_attrarray *ncap,
*/
for (i=0; i<ncap->ndefined; i++) {
- if (ncap->value[i]->name->nchars == nchars &&
+ if (ncap->value[i]->name->nchars == (MPI_Offset)nchars &&
strncmp(ncap->value[i]->name->cp, name, nchars) == 0) {
return i;
}
@@ -652,7 +652,7 @@ ncmpi_copy_att(int ncid_in,
char *nname=NULL; /* normalized name */
NC *ncp_in, *ncp_out;
NC_attrarray *ncap_out=NULL, *ncap_in;
- NC_attr *iattrp, *attrp=NULL;
+ NC_attr *iattrp=NULL, *attrp=NULL;
err = ncmpii_NC_check_id(ncid_in, &ncp_in);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
@@ -660,6 +660,12 @@ ncmpi_copy_att(int ncid_in,
err = ncmpii_NC_check_id(ncid_out, &ncp_out);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
+ /* check whether file's write permission */
+ if (NC_readonly(ncp_out)) {
+ DEBUG_ASSIGN_ERROR(err, NC_EPERM)
+ goto err_check;
+ }
+
ncap_in = NC_attrarray0(ncp_in, varid_in);
if (ncap_in == NULL) {
DEBUG_ASSIGN_ERROR(err, NC_ENOTVAR)
@@ -695,15 +701,13 @@ ncmpi_copy_att(int ncid_in,
goto err_check;
}
- /* check whether file's write permission */
- if (NC_readonly(ncp_out)) {
- DEBUG_ASSIGN_ERROR(err, NC_EPERM)
- goto err_check;
- }
-
indx = ncmpii_NC_findattr(ncap_out, nname);
- if (indx >= 0) { /* name in use in ncid_out */
+ if (indx >= 0) { /* name in use in ncap_out */
+ if (ncid_in == ncid_out && varid_in == varid_out)
+ /* self copy is not considered an error */
+ goto err_check;
+
if (!NC_indef(ncp_out) && /* not allowed in data mode */
iattrp->xsz > ncap_out->value[indx]->xsz) {
DEBUG_ASSIGN_ERROR(err, NC_ENOTINDEFINE)
@@ -711,7 +715,8 @@ ncmpi_copy_att(int ncid_in,
}
}
else { /* attribute does not exit in ncid_out */
- if (!NC_indef(ncp_out)) { /* add new attribute is not allowed in data mode */
+ if (!NC_indef(ncp_out)) {
+ /* add new attribute is not allowed in data mode */
DEBUG_ASSIGN_ERROR(err, NC_ENOTINDEFINE)
goto err_check;
}
@@ -771,6 +776,12 @@ err_check:
assert(nname != NULL);
if (indx >= 0) { /* name in use in ncid_out */
+ if (ncid_in == ncid_out && varid_in == varid_out) {
+ /* self copy is not considered an error */
+ free(nname);
+ return NC_NOERR;
+ }
+
/* reuse existing attribute array slot without redef */
attrp = ncap_out->value[indx];
@@ -831,11 +842,19 @@ ncmpi_del_att(int ncid,
err = ncmpii_NC_check_id(ncid, &ncp);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
+ /* check whether file's write permission */
+ if (NC_readonly(ncp)) {
+ DEBUG_ASSIGN_ERROR(err, NC_EPERM)
+ goto err_check;
+ }
+
+ /* must in define mode */
if (!NC_indef(ncp)) {
DEBUG_ASSIGN_ERROR(err, NC_ENOTINDEFINE)
goto err_check;
}
+ /* check NC_ENOTVAR */
ncap = NC_attrarray0(ncp, varid);
if (ncap == NULL) {
DEBUG_ASSIGN_ERROR(err, NC_ENOTVAR)
@@ -972,7 +991,7 @@ ncmpi_get_att_text(int ncid,
NC_attrarray *ncap=NULL;
const void *xp;
- /* get the file ID */
+ /* get the file ID (check NC_EBADID) */
err = ncmpii_NC_check_id(ncid, &ncp);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
@@ -1023,7 +1042,7 @@ ncmpi_get_att_$1(int ncid,
const void *xp;
MPI_Offset nelems;
- /* get the file ID */
+ /* get the file ID (check NC_EBADID) */
err = ncmpii_NC_check_id(ncid, &ncp);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
@@ -1038,6 +1057,7 @@ ncmpi_get_att_$1(int ncid,
nname = (char *)ncmpii_utf8proc_NFC((const unsigned char *)name);
if (nname == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
+ /* whether the attr exists (check NC_ENOTATT) */
err = NC_lookupattr(ncap, nname, &attrp);
free(nname);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
@@ -1053,6 +1073,7 @@ ncmpi_get_att_$1(int ncid,
xp = attrp->xvalue;
switch(attrp->type) {
+ /* possible error returned n this switch block is NC_ERANGE */
case NC_BYTE:
ifelse(`$1',`uchar',
`if (ncp->format < 5) { /* no NC_ERANGE check */
@@ -1081,6 +1102,7 @@ ncmpi_get_att_$1(int ncid,
case NC_CHAR:
return NC_ECHAR; /* NC_ECHAR already checked earlier */
default:
+ /* this error is unlikely, but an internal error if happened */
fprintf(stderr, "Error: bad attrp->type(%d) in %s\n",
attrp->type,__func__);
return NC_EBADTYPE;
@@ -1190,7 +1212,7 @@ ncmpi_put_att_$1(int ncid,
NC_attr *attrp=NULL;
ifelse(`$1',`text', `nc_type xtype=NC_CHAR;')
- /* get the pointer to NC object */
+ /* get the pointer to NC object (check NC_EBADID) */
err = ncmpii_NC_check_id(ncid, &ncp);
if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
@@ -1207,6 +1229,31 @@ ncmpi_put_att_$1(int ncid,
goto err_check;
}
+ if (name == NULL || *name == 0 || strlen(name) > NC_MAX_NAME) {
+ DEBUG_ASSIGN_ERROR(err, NC_EBADNAME)
+ goto err_check;
+ }
+
+ /* check if the attribute name is legal (check for NC_EBADNAME) */
+ err = ncmpii_NC_check_name(name, ncp->format);
+ if (err != NC_NOERR) {
+ DEBUG_TRACE_ERROR
+ goto err_check;
+ }
+
+ ifelse(`$1',`text', ,`/* check if xtype is valid (check for NC_EBADTYPE) */
+ err = ncmpii_cktype(ncp->format, xtype);
+ if (err != NC_NOERR) {
+ DEBUG_TRACE_ERROR
+ goto err_check;
+ }')
+
+ ifelse(`$1',`text', , `/* No character conversions are allowed. */
+ if (xtype == NC_CHAR) {
+ DEBUG_ASSIGN_ERROR(err, NC_ECHAR)
+ goto err_check;
+ }')
+
/* Should CDF-5 allow very large file header? */
/*
if (len > X_INT_MAX) {
@@ -1221,11 +1268,6 @@ ncmpi_put_att_$1(int ncid,
goto err_check;
}
- if (name == NULL || *name == 0 || strlen(name) > NC_MAX_NAME) {
- DEBUG_ASSIGN_ERROR(err, NC_EBADNAME)
- goto err_check;
- }
-
/* If this is the _FillValue attribute, then let PnetCDF return the
* same error codes as netCDF
*/
@@ -1257,26 +1299,6 @@ ncmpi_put_att_$1(int ncid,
goto err_check;
}
- ifelse(`$1',`text', ,`/* check if xtype is valid */
- err = ncmpii_cktype(ncp->format, xtype);
- if (err != NC_NOERR) {
- DEBUG_TRACE_ERROR
- goto err_check;
- }')
-
- ifelse(`$1',`text', , `/* No character conversions are allowed. */
- if (xtype == NC_CHAR) {
- DEBUG_ASSIGN_ERROR(err, NC_ECHAR)
- goto err_check;
- }')
-
- /* check if the attribute name is legal */
- err = ncmpii_NC_check_name(name, ncp->format);
- if (err != NC_NOERR) {
- DEBUG_TRACE_ERROR
- goto err_check;
- }
-
xsz = ncmpix_len_NC_attrV(xtype, nelems);
/* xsz is the total size of this attribute */
@@ -1298,13 +1320,15 @@ ncmpi_put_att_$1(int ncid,
if (indx >= 0) { /* name in use */
/* xsz is the total size of this attribute */
if (!NC_indef(ncp) && xsz > ncap->value[indx]->xsz) {
- /* new attribute requires a larger space, not allowed in data mode */
+ /* The new attribute requires a larger space, which is not allowed
+ * in data mode */
DEBUG_ASSIGN_ERROR(err, NC_ENOTINDEFINE)
goto err_check;
}
}
else { /* attribute does not exit in ncid */
- if (!NC_indef(ncp)) { /* add new attribute is not allowed in data mode */
+ if (!NC_indef(ncp)) {
+ /* add new attribute is not allowed in data mode */
DEBUG_ASSIGN_ERROR(err, NC_ENOTINDEFINE)
goto err_check;
}
@@ -1431,14 +1455,16 @@ err_check:
if (nelems != 0 && buf != NULL) { /* non-zero length attribute */
/* using xp below to prevent change the pointer attr->xvalue, as
* ncmpix_pad_putn_<type>() advances the first argument with nelems
- * elements
+ * elements. Note that attrp->xvalue is malloc-ed with a buffer of
+ * size that is aligned with a 4-byte boundary.
*/
void *xp = attrp->xvalue;
+ ifelse(`$1',`text',,`dnl
unsigned char fill[8]; /* fill value in internal representation */
/* find the fill value */
err = ncmpii_inq_default_fill_value(xtype, &fill);
- if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)')
ifelse(`$1',`text', `err = ncmpix_pad_putn_text(&xp, nelems, buf);',
`$1',`uchar',`
diff --git a/src/lib/bput.m4 b/src/lib/bput.m4
index 2a1a62b..102b478 100644
--- a/src/lib/bput.m4
+++ b/src/lib/bput.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: bput.m4 2559 2016-10-16 20:47:09Z wkliao $ */
+/* $Id: bput.m4 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -32,13 +32,13 @@ int
ncmpi_buffer_attach(int ncid,
MPI_Offset bufsize)
{
- int status;
+ int err;
NC *ncp;
if (bufsize <= 0) DEBUG_RETURN_ERROR(NC_ENULLBUF)
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if the buffer has been previously attached
* note that in nc.c, the NC object is allocated with calloc, so
@@ -62,11 +62,11 @@ ncmpi_buffer_attach(int ncid,
int
ncmpi_buffer_detach(int ncid)
{
- int i, status;
+ int i, err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if the buffer has been previously attached */
if (ncp->abuf == NULL) DEBUG_RETURN_ERROR(NC_ENULLABUF)
@@ -97,11 +97,11 @@ ncmpi_buffer_detach(int ncid,
void *bufptr,
MPI_Offset *bufsize)
{
- int i, status;
+ int i, err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if the buffer has been previously attached */
if (ncp->abuf == NULL) DEBUG_RETURN_ERROR(NC_ENULLABUF)
@@ -131,11 +131,11 @@ int
ncmpi_inq_buffer_usage(int ncid,
MPI_Offset *usage) /* OUT: in bytes */
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if the buffer has been previously attached */
if (ncp->abuf == NULL) DEBUG_RETURN_ERROR(NC_ENULLABUF)
@@ -151,11 +151,11 @@ int
ncmpi_inq_buffer_size(int ncid,
MPI_Offset *buf_size) /* OUT: in bytes */
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if the buffer has been previously attached */
if (ncp->abuf == NULL) DEBUG_RETURN_ERROR(NC_ENULLABUF)
@@ -179,20 +179,19 @@ define(`BPUT_API',dnl
int
APINAME($1,$2)(int ncid, int varid, ArgKind($1) BufArgs(`put',$2), int *reqid)
{
- int status;
+ int err;
NC *ncp;
NC_var *varp=NULL;
ifelse(`$1', `', `MPI_Offset *start, *count;',
`$1', `1', `MPI_Offset *count;')
if (reqid != NULL) *reqid = NC_REQ_NULL;
- status = ncmpii_sanity_check(ncid, varid, ArgStartCount($1),
- ifelse(`$2', `', `bufcount', `0'),
- ifelse(`$2', `', `buftype', `ITYPE2MPI($2)'),
- API_KIND($1), ifelse(`$2', `', `1', `0'),
- 0, WRITE_REQ,
- NONBLOCKING_IO, &ncp, &varp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_sanity_check(ncid, varid, ArgStartCountStride($1),
+ ifelse(`$2', `', `bufcount', `0'),
+ ifelse(`$2', `', `buftype', `ITYPE2MPI($2)'),
+ API_KIND($1), ifelse(`$2', `', `1', `0'),
+ 0, WRITE_REQ, NONBLOCKING_IO, &ncp, &varp);
+ if (err != NC_NOERR) return err;
if (ncp->abuf == NULL) DEBUG_RETURN_ERROR(NC_ENULLABUF)
@@ -200,13 +199,13 @@ APINAME($1,$2)(int ncid, int varid, ArgKind($1) BufArgs(`put',$2), int *reqid)
`$1', `1', `GET_ONE_COUNT(count)')
/* APINAME($1,$2) is a special case of APINAME(m,$2) */
- status = ncmpii_igetput_varm(ncp, varp, start, count, ArgStrideMap($1),
- (void*)buf,
- ifelse(`$2', `', `bufcount, buftype',
- `-1, ITYPE2MPI($2)'),
- reqid, WRITE_REQ, 1, 0);
+ err = ncmpii_igetput_varm(ncp, varp, start, count, ArgStrideMap($1),
+ (void*)buf,
+ ifelse(`$2', `', `bufcount, buftype',
+ `-1, ITYPE2MPI($2)'),
+ reqid, WRITE_REQ, 1, 0);
ifelse(`$1', `', `NCI_Free(start);', `$1', `1', `NCI_Free(count);')
- return status;
+ return err;
}
')dnl
dnl
diff --git a/src/lib/depend b/src/lib/depend
index 4679e00..fdeea73 100644
--- a/src/lib/depend
+++ b/src/lib/depend
@@ -28,5 +28,5 @@ i_getput.o: i_getput.c ncconfig.h nc.h pnetcdf.h ncio.h fbits.h ncx.h rnd.h ncty
subfile.o: subfile.c ncconfig.h subfile.h pnetcdf.h nc.h ncio.h fbits.h macro.h ncmpidtype.h
vard.o: vard.c ncconfig.h pnetcdf.h nc.h ncio.h fbits.h rnd.h ncx.h nctypes.h macro.h ncmpidtype.h
fill.o: fill.c nc.h ncio.h pnetcdf.h fbits.h macro.h
-util.o: util.c nc.h ncio.h pnetcdf.h fbits.h macro.h
+util.o: util.c nc.h ncio.h pnetcdf.h fbits.h macro.h ncx.h
hash_func.o: hash_func.c nc.h ncio.h pnetcdf.h fbits.h
diff --git a/src/lib/dim.c b/src/lib/dim.c
index d67cfed..c8e9ed2 100644
--- a/src/lib/dim.c
+++ b/src/lib/dim.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: dim.c 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: dim.c 2684 2016-12-07 18:58:55Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -367,7 +367,7 @@ ncmpi_def_dim(int ncid, /* IN: file ID */
/* check if ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* must be called in define mode */
if (!NC_indef(ncp)) {
@@ -530,7 +530,7 @@ ncmpi_inq_dimid(int ncid,
NC *ncp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (name == NULL || *name == 0 || strlen(name) > NC_MAX_NAME)
DEBUG_RETURN_ERROR(NC_EBADNAME)
@@ -553,12 +553,12 @@ ncmpi_inq_dim(int ncid,
char *name,
MPI_Offset *sizep)
{
- int status;
+ int err;
NC *ncp=NULL;
NC_dim *dimp=NULL;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(status)
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
dimp = ncmpii_elem_NC_dimarray(&ncp->dims, dimid);
if (dimp == NULL) DEBUG_RETURN_ERROR(NC_EBADDIM)
@@ -615,7 +615,7 @@ ncmpi_rename_dim(int ncid,
/* check whether ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check file's write permission */
if (NC_readonly(ncp)) {
diff --git a/src/lib/error.c b/src/lib/error.c
index 9fdd9ee..ff92284 100644
--- a/src/lib/error.c
+++ b/src/lib/error.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: error.c 2604 2016-11-09 16:10:48Z wkliao $ */
+/* $Id: error.c 2639 2016-11-18 15:06:10Z wkliao $ */
/*LINTLIBRARY*/
@@ -630,14 +630,14 @@ nc_strerror(int ncerr1)
const char *
ncmpi_strerrno(int err)
{
- static char unknown_str[32];
+ static char unknown_str[64];
if (err > 0) { /* system error */
const char *cp = (const char *) strerror(err);
if (cp == NULL)
sprintf(unknown_str,"Unknown error code %d",err);
else
- sprintf(unknown_str,"Error code %d (%s)",err,cp);
+ sprintf(unknown_str,"System error code %d (%s)",err,cp);
return unknown_str;
}
diff --git a/src/lib/fill.c b/src/lib/fill.c
index 3c4b59e..b06d57d 100644
--- a/src/lib/fill.c
+++ b/src/lib/fill.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: fill.c 2609 2016-11-11 01:11:45Z wkliao $ */
+/* $Id: fill.c 2722 2016-12-18 06:20:38Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -230,7 +230,7 @@ ncmpi_fill_var_rec(int ncid,
/* check if ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check file's write permission */
if (NC_readonly(ncp)) {
@@ -317,7 +317,7 @@ ncmpi_set_fill(int ncid,
/* check whether ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check whether file's write permission */
if (NC_readonly(ncp)) {
@@ -386,7 +386,7 @@ ncmpi_def_var_fill(int ncid,
/* check whether ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check whether file's write permission */
if (NC_readonly(ncp)) {
@@ -520,7 +520,7 @@ ncmpii_inq_var_fill(NC_var *varp,
/* Check if _FillValue is defined for this variable */
attrs = &varp->attrs;
for (i=0; i<attrs->ndefined; i++) {
- if (attrs->value[i]->name->nchars == nchars &&
+ if (attrs->value[i]->name->nchars == (MPI_Offset)nchars &&
strncmp(attrs->value[i]->name->cp, "_FillValue", nchars) == 0) {
memcpy(fill_value, attrs->value[i]->xvalue, (size_t)varp->xsz);
return NC_NOERR;
diff --git a/src/lib/getput.m4 b/src/lib/getput.m4
index 0f35d1a..25b3c49 100644
--- a/src/lib/getput.m4
+++ b/src/lib/getput.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: getput.m4 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: getput.m4 2724 2016-12-18 06:26:38Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -33,7 +33,7 @@ dnl
/*----< ncmpii_calc_datatype_elems() >---------------------------------------*/
-/* check NC_ECHAR and obtain the following metadata about buftype:
+/* obtain the following metadata about buftype:
* ptype: element data type (MPI primitive type) in buftype
* bufcount: If it is -1, then this is called from a high-level API and in
* this case buftype will be an MPI primitive data type. If not -1, then this
@@ -46,12 +46,8 @@ dnl
* buftype_is_contig: whether buftype is contiguous
*/
int
-ncmpii_calc_datatype_elems(NC *ncp,
- NC_var *varp,
- const MPI_Offset *start,
+ncmpii_calc_datatype_elems(NC_var *varp,
const MPI_Offset *count,
- const MPI_Offset *stride,
- int rw_flag,
MPI_Datatype buftype,
MPI_Datatype *ptype, /* out */
MPI_Offset *bufcount, /* in/out */
@@ -63,29 +59,21 @@ ncmpii_calc_datatype_elems(NC *ncp,
int i, err=NC_NOERR;
MPI_Offset fnelems;
- /* In netCDF, error code reporting priority is NC_ECHAR, NC_EINVALCOORDS,
- * NC_EEDGE, NC_ESTRIDE
+ /* Sanity check for error codes should have already done before reaching
+ * here
+ *
+ * when (*bufcount == -1), same as if (IsPrimityMPIType(buftype)),
+ * it means this subroutine is called from a high-level API.
*/
- if (*bufcount == -1) { /* same as if (IsPrimityMPIType(buftype)) */
- /* this subroutine is called from a high-level API */
- err = NCMPII_ECHAR(varp->type, buftype);
- if (err != NC_NOERR) return err;
- }
- else if (buftype != MPI_DATATYPE_NULL) {
+ if (*bufcount != -1 && buftype != MPI_DATATYPE_NULL) {
/* This subroutine is called from a flexible API */
int isderived;
+ /* check MPI derived datatype error */
err = ncmpii_dtype_decode(buftype, ptype, el_size, bnelems,
&isderived, buftype_is_contig);
if (err != NC_NOERR) return err;
-
- err = NCMPII_ECHAR(varp->type, *ptype);
- if (err != NC_NOERR) return err;
}
- /* check whether start, count, and stride are valid */
- err = NC_start_count_stride_ck(ncp, varp, start, count, stride, rw_flag);
- if (err != NC_NOERR) return err;
-
/* fnelems is the total number of nc_type elements calculated from
* count[]. count[] is the access count to the variable defined in
* the netCDF file.
@@ -321,7 +309,7 @@ ncmpii_getput_varm(NC *ncp,
}
#endif
- /* check NC_ECHAR error and calculate the followings:
+ /* calculate the followings:
* ptype: element data type (MPI primitive type) in buftype
* bufcount: If it is -1, then this is called from a high-level API and in
* this case buftype will be an MPI primitive data type. If not, then this
@@ -333,7 +321,7 @@ ncmpii_getput_varm(NC *ncp,
* el_size: size of ptype
* buftype_is_contig: whether buftype is contiguous
*/
- err = ncmpii_calc_datatype_elems(ncp, varp, start, count, stride, rw_flag,
+ err = ncmpii_calc_datatype_elems(varp, count,
buftype, &ptype, &bufcount, &bnelems,
&nbytes, &el_size, &buftype_is_contig);
if (err == NC_EIOMISMATCH) DEBUG_ASSIGN_ERROR(warning, err)
@@ -705,19 +693,35 @@ define(`GETPUT_API',dnl
int
APINAME($1,$2,$3,$4)(int ncid, int varid, ArgKind($2) BufArgs($1,$3))
{
- int status;
+ int err, status;
NC *ncp;
NC_var *varp=NULL;
ifelse(`$2', `', `MPI_Offset *start, *count;',
`$2', `1', `MPI_Offset *count;')
- status = ncmpii_sanity_check(ncid, varid, ArgStartCount($2),
+ status = ncmpii_sanity_check(ncid, varid, ArgStartCountStride($2),
ifelse(`$3', `', `bufcount', `0'),
ifelse(`$3', `', `buftype', `ITYPE2MPI($3)'),
API_KIND($2), ifelse(`$3', `', `1', `0'),
1, ReadWrite($1),
CollIndep($4), &ncp, &varp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) {
+ if (CollIndep($4) == INDEP_IO ||
+ status == NC_EBADID ||
+ status == NC_EPERM ||
+ status == NC_EINDEFINE ||
+ status == NC_EINDEP ||
+ status == NC_ENOTINDEP)
+ return status; /* fatal error, cannot continue */
+
+ /* for collective API, participate the collective I/O with zero-length
+ * request for this process */
+ err = ncmpii_getput_zero_req(ncp, ReadWrite($1));
+ assert(err == NC_NOERR);
+
+ /* return the error code from sanity check */
+ return status;
+ }
ifelse(`$2', `', `GET_FULL_DIMENSIONS(start, count)',
`$2', `1', `GET_ONE_COUNT(count)')
diff --git a/src/lib/header.c b/src/lib/header.c
index 941bea7..1dfc568 100644
--- a/src/lib/header.c
+++ b/src/lib/header.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: header.c 2590 2016-10-31 21:37:02Z wkliao $ */
+/* $Id: header.c 2657 2016-11-27 22:11:00Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -426,22 +426,22 @@ hdr_put_NC_name(bufferinfo *pbp,
* NON_NEG = <non-negative INT> | // CDF-1 and CDF-2
* <non-negative INT64> // CDF-5
*/
- int status;
+ int err;
/* copy nelems */
if (pbp->version == 5)
- status = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)ncstrp->nchars);
+ err = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)ncstrp->nchars);
else {
- if (ncstrp->nchars != (uint)ncstrp->nchars) DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
- status = ncmpix_put_uint32((void**)(&pbp->pos), (uint)ncstrp->nchars);
+ if (ncstrp->nchars != (uint)ncstrp->nchars)
+ DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
+ err = ncmpix_put_uint32((void**)(&pbp->pos), (uint)ncstrp->nchars);
}
- if (status != NC_NOERR) return status;
+ if (err != NC_NOERR) return err;
/* copy namestring */
- status = ncmpix_pad_putn_text(&pbp->pos, ncstrp->nchars, ncstrp->cp);
- if (status != NC_NOERR) return status;
+ err = ncmpix_pad_putn_text(&pbp->pos, ncstrp->nchars, ncstrp->cp);
- return NC_NOERR;
+ return err;
}
/*----< hdr_put_NC_attrV() >-------------------------------------------------*/
@@ -478,9 +478,11 @@ hdr_put_NC_attrV(bufferinfo *pbp,
memcpy(pbp->pos, attrp->xvalue, (size_t)sz);
pbp->pos = (void *)((char *)pbp->pos + sz);
- /* zero-padding is per buffer, not per element */
- memset(pbp->pos, 0, (size_t)padding);
- pbp->pos = (void *)((char *)pbp->pos + padding);
+ if (padding > 0) {
+ /* zero-padding is per buffer, not per element */
+ memset(pbp->pos, 0, (size_t)padding);
+ pbp->pos = (void *)((char *)pbp->pos + padding);
+ }
return NC_NOERR;
}
@@ -497,23 +499,22 @@ hdr_put_NC_dim(bufferinfo *pbp,
* NON_NEG = <non-negative INT> | // CDF-1 and CDF-2
* <non-negative INT64> // CDF-5
*/
- int status;
+ int err;
/* copy name */
- status = hdr_put_NC_name(pbp, dimp->name);
- if (status != NC_NOERR) return status;
+ err = hdr_put_NC_name(pbp, dimp->name);
+ if (err != NC_NOERR) return err;
/* copy dim_length */
if (pbp->version == 5)
- status = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)dimp->size);
+ err = ncmpix_put_uint64((void**)(&pbp->pos), (uint64)dimp->size);
else {
/* TODO: Isn't checking dimension size already done in def_dim()? */
if (dimp->size != (uint)dimp->size) DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
- status = ncmpix_put_uint32((void**)(&pbp->pos), (uint)dimp->size);
+ err = ncmpix_put_uint32((void**)(&pbp->pos), (uint)dimp->size);
}
- if (status != NC_NOERR) return status;
- return NC_NOERR;
+ return err;
}
/*----< hdr_put_NC_dimarray() >----------------------------------------------*/
@@ -1042,7 +1043,7 @@ hdr_get_nc_type(bufferinfo *gbp,
type != NC_INT64 &&
type != NC_UINT64
)
- DEBUG_RETURN_ERROR(NC_EINVAL)
+ DEBUG_RETURN_ERROR(NC_EBADTYPE)
*typep = (nc_type) type;
return NC_NOERR;
@@ -1086,24 +1087,24 @@ hdr_get_NC_name(bufferinfo *gbp,
* NON_NEG = <non-negative INT> | // CDF-1 and CDF-2
* <non-negative INT64> // CDF-5
*/
- int status;
- MPI_Offset nchars, nbytes, padding, bufremain, strcount;
+ int err;
+ char *cpos;
NC_string *ncstrp;
- char *cpos, pad[X_ALIGN-1];
MPI_Aint pos_addr, base_addr;
+ MPI_Offset nchars, nbytes, padding, bufremain, strcount;
/* get nelems */
if (gbp->version == 5) {
uint64 tmp;
- status = hdr_get_uint64(gbp, &tmp);
+ err = hdr_get_uint64(gbp, &tmp);
nchars = (MPI_Offset)tmp;
}
else {
uint tmp;
- status = hdr_get_uint32(gbp, &tmp);
+ err = hdr_get_uint32(gbp, &tmp);
nchars = (MPI_Offset)tmp;
}
- if (status != NC_NOERR) return status;
+ if (err != NC_NOERR) return err;
/* Allocate a NC_string structure large enough to hold nchars characters */
ncstrp = ncmpii_new_NC_string((size_t)nchars, NULL);
@@ -1126,7 +1127,8 @@ hdr_get_NC_name(bufferinfo *gbp,
while (nbytes > 0) {
if (bufremain > 0) {
strcount = MIN(bufremain, nbytes);
- if (strcount != (size_t)strcount) DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
+ if (strcount != (size_t)strcount)
+ DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
memcpy(cpos, gbp->pos, (size_t)strcount);
nbytes -= strcount;
gbp->pos = (void *)((char *)gbp->pos + strcount);
@@ -1134,10 +1136,10 @@ hdr_get_NC_name(bufferinfo *gbp,
cpos += strcount;
bufremain -= strcount;
} else {
- status = hdr_fetch(gbp);
- if (status != NC_NOERR) {
+ err = hdr_fetch(gbp);
+ if (err != NC_NOERR) {
ncmpii_free_NC_string(ncstrp);
- return status;
+ return err;
}
bufremain = gbp->size;
}
@@ -1145,8 +1147,13 @@ hdr_get_NC_name(bufferinfo *gbp,
/* handle the padding */
if (padding > 0) {
+ /* CDF specification: Header padding uses null (\x00) bytes. */
+ char pad[X_ALIGN-1];
memset(pad, 0, X_ALIGN-1);
if (memcmp(gbp->pos, pad, (size_t)padding) != 0) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header non-zero padding found\n",__FILE__,__func__,__LINE__);
+#endif
ncmpii_free_NC_string(ncstrp);
DEBUG_RETURN_ERROR(NC_EINVAL)
}
@@ -1251,10 +1258,19 @@ hdr_get_NC_dimarray(bufferinfo *gbp,
ncap->unlimited_id = -1;
if (ndefined == 0) {
- if (type != NC_DIMENSION && type != NC_UNSPECIFIED)
+ if (type != NC_DIMENSION && type != NC_UNSPECIFIED) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_DIMENSION\n",__FILE__,__func__,__LINE__);
+#endif
DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
} else {
- if (type != NC_DIMENSION) DEBUG_RETURN_ERROR(NC_EINVAL)
+ if (type != NC_DIMENSION) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_DIMENSION\n",__FILE__,__func__,__LINE__);
+#endif
+ DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
ncap->value = (NC_dim **) NCI_Malloc((size_t)ndefined * sizeof(NC_dim*));
if (ncap->value == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
@@ -1295,9 +1311,7 @@ hdr_get_NC_attrV(bufferinfo *gbp,
* doubles = [DOUBLE ...]
* padding = <0, 1, 2, or 3 bytes to next 4-byte boundary>
*/
- int status;
void *value = attrp->xvalue;
- char pad[X_ALIGN-1];
MPI_Offset nbytes, padding, bufremain, attcount;
MPI_Aint pos_addr, base_addr;
@@ -1316,7 +1330,8 @@ hdr_get_NC_attrV(bufferinfo *gbp,
while (nbytes > 0) {
if (bufremain > 0) {
attcount = MIN(bufremain, nbytes);
- if (attcount != (size_t)attcount) DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
+ if (attcount != (size_t)attcount)
+ DEBUG_RETURN_ERROR(NC_EINTOVERFLOW)
memcpy(value, gbp->pos, (size_t)attcount);
nbytes -= attcount;
gbp->pos = (void *)((char *)gbp->pos + attcount);
@@ -1324,16 +1339,24 @@ hdr_get_NC_attrV(bufferinfo *gbp,
value = (void *)((char *)value + attcount);
bufremain -= attcount;
} else {
- status = hdr_fetch(gbp);
- if (status != NC_NOERR) return status;
+ int err;
+ err = hdr_fetch(gbp);
+ if (err != NC_NOERR) return err;
bufremain = gbp->size;
}
}
/* handle the padding */
if (padding > 0) {
+ /* CDF specification: Header padding uses null (\x00) bytes. */
+ char pad[X_ALIGN-1];
memset(pad, 0, X_ALIGN-1);
- if (memcmp(gbp->pos, pad, (size_t)padding) != 0) DEBUG_RETURN_ERROR(NC_EINVAL)
+ if (memcmp(gbp->pos, pad, (size_t)padding) != 0) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header non-zero padding found\n",__FILE__,__func__,__LINE__);
+#endif
+ DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
gbp->pos = (void *)((char *)gbp->pos + padding);
gbp->index += padding;
}
@@ -1450,10 +1473,19 @@ hdr_get_NC_attrarray(bufferinfo *gbp,
ncap->ndefined = (int)ndefined;
if (ndefined == 0) {
- if (type != NC_ATTRIBUTE && type != NC_UNSPECIFIED)
+ if (type != NC_ATTRIBUTE && type != NC_UNSPECIFIED) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_ATTRIBUTE\n",__FILE__,__func__,__LINE__);
+#endif
DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
} else {
- if (type != NC_ATTRIBUTE) DEBUG_RETURN_ERROR(NC_EINVAL)
+ if (type != NC_ATTRIBUTE) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_ATTRIBUTE\n",__FILE__,__func__,__LINE__);
+#endif
+ DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
ncap->value = (NC_attr **)NCI_Malloc((size_t)ndefined * sizeof(NC_attr*));
if (ncap->value == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
@@ -1674,10 +1706,19 @@ hdr_get_NC_vararray(bufferinfo *gbp,
* of ndefined from int to MPI_Offset */
if (ndefined == 0) { /* no variable defined */
- if (type != NC_VARIABLE && type != NC_UNSPECIFIED)
+ if (type != NC_VARIABLE && type != NC_UNSPECIFIED) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_VARIABLE\n",__FILE__,__func__,__LINE__);
+#endif
DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
} else {
- if (type != NC_VARIABLE) DEBUG_RETURN_ERROR(NC_EINVAL)
+ if (type != NC_VARIABLE) {
+#ifdef PNETCDF_DEBUG
+ fprintf(stderr,"Error in file %s func %s line %d: NetCDF header format for NC_VARIABLE\n",__FILE__,__func__,__LINE__);
+#endif
+ DEBUG_RETURN_ERROR(NC_EINVAL)
+ }
ncap->value = (NC_var **) NCI_Malloc((size_t)ndefined * sizeof(NC_var*));
if (ncap->value == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
@@ -2406,10 +2447,10 @@ ncmpii_hdr_check_NC(bufferinfo *getbuf, /* header from root */
#endif
/* overwrite the local header object with root's */
- if (ncp->format == 5) fClr(ncp->flags, NC_64BIT_DATA);
+ if (ncp->format == 5) fClr(ncp->flags, NC_64BIT_DATA);
else if (ncp->format == 2) fClr(ncp->flags, NC_64BIT_OFFSET);
- if (root_ver == 5) fSet(ncp->flags, NC_64BIT_DATA);
+ if (root_ver == 5) fSet(ncp->flags, NC_64BIT_DATA);
else if (root_ver == 2) fSet(ncp->flags, NC_64BIT_OFFSET);
/* this inconsistency is not fatal */
@@ -2557,8 +2598,14 @@ int ncmpii_write_header(NC *ncp)
if (NC_indep(ncp))
fh = ncp->nciop->independent_fh;
+ /* update file header size, as this subroutine may be called from a rename
+ * API (var or attribute) and the new name is smaller/bigger which changes
+ * the header size. We recalculate ncp->xsz by getting the un-aligned size
+ * occupied by the file header */
+ ncp->xsz = ncmpii_hdr_len_NC(ncp);
+
MPI_Comm_rank(ncp->nciop->comm, &rank);
- if (rank == 0) {
+ if (rank == 0) { /* only root writes to file header */
MPI_Status mpistatus;
void *buf = NCI_Malloc((size_t)ncp->xsz); /* header's write buffer */
@@ -2595,9 +2642,6 @@ int ncmpii_write_header(NC *ncp)
}
}
- /* update file header size */
- ncp->xsz = ncmpii_hdr_len_NC(ncp);
-
if (NC_doFsync(ncp)) { /* NC_SHARE is set */
TRACE_IO(MPI_File_sync)(fh);
if (mpireturn != MPI_SUCCESS) {
diff --git a/src/lib/i_getput.m4 b/src/lib/i_getput.m4
index f6d6b6c..9c4a686 100644
--- a/src/lib/i_getput.m4
+++ b/src/lib/i_getput.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: i_getput.m4 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: i_getput.m4 2723 2016-12-18 06:21:12Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -147,7 +147,7 @@ ncmpii_igetput_varm(NC *ncp,
MPI_Datatype ptype, imaptype=MPI_DATATYPE_NULL;
NC_req *req;
- /* check NC_ECHAR error and calculate the followings:
+ /* calculate the followings:
* ptype: element data type (MPI primitive type) in buftype
* bufcount: If it is -1, then this is called from a high-level API and in
* this case buftype will be an MPI primitive data type. If not, then this
@@ -159,7 +159,7 @@ ncmpii_igetput_varm(NC *ncp,
* el_size: size of ptype
* buftype_is_contig: whether buftype is contiguous
*/
- err = ncmpii_calc_datatype_elems(ncp, varp, start, count, stride, rw_flag,
+ err = ncmpii_calc_datatype_elems(varp, count,
buftype, &ptype, &bufcount, &bnelems,
&nbytes, &el_size, &buftype_is_contig);
if (err == NC_EIOMISMATCH) DEBUG_ASSIGN_ERROR(warning, err)
@@ -478,7 +478,7 @@ APINAME($1,$2,$3)(int ncid, int varid, ArgKind($2) BufArgs($1,$3), int *reqid)
`$2', `1', `MPI_Offset *count;')
if (reqid != NULL) *reqid = NC_REQ_NULL;
- status = ncmpii_sanity_check(ncid, varid, ArgStartCount($2),
+ status = ncmpii_sanity_check(ncid, varid, ArgStartCountStride($2),
ifelse(`$3', `', `bufcount', `0'),
ifelse(`$3', `', `buftype', `ITYPE2MPI($3)'),
API_KIND($2), ifelse(`$2', `', `1', `0'),
diff --git a/src/lib/i_varn.m4 b/src/lib/i_varn.m4
index bd5b75e..1927797 100644
--- a/src/lib/i_varn.m4
+++ b/src/lib/i_varn.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: i_varn.m4 2559 2016-10-16 20:47:09Z wkliao $ */
+/* $Id: i_varn.m4 2664 2016-12-02 00:50:43Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -50,17 +50,17 @@ include(`utils.m4')
*/
static int
-ncmpii_igetput_varn(NC *ncp,
- NC_var *varp,
- int num,
- MPI_Offset* const starts[], /* [num][varp->ndims] */
- MPI_Offset* const counts[], /* [num][varp->ndims] */
- void *buf,
- MPI_Offset bufcount,
- MPI_Datatype buftype, /* data type of the bufer */
- int *reqid,
- int rw_flag,
- int use_abuf);
+ncmpii_igetput_varn(NC *ncp,
+ NC_var *varp,
+ int num,
+ MPI_Offset* const *starts, /* [num][varp->ndims] */
+ MPI_Offset* const *counts, /* [num][varp->ndims] */
+ void *buf,
+ MPI_Offset bufcount,
+ MPI_Datatype buftype, /* data type of the bufer */
+ int *reqid,
+ int rw_flag,
+ int use_abuf);
dnl
define(`IsBput', `ifelse(`$1',`bput', `1', `0')')dnl
@@ -75,8 +75,8 @@ int
ncmpi_$1_varn(int ncid,
int varid,
int num,
- MPI_Offset* const starts[],
- MPI_Offset* const counts[],
+ MPI_Offset* const *starts,
+ MPI_Offset* const *counts,
BufConst($1) void *buf,
MPI_Offset bufcount,
MPI_Datatype buftype,
@@ -91,9 +91,9 @@ ncmpi_$1_varn(int ncid,
/* check for zero-size request */
if (num == 0 || bufcount == 0) return NC_NOERR;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARN, 1,
- 0, ReadWrite($1), NONBLOCKING_IO, &ncp, &varp);
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARN, 1, 0, ReadWrite($1),
+ NONBLOCKING_IO, &ncp, &varp);
if (status != NC_NOERR) return status;
return ncmpii_igetput_varn(ncp, varp, num, starts, counts, (void*)buf,
@@ -117,8 +117,8 @@ int
ncmpi_$1_varn_$2(int ncid,
int varid,
int num,
- MPI_Offset* const starts[],
- MPI_Offset* const counts[],
+ MPI_Offset* const *starts,
+ MPI_Offset* const *counts,
BufConst($1) $3 *buf,
int *reqid)
{
@@ -131,9 +131,9 @@ ncmpi_$1_varn_$2(int ncid,
/* check for zero request */
if (num == 0) return NC_NOERR;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, 0, ITYPE2MPI($2),
- API_VARN, 0,
- 0, ReadWrite($1), NONBLOCKING_IO, &ncp, &varp);
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, 0,
+ ITYPE2MPI($2), API_VARN, 0, 0, ReadWrite($1),
+ NONBLOCKING_IO, &ncp, &varp);
if (status != NC_NOERR) return status;
/* set bufcount to -1 indicating non-flexible API */
@@ -149,17 +149,17 @@ foreach(`putget', (iput, iget, bput),
/*----< ncmpii_igetput_varn() >-----------------------------------------------*/
static int
-ncmpii_igetput_varn(NC *ncp,
- NC_var *varp,
- int num,
- MPI_Offset* const starts[], /* [num][varp->ndims] */
- MPI_Offset* const counts[], /* [num][varp->ndims] */
- void *buf,
- MPI_Offset bufcount,
- MPI_Datatype buftype, /* data type of the bufer */
- int *reqidp, /* OUT: request ID */
- int rw_flag, /* WRITE_REQ or READ_REQ */
- int use_abuf) /* if use attached buffer */
+ncmpii_igetput_varn(NC *ncp,
+ NC_var *varp,
+ int num,
+ MPI_Offset* const *starts, /* [num][varp->ndims] */
+ MPI_Offset* const *counts, /* [num][varp->ndims] */
+ void *buf,
+ MPI_Offset bufcount,
+ MPI_Datatype buftype, /* data type of the bufer */
+ int *reqidp, /* OUT: request ID */
+ int rw_flag, /* WRITE_REQ or READ_REQ */
+ int use_abuf) /* if use attached buffer */
{
int i, j, el_size, status=NC_NOERR, free_cbuf=0, isSameGroup, reqid;
void *cbuf=NULL;
@@ -303,8 +303,9 @@ ncmpii_igetput_varn(NC *ncp,
for (i=ncp->numPutReqs-1; i>=0; i--)
if (ncp->put_list[i].num_recs > 0)
break;
- /* Set the last request object to let wait() to free cbuf */
- ncp->put_list[i].tmpBuf = cbuf;
+ assert(i >= 0);
+ /* Set the last request object to let wait() to free cbuf */
+ ncp->put_list[i].tmpBuf = cbuf;
}
}
}
diff --git a/src/lib/m_getput_varx.m4 b/src/lib/m_getput_varx.m4
index ebb2f89..788dac7 100644
--- a/src/lib/m_getput_varx.m4
+++ b/src/lib/m_getput_varx.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: m_getput_varx.m4 2475 2016-09-05 23:15:29Z wkliao $ */
+/* $Id: m_getput_varx.m4 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -939,7 +939,7 @@ ncmpii_mgetput_varm(int ncid,
/* check if ncid is valid */
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
/* if ncid is invalid, we must return the error now. However, the program
* might hang when only a subset or processes have this error.
*/
diff --git a/src/lib/malloc.c b/src/lib/malloc.c
index 68b2809..c1e1bb4 100644
--- a/src/lib/malloc.c
+++ b/src/lib/malloc.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: malloc.c 2590 2016-10-31 21:37:02Z wkliao $ */
+/* $Id: malloc.c 2721 2016-12-18 06:19:50Z wkliao $ */
/* These are routines for allocating and deallocating memory.
They should be called as NCI_Malloc(size) and
@@ -189,12 +189,12 @@ void *NCI_Malloc_fn(size_t size,
{
#ifdef _DEBUG
if (size == 0)
- fprintf(stderr, "Attempt to malloc zero-size in file %s, line %d\n", filename, lineno);
+ fprintf(stderr, "Attempt to malloc zero-size in file %s func %s line %d\n", filename, func, lineno);
#endif
if (size == 0) return NULL;
void *buf = malloc(size);
if (!buf) {
- fprintf(stderr, "malloc(%zd) failed in file %s, line %d\n", size, filename, lineno);
+ fprintf(stderr, "malloc(%zd) failed in file %s func %s line %d\n", size, filename, func, lineno);
#ifdef PNETCDF_DEBUG
MPI_Abort(MPI_COMM_WORLD, 1);
#endif
@@ -215,12 +215,12 @@ void *NCI_Calloc_fn(size_t nelem,
{
#ifdef _DEBUG
if (nelem == 0 || elsize == 0)
- fprintf(stderr, "Attempt to calloc zero-size in file %s, line %d\n", filename, lineno);
+ fprintf(stderr, "Attempt to calloc zero-size in file %s func %s line %d\n", filename, func, lineno);
#endif
if (nelem == 0 || elsize == 0) return NULL;
void *buf =calloc(nelem, elsize);
if (!buf) {
- fprintf(stderr, "calloc(%zd, %zd) failed in file %s, line %d\n", nelem, elsize, filename, lineno);
+ fprintf(stderr, "calloc(%zd, %zd) failed in file %s func %s line %d\n", nelem, elsize, filename, func, lineno);
#ifdef PNETCDF_DEBUG
MPI_Abort(MPI_COMM_WORLD, 1);
#endif
@@ -241,7 +241,7 @@ void *NCI_Realloc_fn(void *ptr,
{
#ifdef _DEBUG
if (size == 0)
- fprintf(stderr, "Attempt to realloc zero-size in file %s, line %d\n", filename, lineno);
+ fprintf(stderr, "Attempt to realloc zero-size in file %s func %s line %d\n", filename, func, lineno);
#endif
#ifdef PNC_MALLOC_TRACE
if (ptr != NULL) ncmpii_del_mem_entry(ptr);
@@ -249,7 +249,7 @@ void *NCI_Realloc_fn(void *ptr,
if (size == 0) return NULL;
void *buf = (void *) realloc(ptr, size);
if (!buf) {
- fprintf(stderr, "realloc failed in file %s, line %d\n", filename, lineno);
+ fprintf(stderr, "realloc failed in file %s func %s line %d\n", filename, func, lineno);
#ifdef PNETCDF_DEBUG
MPI_Abort(MPI_COMM_WORLD, 1);
#endif
@@ -269,7 +269,7 @@ void NCI_Free_fn(void *ptr,
{
#ifdef _DEBUG
if (ptr == NULL)
- fprintf(stderr, "Attempt to free null pointer in file %s, line %d\n", filename, lineno);
+ fprintf(stderr, "Attempt to free null pointer in file %s func %s line %d\n", filename, func, lineno);
#endif
if (ptr == NULL) return;
#ifdef PNC_MALLOC_TRACE
diff --git a/src/lib/mpincio.c b/src/lib/mpincio.c
index 2952008..5b98b67 100644
--- a/src/lib/mpincio.c
+++ b/src/lib/mpincio.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: mpincio.c 2520 2016-10-06 00:43:21Z wkliao $ */
+/* $Id: mpincio.c 2676 2016-12-05 03:11:14Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -117,19 +117,19 @@ void ncmpiio_extract_hints(ncio *nciop,
MPI_Info_get(info, "nc_header_align_size", MPI_MAX_INFO_VAL-1, value,
&flag);
- if (flag) nciop->hints.h_align = atoll(value);
+ if (flag) nciop->hints.h_align = strtoll(value,NULL,10);
MPI_Info_get(info, "nc_var_align_size", MPI_MAX_INFO_VAL-1, value,
&flag);
- if (flag) nciop->hints.v_align = atoll(value);
+ if (flag) nciop->hints.v_align = strtoll(value,NULL,10);
MPI_Info_get(info, "nc_record_align_size", MPI_MAX_INFO_VAL-1,
value, &flag);
- if (flag) nciop->hints.r_align = atoll(value);
+ if (flag) nciop->hints.r_align = strtoll(value,NULL,10);
MPI_Info_get(info, "nc_header_read_chunk_size", MPI_MAX_INFO_VAL-1,
value, &flag);
- if (flag) nciop->hints.header_read_chunk_size = atoll(value);
+ if (flag) nciop->hints.header_read_chunk_size = strtoll(value,NULL,10);
#ifdef ENABLE_SUBFILING
MPI_Info_get(info, "pnetcdf_subfiling", MPI_MAX_INFO_VAL-1,
@@ -139,7 +139,7 @@ void ncmpiio_extract_hints(ncio *nciop,
MPI_Info_get(info, "nc_num_subfiles", MPI_MAX_INFO_VAL-1,
value, &flag);
- if (flag) nciop->hints.num_subfiles = atoi(value);
+ if (flag) nciop->hints.num_subfiles = (int)strtol(value,NULL,10);
#endif
/* nc_header_align_size, nc_var_align_size, and nciop->hints.r_align
@@ -161,7 +161,7 @@ void ncmpiio_extract_hints(ncio *nciop,
char *num_sf_env;
num_sf_env = getenv("NC_NUM_SUBFILES");
if (num_sf_env != NULL)
- nciop->hints.num_subfiles = atoi(num_sf_env);
+ nciop->hints.num_subfiles = (int)strtol(num_sf_env,NULL,10);
if (nciop->hints.subfile_mode == 0)
nciop->hints.num_subfiles = 0;
#endif
diff --git a/src/lib/mpinetcdf.c b/src/lib/mpinetcdf.c
index 3aa8032..442b139 100644
--- a/src/lib/mpinetcdf.c
+++ b/src/lib/mpinetcdf.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: mpinetcdf.c 2590 2016-10-31 21:37:02Z wkliao $ */
+/* $Id: mpinetcdf.c 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -325,7 +325,7 @@ ncmpi_create(MPI_Comm comm,
char value[MPI_MAX_INFO_VAL];
MPI_Info_get(env_info, "nc_header_read_chunk_size", MPI_MAX_INFO_VAL-1,
value, &flag);
- if (flag) chunksize = atoll(value);
+ if (flag) chunksize = strtoll(value,NULL,10);
}
/* allocate buffer for header object NC */
@@ -530,7 +530,7 @@ ncmpi_open(MPI_Comm comm,
char value[MPI_MAX_INFO_VAL];
MPI_Info_get(env_info, "nc_header_read_chunk_size", MPI_MAX_INFO_VAL-1,
value, &flag);
- if (flag) chunksize = atoll(value);
+ if (flag) chunksize = strtoll(value,NULL,10);
}
/* allocate NC file object */
@@ -674,12 +674,11 @@ int
ncmpi_inq_format(int ncid,
int *formatp) /* out */
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (ncp->format == 5) {
*formatp = NC_FORMAT_CDF5;
@@ -694,33 +693,31 @@ ncmpi_inq_format(int ncid,
*/
*formatp = NC_FORMAT_UNKNOWN;
}
- return status;
+ return err;
}
/*----< ncmpi_inq_file_format() >--------------------------------------------*/
/* This is an independent subroutine. */
int
-ncmpi_inq_file_format(char *filename,
- int *formatp) /* out */
+ncmpi_inq_file_format(const char *filename,
+ int *formatp) /* out */
{
#ifdef _USE_NCMPI
- int ncid, status;
+ int ncid, err;
NC *ncp;
/* open file for reading its header */
- status = ncmpi_open(MPI_COMM_SELF, filename, NC_NOWRITE, MPI_INFO_NULL,
- &ncid);
- if (status != NC_NOERR) {
- if (status == NC_ENOTNC3)
+ err = ncmpi_open(MPI_COMM_SELF, filename, NC_NOWRITE, MPI_INFO_NULL, &ncid);
+ if (err != NC_NOERR) {
+ if (err == NC_ENOTNC3)
DEBUG_ASSIGN_ERROR(*formatp, NC_FORMAT_NETCDF4)
- else if (status == NC_ENOTNC)
+ else if (err == NC_ENOTNC)
DEBUG_ASSIGN_ERROR(*formatp, NC_FORMAT_UNKNOWN)
- return status;
+ return err;
}
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (ncp->format == 5) {
*formatp = NC_FORMAT_CDF5;
@@ -729,9 +726,9 @@ ncmpi_inq_file_format(char *filename,
} else { /* if (ncp->format == 1) */
*formatp = NC_FORMAT_CLASSIC;
}
- status = ncmpi_close(ncid);
+ err = ncmpi_close(ncid);
- return status;
+ return err;
#else
char *cdf_signature="CDF";
char *hdf5_signature="\211HDF\r\n\032\n";
@@ -781,13 +778,12 @@ int
ncmpi_inq_file_info(int ncid,
MPI_Info *info_used)
{
- int mpireturn, status=NC_NOERR;
+ int mpireturn, err;
char value[MPI_MAX_INFO_VAL];
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
#ifdef HAVE_MPI_INFO_DUP
mpireturn = MPI_Info_dup(ncp->nciop->mpiinfo, info_used);
@@ -834,12 +830,11 @@ ncmpi_get_file_info(int ncid,
/* This is a collective subroutine. */
int
ncmpi_redef(int ncid) {
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (NC_readonly(ncp)) DEBUG_RETURN_ERROR(NC_EPERM) /* read-only */
/* if open mode is inconsistent, then this return might cause parallel
@@ -855,8 +850,8 @@ ncmpi_redef(int ncid) {
ncmpii_end_indep_data(ncp);
if (NC_doFsync(ncp)) { /* re-read the header from file */
- status = ncmpii_read_NC(ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_read_NC(ncp);
+ if (err != NC_NOERR) return err;
}
/* duplicate a header to be used in enddef() for checking if header grows */
@@ -874,11 +869,11 @@ ncmpi_redef(int ncid) {
int
ncmpi_begin_indep_data(int ncid)
{
- int status=NC_NOERR;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (NC_indef(ncp)) /* must not be in define mode */
DEBUG_RETURN_ERROR(NC_EINDEFINE)
@@ -887,7 +882,7 @@ ncmpi_begin_indep_data(int ncid)
return NC_NOERR;
/* we need no MPI_File_sync() here. If users want a stronger data
- * consistency, they can either use NC_SHARE or call ncmpi_sync()
+ * consistency, they can call ncmpi_sync()
*/
#if 0 && !defined(DISABLE_FILE_SYNC)
if (!NC_readonly(ncp) && NC_collectiveFhOpened(ncp->nciop)) {
@@ -897,7 +892,7 @@ ncmpi_begin_indep_data(int ncid)
TRACE_IO(MPI_File_sync)(ncp->nciop->collective_fh);
if (mpireturn != MPI_SUCCESS) {
err = ncmpii_handle_error(mpireturn, "MPI_File_sync");
- if (status == NC_NOERR) status = err;
+ if (err == NC_NOERR) return err;
}
TRACE_COMM(MPI_Barrier)(ncp->nciop->comm);
}
@@ -905,20 +900,20 @@ ncmpi_begin_indep_data(int ncid)
fSet(ncp->flags, NC_INDEP);
- status = ncmpii_check_mpifh(ncp, 0);
+ err = ncmpii_check_mpifh(ncp, 0);
- return status;
+ return err;
}
/*----< ncmpi_end_indep_data() >---------------------------------------------*/
/* This is a collective subroutine. */
int
ncmpi_end_indep_data(int ncid) {
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (!NC_indep(ncp)) /* must be in independent data mode */
DEBUG_RETURN_ERROR(NC_ENOTINDEP)
@@ -974,12 +969,12 @@ ncmpii_end_indep_data(NC *ncp)
/* This is a collective subroutine. */
int
ncmpi_enddef(int ncid) {
- int status;
+ int err;
NC *ncp;
/* check if file ID ncid is valid */
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (!NC_indef(ncp)) /* must currently in define mode */
DEBUG_RETURN_ERROR(NC_ENOTINDEFINE)
@@ -1044,11 +1039,11 @@ ncmpi__enddef(int ncid,
*/
int
ncmpi_sync_numrecs(int ncid) {
- int status = NC_NOERR;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* cannot be in define mode */
if (NC_indef(ncp)) DEBUG_RETURN_ERROR(NC_EINDEFINE)
@@ -1062,11 +1057,11 @@ ncmpi_sync_numrecs(int ncid) {
set_NC_ndirty(ncp);
/* sync numrecs in memory and file */
- status = ncmpii_sync_numrecs(ncp, ncp->numrecs);
+ err = ncmpii_sync_numrecs(ncp, ncp->numrecs);
#ifndef DISABLE_FILE_SYNC
if (NC_doFsync(ncp)) { /* NC_SHARE is set */
- int err, mpireturn;
+ int mpierr, mpireturn;
if (NC_indep(ncp)) {
TRACE_IO(MPI_File_sync)(ncp->nciop->independent_fh);
}
@@ -1074,15 +1069,15 @@ ncmpi_sync_numrecs(int ncid) {
TRACE_IO(MPI_File_sync)(ncp->nciop->collective_fh);
}
if (mpireturn != MPI_SUCCESS) {
- err = ncmpii_handle_error(mpireturn, "MPI_File_sync");
- if (status == NC_NOERR) status = err;
+ mpierr = ncmpii_handle_error(mpireturn, "MPI_File_sync");
+ if (err == NC_NOERR) err = mpierr;
}
TRACE_COMM(MPI_Barrier)(ncp->nciop->comm);
if (mpireturn != MPI_SUCCESS)
return ncmpii_handle_error(mpireturn, "MPI_Barrier");
}
#endif
- return status;
+ return err;
}
/*----< ncmpi_sync() >--------------------------------------------------------*/
@@ -1091,11 +1086,11 @@ ncmpi_sync_numrecs(int ncid) {
*/
int
ncmpi_sync(int ncid) {
- int status = NC_NOERR;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* cannot be in define mode */
if (NC_indef(ncp)) DEBUG_RETURN_ERROR(NC_EINDEFINE)
@@ -1109,8 +1104,8 @@ ncmpi_sync(int ncid) {
if (ncp->vars.num_rec_vars > 0 && NC_indep(ncp)) {
/* sync numrecs in memory among processes and in file */
set_NC_ndirty(ncp);
- status = ncmpii_sync_numrecs(ncp, ncp->numrecs);
- if (status != NC_NOERR) return status;
+ err = ncmpii_sync_numrecs(ncp, ncp->numrecs);
+ if (err != NC_NOERR) return err;
}
/* calling MPI_File_sync() on both collective and independent handlers */
@@ -1130,7 +1125,7 @@ ncmpi_abort(int ncid) {
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
/* delete the file if it is newly created by ncmpi_create() */
doUnlink = NC_IsNew(ncp);
@@ -1175,12 +1170,11 @@ ncmpi_abort(int ncid) {
/* This is a collective subroutine. */
int
ncmpi_close(int ncid) {
- int status = NC_NOERR;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* calling the implementation of ncmpi_close() */
return ncmpii_close(ncp);
@@ -1196,12 +1190,12 @@ ncmpi_close(int ncid) {
* hints.
*/
int
-ncmpi_delete(char *filename,
- MPI_Info info)
+ncmpi_delete(const char *filename,
+ MPI_Info info)
{
int err=NC_NOERR, mpireturn;
- TRACE_IO(MPI_File_delete)(filename, info);
+ TRACE_IO(MPI_File_delete)((char*)filename, info);
if (mpireturn != MPI_SUCCESS)
err = ncmpii_handle_error(mpireturn, "MPI_File_delete");
return err;
@@ -1251,12 +1245,11 @@ int
ncmpi_inq_put_size(int ncid,
MPI_Offset *size)
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
*size = ncp->nciop->put_size;
return NC_NOERR;
@@ -1269,12 +1262,11 @@ int
ncmpi_inq_get_size(int ncid,
MPI_Offset *size)
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
*size = ncp->nciop->get_size;
return NC_NOERR;
@@ -1290,26 +1282,25 @@ ncmpi_inq_striping(int ncid,
int *striping_size,
int *striping_count)
{
- int flag, status=NC_NOERR;
+ int flag, err;
char value[MPI_MAX_INFO_VAL];
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (striping_size != NULL) {
MPI_Info_get(ncp->nciop->mpiinfo, "striping_unit", MPI_MAX_INFO_VAL-1,
value, &flag);
*striping_size = 0;
- if (flag) *striping_size = atoi(value);
+ if (flag) *striping_size = (int)strtol(value,NULL,10);
}
if (striping_count != NULL) {
MPI_Info_get(ncp->nciop->mpiinfo, "striping_factor", MPI_MAX_INFO_VAL-1,
value, &flag);
*striping_count = 0;
- if (flag) *striping_count = atoi(value);
+ if (flag) *striping_count = (int)strtol(value,NULL,10);
}
return NC_NOERR;
}
@@ -1367,12 +1358,11 @@ int
ncmpi_inq_recsize(int ncid,
MPI_Offset *recsize)
{
- int status;
+ int err;
NC *ncp;
- status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
*recsize = ncp->recsize;
return NC_NOERR;
@@ -1388,7 +1378,7 @@ ncmpi_inq_header_extent(int ncid,
NC *ncp;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR) return err;
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
*extent = ncp->begin_var;
@@ -1405,10 +1395,36 @@ ncmpi_inq_header_size(int ncid,
NC *ncp;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR) return err;
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
*size = ncp->xsz;
return NC_NOERR;
}
+/*----< ncmpi_inq_path() >----------------------------------------------------*/
+/* Get the file pathname which was used to open/create the ncid's file.
+ * This is an independent subroutine.
+ */
+int
+ncmpi_inq_path(int ncid,
+ int *pathlen,/* Ignored if NULL */
+ char *path) /* must already be allocated. Ignored if NULL */
+{
+ int err;
+ NC *ncp;
+
+ err = ncmpii_NC_check_id(ncid, &ncp);
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
+
+ if (ncp->nciop->path == NULL) {
+ if (pathlen != NULL) *pathlen = 0;
+ if (path != NULL) *path = '\0';
+ } else {
+ if (pathlen != NULL) *pathlen = (int)strlen(ncp->nciop->path);
+ if (path != NULL) strcpy(path, ncp->nciop->path);
+ }
+
+ return NC_NOERR;
+}
+
diff --git a/src/lib/nc.c b/src/lib/nc.c
index 9f4adff..0a2a8fd 100644
--- a/src/lib/nc.c
+++ b/src/lib/nc.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: nc.c 2604 2016-11-09 16:10:48Z wkliao $ */
+/* $Id: nc.c 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -1186,7 +1186,7 @@ ncmpii_NC_enddef(NC *ncp,
if (ncp->nc_num_subfiles > 1) {
/* get ncp info for the subfile */
status = ncmpii_NC_check_id(ncp->ncid_sf, &ncp_sf);
- CHECK_ERROR(status)
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
status = NC_begins(ncp_sf, h_align, h_minfree, v_align, v_minfree,
r_align);
@@ -1311,13 +1311,13 @@ ncmpii_inq_env_align_hints(MPI_Offset *h_align,
*val = '\0';
val++;
if (strcasecmp(key, "nc_header_align_size") == 0)
- *h_align = atoll(val);
+ *h_align = strtoll(val,NULL,10);
else if (strcasecmp(key, "nc_var_align_size") == 0)
- *v_align = atoll(val);
+ *v_align = strtoll(val,NULL,10);
else if (strcasecmp(key, "nc_header_read_chunk_size") == 0)
- *h_chunk = atoll(val);
+ *h_chunk = strtoll(val,NULL,10);
else if (strcasecmp(key, "nc_record_align_size") == 0)
- *r_align = atoll(val);
+ *r_align = strtoll(val,NULL,10);
key = strtok(NULL, ";");
}
NCI_Free(env_str_cpy);
@@ -1346,7 +1346,7 @@ ncmpii_enddef(NC *ncp)
MPI_Info_get(ncp->nciop->mpiinfo, "striping_unit", MPI_MAX_INFO_VAL-1,
value, &flag);
striping_unit = 0;
- if (flag) striping_unit = atoi(value);
+ if (flag) striping_unit = (int)strtol(value,NULL,10);
ncp->nciop->striping_unit = striping_unit;
all_var_size = 0; /* sum of all defined variables */
@@ -1423,7 +1423,7 @@ ncmpii__enddef(NC *ncp,
MPI_Info_get(ncp->nciop->mpiinfo, "striping_unit", MPI_MAX_INFO_VAL-1,
value, &flag);
striping_unit = 0;
- if (flag) striping_unit = atoi(value);
+ if (flag) striping_unit = (int)strtol(value,NULL,10);
ncp->nciop->striping_unit = striping_unit;
all_var_size = 0; /* sum of all defined variables */
@@ -1574,8 +1574,7 @@ ncmpi_inq(int ncid,
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (ndimsp != NULL)
*ndimsp = (int) ncp->dims.ndefined;
@@ -1598,8 +1597,7 @@ ncmpi_inq_version(int ncid, int *nc_mode)
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (ncp->format == 5)
*nc_mode = NC_64BIT_DATA;
@@ -1619,7 +1617,7 @@ ncmpi_inq_ndims(int ncid, int *ndimsp)
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (ndimsp != NULL)
*ndimsp = (int) ncp->dims.ndefined;
@@ -1634,7 +1632,7 @@ ncmpi_inq_nvars(int ncid, int *nvarsp)
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (nvarsp != NULL)
*nvarsp = (int) ncp->vars.ndefined;
@@ -1649,7 +1647,7 @@ ncmpi_inq_natts(int ncid, int *nattsp)
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (nattsp != NULL)
*nattsp = (int) ncp->attrs.ndefined;
@@ -1664,7 +1662,7 @@ ncmpi_inq_unlimdim(int ncid, int *xtendimp)
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
/* TODO: it makes no sense xtendimp being NULL */
if (xtendimp != NULL)
@@ -1683,8 +1681,7 @@ ncmpi_inq_num_rec_vars(int ncid, int *nvarsp)
/* get ncp object */
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (nvarsp != NULL) {
if (NC_indef(ncp)) {
@@ -1709,8 +1706,7 @@ ncmpi_inq_num_fix_vars(int ncid, int *nvarsp)
/* get ncp object */
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
if (nvarsp != NULL) {
if (NC_indef(ncp)) {
diff --git a/src/lib/nc.h b/src/lib/nc.h
index 15cc48c..ba5d062 100644
--- a/src/lib/nc.h
+++ b/src/lib/nc.h
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: nc.h 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: nc.h 2723 2016-12-18 06:21:12Z wkliao $ */
#ifndef _NC_H_
#define _NC_H_
@@ -183,8 +183,11 @@ typedef struct {
*/
typedef struct NC_nametable {
- int num;
- int *list; /* variable IDs */
+ int num; /* number of elements added in the list array. Its value starts
+ with zero and incremented with new name is created. When its
+ value becomes a multiple of NC_NAME_TABLE_CHUNK, list will be
+ reallocated to a space of size (num + NC_NAME_TABLE_CHUNK) */
+ int *list; /* dimension or variable IDs */
} NC_nametable;
/* the dimension ID returned from ncmpi_def_dim() is an integer pointer
@@ -192,11 +195,16 @@ typedef struct NC_nametable {
* is up to 2^31-1. Thus, the member ndefined below should be of type int.
*/
typedef struct NC_dimarray {
- int nalloc; /* number allocated >= ndefined */
- int ndefined; /* number of defined dimensions */
+ int nalloc; /* number allocated >= ndefined */
+ int ndefined; /* number of defined dimensions */
int unlimited_id; /* -1 for not defined, otherwise >= 0 */
NC_dim **value;
- NC_nametable nameT[HASH_TABLE_SIZE]; /* table for quick name lookup */
+ NC_nametable nameT[HASH_TABLE_SIZE]; /* table for quick name lookup.
+ * indices 0, 1, ... HASH_TABLE_SIZE-1 are the hash keys.
+ * nameT[i].num is the number of hash collisions. The IDs of
+ * dimensions with names producing the same hash key i are
+ * stored in nameT[i].list[*]
+ */
} NC_dimarray;
/* Begin defined in dim.c */
@@ -310,7 +318,12 @@ typedef struct NC_vararray {
int ndefined; /* number of defined variables */
int num_rec_vars;/* number of defined record variables */
NC_var **value;
- NC_nametable nameT[HASH_TABLE_SIZE]; /* table for quick name lookup */
+ NC_nametable nameT[HASH_TABLE_SIZE]; /* table for quick name lookup.
+ * indices 0, 1, ... HASH_TABLE_SIZE-1 are the hash keys.
+ * nameT[i].num is the number of hash collisions. The IDs of
+ * variables with names producing the same hash key i are
+ * stored in nameT[i].list[*]
+ */
} NC_vararray;
/* Begin defined in var.c */
@@ -798,9 +811,8 @@ ncmpii_create_imaptype(NC_var *varp, const MPI_Offset *count,
MPI_Datatype *imaptype);
extern int
-ncmpii_calc_datatype_elems(NC *ncp, NC_var *varp, const MPI_Offset *start,
- const MPI_Offset *count, const MPI_Offset *stride,
- int rw_flag, MPI_Datatype buftype,
+ncmpii_calc_datatype_elems(NC_var *varp, const MPI_Offset *count,
+ MPI_Datatype buftype,
MPI_Datatype *ptype, MPI_Offset *bufcount,
MPI_Offset *bnelems, MPI_Offset *nbytes,
int *el_size, int *buftype_is_contig);
@@ -810,9 +822,9 @@ ncmpii_fill_vars(NC *ncp);
extern int
ncmpii_sanity_check(int ncid, int varid, const MPI_Offset *start,
- const MPI_Offset *count, MPI_Offset bufcount,
- MPI_Datatype buftype, enum API_KIND api,
- int isFlexibleAPI, int mustInDataMode,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ MPI_Offset bufcount, MPI_Datatype buftype,
+ enum API_KIND api, int isFlexibleAPI, int mustInDataMode,
int rw_flag, int io_method, NC **ncp, NC_var **varp);
extern char*
@@ -843,4 +855,7 @@ ncmpii_inq_var_fill(NC_var *varp, void *fill_value);
extern int
ncmpii_inq_default_fill_value(int type, void *fill_value);
+extern int
+ncmpii_getput_zero_req(NC *ncp, int rw_flag);
+
#endif /* _NC_H_ */
diff --git a/src/lib/ncmpidtype.c b/src/lib/ncmpidtype.c
index a4f5ffa..444c0a9 100644
--- a/src/lib/ncmpidtype.c
+++ b/src/lib/ncmpidtype.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: ncmpidtype.c 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: ncmpidtype.c 2664 2016-12-02 00:50:43Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -286,6 +286,7 @@ ncmpii_darray_get_totalblks(int rank,
#endif
+/*----< ncmpii_dtype_decode() >-----------------------------------------------*/
/*@
ncmpii_dtype_decode - Decode the MPI derived datatype to get the bottom
level primitive datatype information.
diff --git a/src/lib/nonblocking.c b/src/lib/nonblocking.c
index bf0cac3..58024bd 100644
--- a/src/lib/nonblocking.c
+++ b/src/lib/nonblocking.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: nonblocking.c 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: nonblocking.c 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -45,7 +45,7 @@ static int ncmpii_mgetput(NC *ncp, int num_reqs, NC_req *reqs, int rw_flag,
*
* This function is collective.
*/
-static int
+int
ncmpii_getput_zero_req(NC *ncp,
int rw_flag) /* WRITE_REQ or READ_REQ */
{
@@ -135,7 +135,7 @@ ncmpi_cancel(int ncid,
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
/* 1.7.0 and after nonblocking APIs can be called in define mode.
if (NC_indef(ncp)) DEBUG_RETURN_ERROR(NC_EINDEFINE)
@@ -327,7 +327,7 @@ ncmpi_inq_nreqs(int ncid,
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
/* cannot just use *nreqs = ncp->numGetReqs + ncp->numPutReqs;
* because some request IDs are repeated, such as record variables and
@@ -430,13 +430,13 @@ ncmpi_wait(int ncid,
int *req_ids, /* [num_reqs]: IN/OUT */
int *statuses) /* [num_reqs] */
{
- int status=NC_NOERR;
+ int status;
NC *ncp;
if (num_reqs == 0) return NC_NOERR;
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR) return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
#ifdef ENABLE_REQ_AGGREGATION
return ncmpii_wait(ncp, INDEP_IO, num_reqs, req_ids, statuses);
@@ -478,7 +478,7 @@ ncmpi_wait_all(int ncid,
int *req_ids, /* [num_reqs]: IN/OUT */
int *statuses) /* [num_reqs], can be NULL */
{
- int status=NC_NOERR;
+ int status;
NC *ncp;
/* the following line CANNOT be added, because ncmpi_wait_all() is a
* collective call, all processes must participate some MPI collective
@@ -487,9 +487,8 @@ ncmpi_wait_all(int ncid,
/* if (num_reqs == 0) return NC_NOERR; */
status = ncmpii_NC_check_id(ncid, &ncp);
- if (status != NC_NOERR)
- /* must return the error now, parallel program might hang */
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
+ /* must return the error now, parallel program might hang */
#ifdef ENABLE_REQ_AGGREGATION
return ncmpii_wait(ncp, COLL_IO, num_reqs, req_ids, statuses);
diff --git a/src/lib/pnetcdf.h.in b/src/lib/pnetcdf.h.in
index 8a2bd08..59a6fb4 100644
--- a/src/lib/pnetcdf.h.in
+++ b/src/lib/pnetcdf.h.in
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: pnetcdf.h.in 2615 2016-11-13 23:58:41Z wkliao $
+ * $Id: pnetcdf.h.in 2658 2016-11-27 22:13:48Z wkliao $
*
* @configure_input@
*/
@@ -618,62 +618,90 @@ by the desired type. */
/* Begin Prototypes */
-const char* ncmpi_strerror(int err);
+extern const char*
+ncmpi_strerror(int err);
-const char* ncmpi_strerrno(int err);
+extern const char*
+ncmpi_strerrno(int err);
/* Begin File Functions */
-int ncmpi_create(MPI_Comm comm, const char *path, int cmode, MPI_Info info, int *ncidp);
+extern int
+ncmpi_create(MPI_Comm comm, const char *path, int cmode, MPI_Info info,
+ int *ncidp);
-int ncmpi_open(MPI_Comm comm, const char *path, int omode, MPI_Info info, int *ncidp);
+extern int
+ncmpi_open(MPI_Comm comm, const char *path, int omode, MPI_Info info,
+ int *ncidp);
-int ncmpi_inq_file_info(int ncid, MPI_Info *info_used);
-int ncmpi_get_file_info(int ncid, MPI_Info *info_used);
+extern int
+ncmpi_inq_file_info(int ncid, MPI_Info *info_used);
-int ncmpi_delete(char *filename, MPI_Info info);
+extern int
+ncmpi_get_file_info(int ncid, MPI_Info *info_used); /* deprecated */
-int ncmpi_enddef(int ncid);
+extern int
+ncmpi_delete(const char *filename, MPI_Info info);
-int ncmpi__enddef(int ncid, MPI_Offset h_minfree, MPI_Offset v_align,
- MPI_Offset v_minfree, MPI_Offset r_align);
+extern int
+ncmpi_enddef(int ncid);
-int ncmpi_redef(int ncid);
+extern int
+ncmpi__enddef(int ncid, MPI_Offset h_minfree, MPI_Offset v_align,
+ MPI_Offset v_minfree, MPI_Offset r_align);
-int ncmpi_set_default_format(int format, int *old_formatp);
+extern int
+ncmpi_redef(int ncid);
-int ncmpi_inq_default_format(int *formatp);
+extern int
+ncmpi_set_default_format(int format, int *old_formatp);
-int ncmpi_sync(int ncid);
+extern int
+ncmpi_inq_default_format(int *formatp);
-int ncmpi_sync_numrecs(int ncid);
+extern int
+ncmpi_sync(int ncid);
-int ncmpi_abort(int ncid);
+extern int
+ncmpi_sync_numrecs(int ncid);
-int ncmpi_begin_indep_data(int ncid);
+extern int
+ncmpi_abort(int ncid);
-int ncmpi_end_indep_data(int ncid);
+extern int
+ncmpi_begin_indep_data(int ncid);
-int ncmpi_close(int ncid);
+extern int
+ncmpi_end_indep_data(int ncid);
-int ncmpi_set_fill(int ncid, int fillmode, int *old_modep);
+extern int
+ncmpi_close(int ncid);
-int ncmpi_def_var_fill(int ncid, int varid, int no_fill, void *fill_value);
+extern int
+ncmpi_set_fill(int ncid, int fillmode, int *old_modep);
-int ncmpi_fill_var_rec(int ncid, int varid, MPI_Offset recno);
+extern int
+ncmpi_def_var_fill(int ncid, int varid, int no_fill, void *fill_value);
+
+extern int
+ncmpi_fill_var_rec(int ncid, int varid, MPI_Offset recno);
/* End File Functions */
/* Begin Define Mode Functions */
-int ncmpi_def_dim(int ncid, const char *name, MPI_Offset len, int *idp);
+extern int
+ncmpi_def_dim(int ncid, const char *name, MPI_Offset len, int *idp);
-int ncmpi_def_var(int ncid, const char *name, nc_type xtype,
- int ndims, const int *dimidsp, int *varidp);
+extern int
+ncmpi_def_var(int ncid, const char *name, nc_type xtype, int ndims,
+ const int *dimidsp, int *varidp);
-int ncmpi_rename_dim(int ncid, int dimid, const char *name);
+extern int
+ncmpi_rename_dim(int ncid, int dimid, const char *name);
-int ncmpi_rename_var(int ncid, int varid, const char *name);
+extern int
+ncmpi_rename_var(int ncid, int varid, const char *name);
/* End Define Mode Functions */
@@ -681,176 +709,240 @@ int ncmpi_rename_var(int ncid, int varid, const char *name);
const char* ncmpi_inq_libvers(void);
-int ncmpi_inq(int ncid, int *ndimsp, int *nvarsp,
- int *ngattsp, int *unlimdimidp);
+extern int
+ncmpi_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp);
+
+extern int
+ncmpi_inq_format(int ncid, int *formatp);
+
+extern int
+ncmpi_inq_file_format(const char *filename, int *formatp);
+
+extern int
+ncmpi_inq_version(int ncid, int *NC_mode);
-int ncmpi_inq_format(int ncid, int *formatp);
+extern int
+ncmpi_inq_striping(int ncid, int *striping_size, int *striping_count);
-int ncmpi_inq_file_format(char *filename, int *formatp);
+extern int
+ncmpi_inq_ndims(int ncid, int *ndimsp);
-int ncmpi_inq_version(int ncid, int *NC_mode);
+extern int
+ncmpi_inq_nvars(int ncid, int *nvarsp);
-int ncmpi_inq_striping(int ncid, int *striping_size, int *striping_count);
+extern int
+ncmpi_inq_num_rec_vars(int ncid, int *nvarsp);
-int ncmpi_inq_ndims(int ncid, int *ndimsp);
+extern int
+ncmpi_inq_num_fix_vars(int ncid, int *nvarsp);
-int ncmpi_inq_nvars(int ncid, int *nvarsp);
+extern int
+ncmpi_inq_natts(int ncid, int *ngattsp);
-int ncmpi_inq_num_rec_vars(int ncid, int *nvarsp);
+extern int
+ncmpi_inq_unlimdim(int ncid, int *unlimdimidp);
-int ncmpi_inq_num_fix_vars(int ncid, int *nvarsp);
+extern int
+ncmpi_inq_dimid(int ncid, const char *name, int *idp);
-int ncmpi_inq_natts(int ncid, int *ngattsp);
+extern int
+ncmpi_inq_dim(int ncid, int dimid, char *name, MPI_Offset *lenp);
-int ncmpi_inq_unlimdim(int ncid, int *unlimdimidp);
+extern int
+ncmpi_inq_dimname(int ncid, int dimid, char *name);
-int ncmpi_inq_dimid(int ncid, const char *name, int *idp);
+extern int
+ncmpi_inq_dimlen(int ncid, int dimid, MPI_Offset *lenp);
-int ncmpi_inq_dim(int ncid, int dimid, char *name, MPI_Offset *lenp);
+extern int
+ncmpi_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
+ int *dimidsp, int *nattsp);
-int ncmpi_inq_dimname(int ncid, int dimid, char *name);
+extern int
+ncmpi_inq_varid(int ncid, const char *name, int *varidp);
-int ncmpi_inq_dimlen(int ncid, int dimid, MPI_Offset *lenp);
+extern int
+ncmpi_inq_varname(int ncid, int varid, char *name);
-int ncmpi_inq_var(int ncid, int varid, char *name, nc_type *xtypep,
- int *ndimsp, int *dimidsp, int *nattsp);
+extern int
+ncmpi_inq_vartype(int ncid, int varid, nc_type *xtypep);
-int ncmpi_inq_varid(int ncid, const char *name, int *varidp);
+extern int
+ncmpi_inq_varndims(int ncid, int varid, int *ndimsp);
-int ncmpi_inq_varname(int ncid, int varid, char *name);
+extern int
+ncmpi_inq_vardimid(int ncid, int varid, int *dimidsp);
-int ncmpi_inq_vartype(int ncid, int varid, nc_type *xtypep);
+extern int
+ncmpi_inq_varnatts(int ncid, int varid, int *nattsp);
-int ncmpi_inq_varndims(int ncid, int varid, int *ndimsp);
+extern int
+ncmpi_inq_varoffset(int ncid, int varid, MPI_Offset *offset);
-int ncmpi_inq_vardimid(int ncid, int varid, int *dimidsp);
+extern int
+ncmpi_inq_put_size(int ncid, MPI_Offset *size);
-int ncmpi_inq_varnatts(int ncid, int varid, int *nattsp);
+extern int
+ncmpi_inq_get_size(int ncid, MPI_Offset *size);
-int ncmpi_inq_varoffset(int ncid, int varid, MPI_Offset *offset);
+extern int
+ncmpi_inq_header_size(int ncid, MPI_Offset *size);
-int ncmpi_inq_put_size(int ncid, MPI_Offset *size);
+extern int
+ncmpi_inq_header_extent(int ncid, MPI_Offset *extent);
-int ncmpi_inq_get_size(int ncid, MPI_Offset *size);
+extern int
+ncmpi_inq_malloc_size(MPI_Offset *size);
-int ncmpi_inq_header_size(int ncid, MPI_Offset *size);
+extern int
+ncmpi_inq_malloc_max_size(MPI_Offset *size);
-int ncmpi_inq_header_extent(int ncid, MPI_Offset *extent);
+extern int
+ncmpi_inq_malloc_list(void);
-int ncmpi_inq_malloc_size(MPI_Offset *size);
-int ncmpi_inq_malloc_max_size(MPI_Offset *size);
-int ncmpi_inq_malloc_list(void);
+extern int
+ncmpi_inq_files_opened(int *num, int *ncids);
-int ncmpi_inq_files_opened(int *num, int *ncids);
+extern int
+ncmpi_inq_recsize(int ncid, MPI_Offset *recsize);
-int ncmpi_inq_recsize(int ncid, MPI_Offset *recsize);
+extern int
+ncmpi_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_value);
-int ncmpi_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_value);
+extern int
+ncmpi_inq_path(int ncid, int *pathlen, char *path);
/* End Inquiry Functions */
/* Begin _att */
-int ncmpi_inq_att(int ncid, int varid, const char *name,
- nc_type *xtypep, MPI_Offset *lenp);
+extern int
+ncmpi_inq_att(int ncid, int varid, const char *name, nc_type *xtypep,
+ MPI_Offset *lenp);
-int ncmpi_inq_attid(int ncid, int varid, const char *name, int *idp);
+extern int
+ncmpi_inq_attid(int ncid, int varid, const char *name, int *idp);
-int ncmpi_inq_atttype(int ncid, int varid, const char *name,
- nc_type *xtypep);
+extern int
+ncmpi_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep);
-int ncmpi_inq_attlen(int ncid, int varid, const char *name,
- MPI_Offset *lenp);
+extern int
+ncmpi_inq_attlen(int ncid, int varid, const char *name, MPI_Offset *lenp);
-int ncmpi_inq_attname(int ncid, int varid, int attnum, char *name);
+extern int
+ncmpi_inq_attname(int ncid, int varid, int attnum, char *name);
-int ncmpi_copy_att(int ncid_in, int varid_in, const char *name,
- int ncid_out, int varid_out);
+extern int
+ncmpi_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out,
+ int varid_out);
-int ncmpi_rename_att(int ncid, int varid, const char *name,
- const char *newname);
+extern int
+ncmpi_rename_att(int ncid, int varid, const char *name, const char *newname);
-int ncmpi_del_att(int ncid, int varid, const char *name);
+extern int
+ncmpi_del_att(int ncid, int varid, const char *name);
-int ncmpi_put_att(int ncid, int varid, const char *name, nc_type xtype,
- MPI_Offset nelems, const void *value);
+extern int
+ncmpi_put_att(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset nelems, const void *value);
-int ncmpi_put_att_text(int ncid, int varid, const char *name, MPI_Offset len,
- const char *op);
+extern int
+ncmpi_put_att_text(int ncid, int varid, const char *name, MPI_Offset len,
+ const char *op);
-int ncmpi_put_att_schar(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const signed char *op);
+extern int
+ncmpi_put_att_schar(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const signed char *op);
-int ncmpi_put_att_short(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const short *op);
+extern int
+ncmpi_put_att_short(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const short *op);
-int ncmpi_put_att_int(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const int *op);
+extern int
+ncmpi_put_att_int(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const int *op);
-int ncmpi_put_att_float(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const float *op);
+extern int
+ncmpi_put_att_float(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const float *op);
-int ncmpi_put_att_double(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const double *op);
+extern int
+ncmpi_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const double *op);
-int ncmpi_put_att_longlong(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const long long *op);
+extern int
+ncmpi_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const long long *op);
-int ncmpi_get_att(int ncid, int varid, const char *name, void *value);
+extern int
+ncmpi_get_att(int ncid, int varid, const char *name, void *value);
-int ncmpi_get_att_text(int ncid, int varid, const char *name, char *ip);
+extern int
+ncmpi_get_att_text(int ncid, int varid, const char *name, char *ip);
-int ncmpi_get_att_schar(int ncid, int varid, const char *name,
- signed char *ip);
+extern int
+ncmpi_get_att_schar(int ncid, int varid, const char *name, signed char *ip);
-int ncmpi_get_att_short(int ncid, int varid, const char *name, short *ip);
+extern int
+ncmpi_get_att_short(int ncid, int varid, const char *name, short *ip);
-int ncmpi_get_att_int(int ncid, int varid, const char *name, int *ip);
+extern int
+ncmpi_get_att_int(int ncid, int varid, const char *name, int *ip);
-int ncmpi_get_att_float(int ncid, int varid, const char *name, float *ip);
+extern int
+ncmpi_get_att_float(int ncid, int varid, const char *name, float *ip);
-int ncmpi_get_att_double(int ncid, int varid, const char *name, double *ip);
+extern int
+ncmpi_get_att_double(int ncid, int varid, const char *name, double *ip);
-int ncmpi_get_att_longlong(int ncid, int varid, const char *name, long long *ip);
+extern int
+ncmpi_get_att_longlong(int ncid, int varid, const char *name, long long *ip);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_att_uchar(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const unsigned char *op);
+extern int
+ncmpi_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const unsigned char *op);
-int ncmpi_put_att_ubyte(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const unsigned char *op);
+extern int
+ncmpi_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const unsigned char *op);
-int ncmpi_put_att_ushort(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const unsigned short *op);
+extern int
+ncmpi_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const unsigned short *op);
-int ncmpi_put_att_uint(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const unsigned int *op);
+extern int
+ncmpi_put_att_uint(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const unsigned int *op);
-int ncmpi_put_att_long(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const long *op);
+extern int
+ncmpi_put_att_long(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const long *op);
-int ncmpi_put_att_ulonglong(int ncid, int varid, const char *name,
- nc_type xtype, MPI_Offset len, const unsigned long long *op);
+extern int
+ncmpi_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype,
+ MPI_Offset len, const unsigned long long *op);
-int ncmpi_get_att_uchar(int ncid, int varid, const char *name,
- unsigned char *ip);
+extern int
+ncmpi_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip);
-int ncmpi_get_att_ubyte(int ncid, int varid, const char *name,
- unsigned char *ip);
+extern int
+ncmpi_get_att_ubyte(int ncid, int varid, const char *name, unsigned char *ip);
-int ncmpi_get_att_ushort(int ncid, int varid, const char *name,
- unsigned short *ip);
+extern int
+ncmpi_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip);
-int ncmpi_get_att_uint(int ncid, int varid, const char *name,
- unsigned int *ip);
+extern int
+ncmpi_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip);
-int ncmpi_get_att_long(int ncid, int varid, const char *name,
- long *ip);
+extern int
+ncmpi_get_att_long(int ncid, int varid, const char *name, long *ip);
-int ncmpi_get_att_ulonglong(int ncid, int varid, const char *name,
- unsigned long long *ip);
+extern int
+ncmpi_get_att_ulonglong(int ncid, int varid, const char *name,
+ unsigned long long *ip);
/* End Skip Prototypes for Fortran binding */
@@ -858,3031 +950,3506 @@ int ncmpi_get_att_ulonglong(int ncid, int varid, const char *name,
/* Begin {put,get}_var1 */
-int ncmpi_put_var1(int ncid, int varid, const MPI_Offset index[],
- const void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
-int ncmpi_put_var1_all(int ncid, int varid, const MPI_Offset index[],
- const void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
-
-int ncmpi_put_var1_text(int ncid, int varid, const MPI_Offset index[],
- const char *op);
-int ncmpi_put_var1_text_all(int ncid, int varid, const MPI_Offset index[],
- const char *op);
-
-int ncmpi_put_var1_schar(int ncid, int varid, const MPI_Offset index[],
- const signed char *op);
-int ncmpi_put_var1_schar_all(int ncid, int varid, const MPI_Offset index[],
- const signed char *op);
-
-int ncmpi_put_var1_short(int ncid, int varid, const MPI_Offset index[],
- const short *op);
-int ncmpi_put_var1_short_all(int ncid, int varid, const MPI_Offset index[],
- const short *op);
-
-int ncmpi_put_var1_int(int ncid, int varid, const MPI_Offset index[],
- const int *op);
-int ncmpi_put_var1_int_all(int ncid, int varid, const MPI_Offset index[],
- const int *op);
-
-int ncmpi_put_var1_float(int ncid, int varid, const MPI_Offset index[],
- const float *op);
-int ncmpi_put_var1_float_all(int ncid, int varid, const MPI_Offset index[],
- const float *op);
-
-int ncmpi_put_var1_double(int ncid, int varid, const MPI_Offset index[],
- const double *op);
-int ncmpi_put_var1_double_all(int ncid, int varid, const MPI_Offset index[],
- const double *op);
-
-int ncmpi_put_var1_longlong(int ncid, int varid, const MPI_Offset index[],
- const long long *op);
-int ncmpi_put_var1_longlong_all(int ncid, int varid, const MPI_Offset index[],
- const long long *op);
-
-int ncmpi_get_var1(int ncid, int varid, const MPI_Offset index[],
- void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
-int ncmpi_get_var1_all(int ncid, int varid, const MPI_Offset index[],
- void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
-
-int ncmpi_get_var1_text(int ncid, int varid, const MPI_Offset index[],
- char *ip);
-int ncmpi_get_var1_text_all(int ncid, int varid, const MPI_Offset index[],
- char *ip);
-
-int ncmpi_get_var1_schar(int ncid, int varid, const MPI_Offset index[],
- signed char *ip);
-int ncmpi_get_var1_schar_all(int ncid, int varid, const MPI_Offset index[],
- signed char *ip);
-
-int ncmpi_get_var1_short(int ncid, int varid, const MPI_Offset index[],
- short *ip);
-int ncmpi_get_var1_short_all(int ncid, int varid, const MPI_Offset index[],
- short *ip);
-
-int ncmpi_get_var1_int(int ncid, int varid, const MPI_Offset index[],
- int *ip);
-int ncmpi_get_var1_int_all(int ncid, int varid, const MPI_Offset index[],
- int *ip);
-
-int ncmpi_get_var1_float(int ncid, int varid, const MPI_Offset index[],
- float *ip);
-int ncmpi_get_var1_float_all(int ncid, int varid, const MPI_Offset index[],
- float *ip);
-
-int ncmpi_get_var1_double(int ncid, int varid, const MPI_Offset index[],
- double *ip);
-int ncmpi_get_var1_double_all(int ncid, int varid, const MPI_Offset index[],
- double *ip);
-
-int ncmpi_get_var1_longlong(int ncid, int varid, const MPI_Offset index[],
- long long *ip);
-int ncmpi_get_var1_longlong_all(int ncid, int varid, const MPI_Offset index[],
- long long *ip);
+extern int
+ncmpi_put_var1(int ncid, int varid, const MPI_Offset *start,
+ const void *op, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_var1_all(int ncid, int varid, const MPI_Offset *start,
+ const void *op, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_put_var1_text(int ncid, int varid, const MPI_Offset *start,
+ const char *op);
+extern int
+ncmpi_put_var1_text_all(int ncid, int varid, const MPI_Offset *start,
+ const char *op);
+
+extern int
+ncmpi_put_var1_schar(int ncid, int varid, const MPI_Offset *start,
+ const signed char *op);
+extern int
+ncmpi_put_var1_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const signed char *op);
+
+extern int
+ncmpi_put_var1_short(int ncid, int varid, const MPI_Offset *start,
+ const short *op);
+extern int
+ncmpi_put_var1_short_all(int ncid, int varid, const MPI_Offset *start,
+ const short *op);
+
+extern int
+ncmpi_put_var1_int(int ncid, int varid, const MPI_Offset *start,
+ const int *op);
+extern int
+ncmpi_put_var1_int_all(int ncid, int varid, const MPI_Offset *start,
+ const int *op);
+
+extern int
+ncmpi_put_var1_float(int ncid, int varid, const MPI_Offset *start,
+ const float *op);
+extern int
+ncmpi_put_var1_float_all(int ncid, int varid, const MPI_Offset *start,
+ const float *op);
+
+extern int
+ncmpi_put_var1_double(int ncid, int varid, const MPI_Offset *start,
+ const double *op);
+extern int
+ncmpi_put_var1_double_all(int ncid, int varid, const MPI_Offset *start,
+ const double *op);
+
+extern int
+ncmpi_put_var1_longlong(int ncid, int varid, const MPI_Offset *start,
+ const long long *op);
+extern int
+ncmpi_put_var1_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const long long *op);
+
+extern int
+ncmpi_get_var1(int ncid, int varid, const MPI_Offset *start,
+ void *ip, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_get_var1_all(int ncid, int varid, const MPI_Offset *start,
+ void *ip, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_get_var1_text(int ncid, int varid, const MPI_Offset *start,
+ char *ip);
+extern int
+ncmpi_get_var1_text_all(int ncid, int varid, const MPI_Offset *start,
+ char *ip);
+
+extern int
+ncmpi_get_var1_schar(int ncid, int varid, const MPI_Offset *start,
+ signed char *ip);
+extern int
+ncmpi_get_var1_schar_all(int ncid, int varid, const MPI_Offset *start,
+ signed char *ip);
+
+extern int
+ncmpi_get_var1_short(int ncid, int varid, const MPI_Offset *start,
+ short *ip);
+extern int
+ncmpi_get_var1_short_all(int ncid, int varid, const MPI_Offset *start,
+ short *ip);
+
+extern int
+ncmpi_get_var1_int(int ncid, int varid, const MPI_Offset *start,
+ int *ip);
+extern int
+ncmpi_get_var1_int_all(int ncid, int varid, const MPI_Offset *start,
+ int *ip);
+
+extern int
+ncmpi_get_var1_float(int ncid, int varid, const MPI_Offset *start,
+ float *ip);
+extern int
+ncmpi_get_var1_float_all(int ncid, int varid, const MPI_Offset *start,
+ float *ip);
+
+extern int
+ncmpi_get_var1_double(int ncid, int varid, const MPI_Offset *start,
+ double *ip);
+extern int
+ncmpi_get_var1_double_all(int ncid, int varid, const MPI_Offset *start,
+ double *ip);
+
+extern int
+ncmpi_get_var1_longlong(int ncid, int varid, const MPI_Offset *start,
+ long long *ip);
+extern int
+ncmpi_get_var1_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ long long *ip);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_var1_uchar(int ncid, int varid, const MPI_Offset index[],
- const unsigned char *op);
-int ncmpi_put_var1_uchar_all(int ncid, int varid, const MPI_Offset index[],
- const unsigned char *op);
-
-int ncmpi_put_var1_ushort(int ncid, int varid, const MPI_Offset index[],
- const unsigned short *op);
-int ncmpi_put_var1_ushort_all(int ncid, int varid, const MPI_Offset index[],
- const unsigned short *op);
-
-int ncmpi_put_var1_uint(int ncid, int varid, const MPI_Offset index[],
- const unsigned int *op);
-int ncmpi_put_var1_uint_all(int ncid, int varid, const MPI_Offset index[],
- const unsigned int *op);
-
-int ncmpi_put_var1_long(int ncid, int varid, const MPI_Offset index[],
- const long *ip);
-int ncmpi_put_var1_long_all(int ncid, int varid, const MPI_Offset index[],
- const long *ip);
-
-int ncmpi_put_var1_ulonglong(int ncid, int varid, const MPI_Offset index[],
- const unsigned long long *ip);
-int ncmpi_put_var1_ulonglong_all(int ncid, int varid, const MPI_Offset index[],
- const unsigned long long *ip);
-
-int ncmpi_get_var1_uchar(int ncid, int varid, const MPI_Offset index[],
- unsigned char *ip);
-int ncmpi_get_var1_uchar_all(int ncid, int varid, const MPI_Offset index[],
- unsigned char *ip);
-
-int ncmpi_get_var1_ushort(int ncid, int varid, const MPI_Offset index[],
- unsigned short *ip);
-int ncmpi_get_var1_ushort_all(int ncid, int varid, const MPI_Offset index[],
- unsigned short *ip);
-
-int ncmpi_get_var1_uint(int ncid, int varid, const MPI_Offset index[],
- unsigned int *ip);
-int ncmpi_get_var1_uint_all(int ncid, int varid, const MPI_Offset index[],
- unsigned int *ip);
-
-int ncmpi_get_var1_long(int ncid, int varid, const MPI_Offset index[],
- long *ip);
-int ncmpi_get_var1_long_all(int ncid, int varid, const MPI_Offset index[],
- long *ip);
-
-int ncmpi_get_var1_ulonglong(int ncid, int varid, const MPI_Offset index[],
- unsigned long long *ip);
-int ncmpi_get_var1_ulonglong_all(int ncid, int varid, const MPI_Offset index[],
- unsigned long long *ip);
+extern int
+ncmpi_put_var1_uchar(int ncid, int varid, const MPI_Offset *start,
+ const unsigned char *op);
+extern int
+ncmpi_put_var1_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const unsigned char *op);
+
+extern int
+ncmpi_put_var1_ushort(int ncid, int varid, const MPI_Offset *start,
+ const unsigned short *op);
+extern int
+ncmpi_put_var1_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const unsigned short *op);
+
+extern int
+ncmpi_put_var1_uint(int ncid, int varid, const MPI_Offset *start,
+ const unsigned int *op);
+extern int
+ncmpi_put_var1_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const unsigned int *op);
+
+extern int
+ncmpi_put_var1_long(int ncid, int varid, const MPI_Offset *start,
+ const long *ip);
+extern int
+ncmpi_put_var1_long_all(int ncid, int varid, const MPI_Offset *start,
+ const long *ip);
+
+extern int
+ncmpi_put_var1_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const unsigned long long *ip);
+extern int
+ncmpi_put_var1_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const unsigned long long *ip);
+
+extern int
+ncmpi_get_var1_uchar(int ncid, int varid, const MPI_Offset *start,
+ unsigned char *ip);
+extern int
+ncmpi_get_var1_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ unsigned char *ip);
+
+extern int
+ncmpi_get_var1_ushort(int ncid, int varid, const MPI_Offset *start,
+ unsigned short *ip);
+extern int
+ncmpi_get_var1_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ unsigned short *ip);
+
+extern int
+ncmpi_get_var1_uint(int ncid, int varid, const MPI_Offset *start,
+ unsigned int *ip);
+extern int
+ncmpi_get_var1_uint_all(int ncid, int varid, const MPI_Offset *start,
+ unsigned int *ip);
+
+extern int
+ncmpi_get_var1_long(int ncid, int varid, const MPI_Offset *start,
+ long *ip);
+extern int
+ncmpi_get_var1_long_all(int ncid, int varid, const MPI_Offset *start,
+ long *ip);
+
+extern int
+ncmpi_get_var1_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ unsigned long long *ip);
+extern int
+ncmpi_get_var1_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ unsigned long long *ip);
/* End Skip Prototypes for Fortran binding */
/* End {put,get}_var1 */
/* Begin {put,get}_var */
-int ncmpi_put_var(int ncid, int varid, const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_put_var_all(int ncid, int varid, const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_put_var_text(int ncid, int varid, const char *op);
-int ncmpi_put_var_text_all(int ncid, int varid, const char *op);
-
-int ncmpi_put_var_schar(int ncid, int varid, const signed char *op);
-int ncmpi_put_var_schar_all(int ncid, int varid, const signed char *op);
+extern int
+ncmpi_put_var(int ncid, int varid, const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype);
-int ncmpi_put_var_short(int ncid, int varid, const short *op);
-int ncmpi_put_var_short_all(int ncid, int varid, const short *op);
+extern int
+ncmpi_put_var_all(int ncid, int varid, const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype);
-int ncmpi_put_var_int(int ncid, int varid, const int *op);
-int ncmpi_put_var_int_all(int ncid, int varid, const int *op);
+extern int
+ncmpi_put_var_text(int ncid, int varid, const char *op);
+extern int
+ncmpi_put_var_text_all(int ncid, int varid, const char *op);
+
+extern int
+ncmpi_put_var_schar(int ncid, int varid, const signed char *op);
+extern int
+ncmpi_put_var_schar_all(int ncid, int varid, const signed char *op);
+
+extern int
+ncmpi_put_var_short(int ncid, int varid, const short *op);
+extern int
+ncmpi_put_var_short_all(int ncid, int varid, const short *op);
+
+extern int
+ncmpi_put_var_int(int ncid, int varid, const int *op);
+extern int
+ncmpi_put_var_int_all(int ncid, int varid, const int *op);
+
+extern int
+ncmpi_put_var_float(int ncid, int varid, const float *op);
+extern int
+ncmpi_put_var_float_all(int ncid, int varid, const float *op);
+
+extern int
+ncmpi_put_var_double(int ncid, int varid, const double *op);
+extern int
+ncmpi_put_var_double_all(int ncid, int varid, const double *op);
+
+extern int
+ncmpi_put_var_longlong(int ncid, int varid, const long long *op);
+extern int
+ncmpi_put_var_longlong_all(int ncid, int varid, const long long *op);
+
+extern int
+ncmpi_get_var(int ncid, int varid, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+extern int
+ncmpi_get_var_all(int ncid, int varid, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
-int ncmpi_put_var_float(int ncid, int varid, const float *op);
-int ncmpi_put_var_float_all(int ncid, int varid, const float *op);
+extern int
+ncmpi_get_var_text(int ncid, int varid, char *ip);
+extern int
+ncmpi_get_var_text_all(int ncid, int varid, char *ip);
+
+extern int
+ncmpi_get_var_schar(int ncid, int varid, signed char *ip);
+extern int
+ncmpi_get_var_schar_all(int ncid, int varid, signed char *ip);
+
+extern int
+ncmpi_get_var_short(int ncid, int varid, short *ip);
+extern int
+ncmpi_get_var_short_all(int ncid, int varid, short *ip);
+
+extern int
+ncmpi_get_var_int(int ncid, int varid, int *ip);
+extern int
+ncmpi_get_var_int_all(int ncid, int varid, int *ip);
+
+extern int
+ncmpi_get_var_float(int ncid, int varid, float *ip);
+extern int
+ncmpi_get_var_float_all(int ncid, int varid, float *ip);
+
+extern int
+ncmpi_get_var_double(int ncid, int varid, double *ip);
+extern int
+ncmpi_get_var_double_all(int ncid, int varid, double *ip);
+
+extern int
+ncmpi_get_var_longlong(int ncid, int varid, long long *ip);
+extern int
+ncmpi_get_var_longlong_all(int ncid, int varid, long long *ip);
-int ncmpi_put_var_double(int ncid, int varid, const double *op);
-int ncmpi_put_var_double_all(int ncid, int varid, const double *op);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_var_longlong(int ncid, int varid, const long long *op);
-int ncmpi_put_var_longlong_all(int ncid, int varid, const long long *op);
+extern int
+ncmpi_put_var_uchar(int ncid, int varid, const unsigned char *op);
+extern int
+ncmpi_put_var_uchar_all(int ncid, int varid, const unsigned char *op);
+
+extern int
+ncmpi_put_var_ushort(int ncid, int varid, const unsigned short *op);
+extern int
+ncmpi_put_var_ushort_all(int ncid, int varid, const unsigned short *op);
+
+extern int
+ncmpi_put_var_uint(int ncid, int varid, const unsigned int *op);
+extern int
+ncmpi_put_var_uint_all(int ncid, int varid, const unsigned int *op);
+
+extern int
+ncmpi_put_var_long(int ncid, int varid, const long *op);
+extern int
+ncmpi_put_var_long_all(int ncid, int varid, const long *op);
+
+extern int
+ncmpi_put_var_ulonglong(int ncid, int varid, const unsigned long long *op);
+extern int
+ncmpi_put_var_ulonglong_all(int ncid, int varid, const unsigned long long *op);
+
+extern int
+ncmpi_get_var_uchar(int ncid, int varid, unsigned char *ip);
+extern int
+ncmpi_get_var_uchar_all(int ncid, int varid, unsigned char *ip);
+
+extern int
+ncmpi_get_var_ushort(int ncid, int varid, unsigned short *ip);
+extern int
+ncmpi_get_var_ushort_all(int ncid, int varid, unsigned short *ip);
+
+extern int
+ncmpi_get_var_uint(int ncid, int varid, unsigned int *ip);
+extern int
+ncmpi_get_var_uint_all(int ncid, int varid, unsigned int *ip);
+
+extern int
+ncmpi_get_var_long(int ncid, int varid, long *ip);
+extern int
+ncmpi_get_var_long_all(int ncid, int varid, long *ip);
+
+extern int
+ncmpi_get_var_ulonglong(int ncid, int varid, unsigned long long *ip);
+extern int
+ncmpi_get_var_ulonglong_all(int ncid, int varid, unsigned long long *ip);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_get_var(int ncid, int varid, void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+/* End {put,get}_var */
-int ncmpi_get_var_all(int ncid, int varid, void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+/* Begin {put,get}_vara */
-int ncmpi_get_var_text(int ncid, int varid, char *ip);
-int ncmpi_get_var_text_all(int ncid, int varid, char *ip);
+extern int
+ncmpi_put_vara(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_vara_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_put_vara_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const char *op);
+extern int
+ncmpi_put_vara_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const char *op);
+
+extern int
+ncmpi_put_vara_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const signed char *op);
+extern int
+ncmpi_put_vara_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const signed char *op);
+
+extern int
+ncmpi_put_vara_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const short *op);
+extern int
+ncmpi_put_vara_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const short *op);
+
+extern int
+ncmpi_put_vara_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const int *op);
+extern int
+ncmpi_put_vara_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const int *op);
+
+extern int
+ncmpi_put_vara_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const float *op);
+
+extern int
+ncmpi_put_vara_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const float *op);
+
+extern int
+ncmpi_put_vara_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const double *op);
+extern int
+ncmpi_put_vara_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const double *op);
+
+extern int
+ncmpi_put_vara_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long long *op);
+extern int
+ncmpi_put_vara_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long long *op);
+
+extern int
+ncmpi_get_vara(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+extern int
+ncmpi_get_vara_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+
+extern int
+ncmpi_get_vara_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, char *ip);
+extern int
+ncmpi_get_vara_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, char *ip);
+
+extern int
+ncmpi_get_vara_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, signed char *ip);
+extern int
+ncmpi_get_vara_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, signed char *ip);
+
+extern int
+ncmpi_get_vara_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, short *ip);
+extern int
+ncmpi_get_vara_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, short *ip);
+
+extern int
+ncmpi_get_vara_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, int *ip);
+extern int
+ncmpi_get_vara_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, int *ip);
+
+extern int
+ncmpi_get_vara_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, float *ip);
+extern int
+ncmpi_get_vara_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, float *ip);
+
+extern int
+ncmpi_get_vara_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, double *ip);
+extern int
+ncmpi_get_vara_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, double *ip);
+
+extern int
+ncmpi_get_vara_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long long *ip);
+extern int
+ncmpi_get_vara_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long long *ip);
-int ncmpi_get_var_schar(int ncid, int varid, signed char *ip);
-int ncmpi_get_var_schar_all(int ncid, int varid, signed char *ip);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_get_var_short(int ncid, int varid, short *ip);
-int ncmpi_get_var_short_all(int ncid, int varid, short *ip);
+extern int
+ncmpi_put_vara_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned char *op);
+extern int
+ncmpi_put_vara_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned char *op);
+
+extern int
+ncmpi_put_vara_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned short *op);
+extern int
+ncmpi_put_vara_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned short *op);
+
+extern int
+ncmpi_put_vara_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned int *op);
+extern int
+ncmpi_put_vara_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned int *op);
+
+extern int
+ncmpi_put_vara_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long *op);
+extern int
+ncmpi_put_vara_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long *op);
+
+extern int
+ncmpi_put_vara_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned long long *op);
+extern int
+ncmpi_put_vara_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned long long *op);
+
+extern int
+ncmpi_get_vara_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned char *ip);
+extern int
+ncmpi_get_vara_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned char *ip);
+
+extern int
+ncmpi_get_vara_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned short *ip);
+extern int
+ncmpi_get_vara_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned short *ip);
+
+extern int
+ncmpi_get_vara_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned int *ip);
+extern int
+ncmpi_get_vara_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned int *ip);
+
+extern int
+ncmpi_get_vara_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long *ip);
+extern int
+ncmpi_get_vara_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long *ip);
+
+extern int
+ncmpi_get_vara_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned long long *ip);
+extern int
+ncmpi_get_vara_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned long long *ip);
-int ncmpi_get_var_int(int ncid, int varid, int *ip);
-int ncmpi_get_var_int_all(int ncid, int varid, int *ip);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_get_var_float(int ncid, int varid, float *ip);
-int ncmpi_get_var_float_all(int ncid, int varid, float *ip);
+/* End {put,get}_vara */
-int ncmpi_get_var_double(int ncid, int varid, double *ip);
-int ncmpi_get_var_double_all(int ncid, int varid, double *ip);
+/* Begin {put,get}_vars */
-int ncmpi_get_var_longlong(int ncid, int varid, long long *ip);
-int ncmpi_get_var_longlong_all(int ncid, int varid, long long *ip);
+extern int
+ncmpi_put_vars(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const void *op, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_vars_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const void *op, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_put_vars_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const char *op);
+extern int
+ncmpi_put_vars_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const char *op);
+
+extern int
+ncmpi_put_vars_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const signed char *op);
+extern int
+ncmpi_put_vars_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const signed char *op);
+
+extern int
+ncmpi_put_vars_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const short *op);
+extern int
+ncmpi_put_vars_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const short *op);
+
+extern int
+ncmpi_put_vars_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const int *op);
+extern int
+ncmpi_put_vars_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const int *op);
+
+extern int
+ncmpi_put_vars_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const float *op);
+extern int
+ncmpi_put_vars_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const float *op);
+
+extern int
+ncmpi_put_vars_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const double *op);
+extern int
+ncmpi_put_vars_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const double *op);
+
+extern int
+ncmpi_put_vars_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long long *op);
+extern int
+ncmpi_put_vars_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long long *op);
+
+extern int
+ncmpi_get_vars(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ void *ip, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_get_vars_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ void *ip, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_get_vars_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ signed char *ip);
+extern int
+ncmpi_get_vars_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ signed char *ip);
+
+extern int
+ncmpi_get_vars_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, char *ip);
+extern int
+ncmpi_get_vars_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, char *ip);
+
+extern int
+ncmpi_get_vars_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, short *ip);
+extern int
+ncmpi_get_vars_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, short *ip);
+
+extern int
+ncmpi_get_vars_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, int *ip);
+extern int
+ncmpi_get_vars_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, int *ip);
+
+extern int
+ncmpi_get_vars_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, float *ip);
+extern int
+ncmpi_get_vars_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, float *ip);
+
+extern int
+ncmpi_get_vars_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, double *ip);
+extern int
+ncmpi_get_vars_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, double *ip);
+
+extern int
+ncmpi_get_vars_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long long *ip);
+extern int
+ncmpi_get_vars_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long long *ip);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_var_uchar(int ncid, int varid, const unsigned char *op);
-int ncmpi_put_var_uchar_all(int ncid, int varid, const unsigned char *op);
-
-int ncmpi_put_var_ushort(int ncid, int varid, const unsigned short *op);
-int ncmpi_put_var_ushort_all(int ncid, int varid, const unsigned short *op);
+extern int
+ncmpi_put_vars_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned char *op);
+extern int
+ncmpi_put_vars_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned char *op);
+
+extern int
+ncmpi_put_vars_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned short *op);
+extern int
+ncmpi_put_vars_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned short *op);
+
+extern int
+ncmpi_put_vars_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned int *op);
+extern int
+ncmpi_put_vars_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned int *op);
+
+extern int
+ncmpi_put_vars_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long *op);
+extern int
+ncmpi_put_vars_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long *op);
+
+extern int
+ncmpi_put_vars_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned long long *op);
+extern int
+ncmpi_put_vars_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned long long *op);
+
+extern int
+ncmpi_get_vars_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned char *ip);
+extern int
+ncmpi_get_vars_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned char *ip);
+
+extern int
+ncmpi_get_vars_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned short *ip);
+extern int
+ncmpi_get_vars_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned short *ip);
+
+extern int
+ncmpi_get_vars_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned int *ip);
+extern int
+ncmpi_get_vars_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned int *ip);
+
+extern int
+ncmpi_get_vars_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long *ip);
+extern int
+ncmpi_get_vars_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long *ip);
+
+extern int
+ncmpi_get_vars_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned long long *ip);
+extern int
+ncmpi_get_vars_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned long long *ip);
-int ncmpi_put_var_uint(int ncid, int varid, const unsigned int *op);
-int ncmpi_put_var_uint_all(int ncid, int varid, const unsigned int *op);
-
-int ncmpi_put_var_long(int ncid, int varid, const long *op);
-int ncmpi_put_var_long_all(int ncid, int varid, const long *op);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_var_ulonglong(int ncid, int varid, const unsigned long long *op);
-int ncmpi_put_var_ulonglong_all(int ncid, int varid, const unsigned long long *op);
+/* End {put,get}_vars */
-int ncmpi_get_var_uchar(int ncid, int varid, unsigned char *ip);
-int ncmpi_get_var_uchar_all(int ncid, int varid, unsigned char *ip);
+/* Begin {put,get}_varm */
-int ncmpi_get_var_ushort(int ncid, int varid, unsigned short *ip);
-int ncmpi_get_var_ushort_all(int ncid, int varid, unsigned short *ip);
+extern int
+ncmpi_put_varm(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_varm_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_put_varm_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const char *op);
+extern int
+ncmpi_put_varm_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const char *op);
+
+extern int
+ncmpi_put_varm_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const signed char *op);
+extern int
+ncmpi_put_varm_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const signed char *op);
+
+extern int
+ncmpi_put_varm_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const short *op);
+extern int
+ncmpi_put_varm_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const short *op);
+
+extern int
+ncmpi_put_varm_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const int *op);
+extern int
+ncmpi_put_varm_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const int *op);
+
+extern int
+ncmpi_put_varm_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const float *op);
+extern int
+ncmpi_put_varm_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const float *op);
+
+extern int
+ncmpi_put_varm_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const double *op);
+extern int
+ncmpi_put_varm_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const double *op);
+
+extern int
+ncmpi_put_varm_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long long *op);
+extern int
+ncmpi_put_varm_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long long *op);
+
+extern int
+ncmpi_get_varm(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+extern int
+ncmpi_get_varm_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+
+extern int
+ncmpi_get_varm_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, signed char *ip);
+extern int
+ncmpi_get_varm_schar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, signed char *ip);
+
+extern int
+ncmpi_get_varm_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, char *ip);
+extern int
+ncmpi_get_varm_text_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, char *ip);
+
+extern int
+ncmpi_get_varm_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, short *ip);
+extern int
+ncmpi_get_varm_short_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, short *ip);
+
+extern int
+ncmpi_get_varm_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, int *ip);
+extern int
+ncmpi_get_varm_int_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, int *ip);
+
+extern int
+ncmpi_get_varm_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, float *ip);
+extern int
+ncmpi_get_varm_float_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, float *ip);
+
+extern int
+ncmpi_get_varm_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, double *ip);
+extern int
+ncmpi_get_varm_double_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, double *ip);
+
+extern int
+ncmpi_get_varm_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long long *ip);
+extern int
+ncmpi_get_varm_longlong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long long *ip);
-int ncmpi_get_var_uint(int ncid, int varid, unsigned int *ip);
-int ncmpi_get_var_uint_all(int ncid, int varid, unsigned int *ip);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_get_var_long(int ncid, int varid, long *ip);
-int ncmpi_get_var_long_all(int ncid, int varid, long *ip);
+extern int
+ncmpi_put_varm_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned char *op);
+extern int
+ncmpi_put_varm_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned char *op);
+
+extern int
+ncmpi_put_varm_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned short *op);
+extern int
+ncmpi_put_varm_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned short *op);
+
+extern int
+ncmpi_put_varm_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned int *op);
+extern int
+ncmpi_put_varm_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned int *op);
+
+extern int
+ncmpi_put_varm_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long *op);
+extern int
+ncmpi_put_varm_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long *op);
+
+extern int
+ncmpi_put_varm_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned long long *op);
+extern int
+ncmpi_put_varm_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned long long *op);
+
+extern int
+ncmpi_get_varm_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned char *ip);
+extern int
+ncmpi_get_varm_uchar_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned char *ip);
+
+extern int
+ncmpi_get_varm_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned short *ip);
+extern int
+ncmpi_get_varm_ushort_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned short *ip);
+
+extern int
+ncmpi_get_varm_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned int *ip);
+extern int
+ncmpi_get_varm_uint_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned int *ip);
+
+extern int
+ncmpi_get_varm_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long *ip);
+extern int
+ncmpi_get_varm_long_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long *ip);
+
+extern int
+ncmpi_get_varm_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned long long *ip);
+extern int
+ncmpi_get_varm_ulonglong_all(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned long long *ip);
-int ncmpi_get_var_ulonglong(int ncid, int varid, unsigned long long *ip);
-int ncmpi_get_var_ulonglong_all(int ncid, int varid, unsigned long long *ip);
/* End Skip Prototypes for Fortran binding */
-/* End {put,get}_var */
-
-/* Begin {put,get}_vara */
-
-int ncmpi_put_vara(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-
-int ncmpi_put_vara_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
+/* End {put,get}_varm */
-int ncmpi_put_vara_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const char *op);
+/* Begin of {put,get}_varn{kind} */
-int ncmpi_put_vara_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const char *op);
+extern int
+ncmpi_put_varn(int ncid, int varid, int num, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_varn_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const void *op, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_get_varn(int ncid, int varid, int num, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype);
+extern int
+ncmpi_get_varn_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ void *ip, MPI_Offset bufcount, MPI_Datatype buftype);
+
+extern int
+ncmpi_put_varn_text(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const char *op);
+extern int
+ncmpi_put_varn_text_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const char *op);
+
+extern int
+ncmpi_put_varn_schar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const signed char *op);
+extern int
+ncmpi_put_varn_schar_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const signed char *op);
+
+extern int
+ncmpi_put_varn_short(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const short *op);
+extern int
+ncmpi_put_varn_short_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const short *op);
+
+extern int
+ncmpi_put_varn_int(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const int *op);
+extern int
+ncmpi_put_varn_int_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const int *op);
+
+extern int
+ncmpi_put_varn_float(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const float *op);
+extern int
+ncmpi_put_varn_float_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const float *op);
+
+extern int
+ncmpi_put_varn_double(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const double *op);
+extern int
+ncmpi_put_varn_double_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const double *op);
+
+extern int
+ncmpi_put_varn_longlong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long long *op);
+extern int
+ncmpi_put_varn_longlong_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long long *op);
-int ncmpi_put_vara_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const signed char *op);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_vara_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const signed char *op);
+extern int
+ncmpi_put_varn_uchar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned char *op);
+extern int
+ncmpi_put_varn_uchar_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned char *op);
+
+extern int
+ncmpi_put_varn_ushort(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned short *op);
+extern int
+ncmpi_put_varn_ushort_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned short *op);
+
+extern int
+ncmpi_put_varn_uint(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned int *op);
+extern int
+ncmpi_put_varn_uint_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned int *op);
+
+extern int
+ncmpi_put_varn_long(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long *op);
+extern int
+ncmpi_put_varn_long_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long *op);
+
+extern int
+ncmpi_put_varn_ulonglong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned long long *op);
+extern int
+ncmpi_put_varn_ulonglong_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned long long *op);
-int ncmpi_put_vara_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const short *op);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_vara_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const short *op);
+extern int
+ncmpi_get_varn_text(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *ip);
+extern int
+ncmpi_get_varn_text_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *ip);
+
+extern int
+ncmpi_get_varn_schar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *ip);
+extern int
+ncmpi_get_varn_schar_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *ip);
+
+extern int
+ncmpi_get_varn_short(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *ip);
+extern int
+ncmpi_get_varn_short_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *ip);
+
+extern int
+ncmpi_get_varn_int(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *ip);
+extern int
+ncmpi_get_varn_int_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *ip);
+
+extern int
+ncmpi_get_varn_float(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *ip);
+extern int
+ncmpi_get_varn_float_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *ip);
+
+extern int
+ncmpi_get_varn_double(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *ip);
+extern int
+ncmpi_get_varn_double_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *ip);
+
+extern int
+ncmpi_get_varn_longlong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *ip);
+extern int
+ncmpi_get_varn_longlong_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *ip);
-int ncmpi_put_vara_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const int *op);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_vara_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const int *op);
+extern int
+ncmpi_get_varn_uchar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *ip);
+extern int
+ncmpi_get_varn_uchar_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *ip);
+
+extern int
+ncmpi_get_varn_ushort(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *ip);
+extern int
+ncmpi_get_varn_ushort_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *ip);
+
+extern int
+ncmpi_get_varn_uint(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *ip);
+extern int
+ncmpi_get_varn_uint_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *ip);
+
+extern int
+ncmpi_get_varn_long(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *ip);
+extern int
+ncmpi_get_varn_long_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *ip);
+
+extern int
+ncmpi_get_varn_ulonglong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *ip);
+extern int
+ncmpi_get_varn_ulonglong_all(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *ip);
-int ncmpi_put_vara_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const float *op);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_vara_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const float *op);
+/* End of {put,get}_varn{kind} */
-int ncmpi_put_vara_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const double *op);
+/* Begin {put,get}_vard */
+extern int
+ncmpi_get_vard(int ncid, int varid, MPI_Datatype filetype, void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_get_vard_all(int ncid, int varid, MPI_Datatype filetype, void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_vard(int ncid, int varid, MPI_Datatype filetype, const void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_put_vard_all(int ncid, int varid, MPI_Datatype filetype, const void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype);
+/* End of {put,get}_vard */
-int ncmpi_put_vara_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const double *op);
+/* Begin {mput,mget}_var */
-int ncmpi_put_vara_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long long *op);
+/* #################################################################### */
+/* Begin: more prototypes to be included for Fortran binding conversion */
-int ncmpi_put_vara_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long long *op);
+/* Begin non-blocking data access functions */
-int ncmpi_get_vara(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_wait(int ncid, int count, int array_of_requests[],
+ int array_of_statuses[]);
-int ncmpi_get_vara_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_wait_all(int ncid, int count, int array_of_requests[],
+ int array_of_statuses[]);
-int ncmpi_get_vara_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], char *ip);
+extern int
+ncmpi_cancel(int ncid, int num, int *reqs, int *statuses);
-int ncmpi_get_vara_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], char *ip);
+extern int
+ncmpi_buffer_attach(int ncid, MPI_Offset bufsize);
+extern int
+ncmpi_buffer_detach(int ncid);
+extern int
+ncmpi_inq_buffer_usage(int ncid, MPI_Offset *usage);
+extern int
+ncmpi_inq_buffer_size(int ncid, MPI_Offset *buf_size);
+extern int
+ncmpi_inq_nreqs(int ncid, int *nreqs);
-int ncmpi_get_vara_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], signed char *ip);
+/* Begin {iput,iget,bput}_var1 */
-int ncmpi_get_vara_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], signed char *ip);
+extern int
+ncmpi_iput_var1(int ncid, int varid, const MPI_Offset *start,
+ const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_get_vara_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], short *ip);
+extern int
+ncmpi_iput_var1_text(int ncid, int varid, const MPI_Offset *start,
+ const char *op, int *req);
-int ncmpi_get_vara_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], short *ip);
+extern int
+ncmpi_iput_var1_schar(int ncid, int varid, const MPI_Offset *start,
+ const signed char *op, int *req);
-int ncmpi_get_vara_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], int *ip);
+extern int
+ncmpi_iput_var1_short(int ncid, int varid, const MPI_Offset *start,
+ const short *op, int *req);
-int ncmpi_get_vara_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], int *ip);
+extern int
+ncmpi_iput_var1_int(int ncid, int varid, const MPI_Offset *start,
+ const int *op, int *req);
-int ncmpi_get_vara_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], float *ip);
+extern int
+ncmpi_iput_var1_float(int ncid, int varid, const MPI_Offset *start,
+ const float *op, int *req);
-int ncmpi_get_vara_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], float *ip);
+extern int
+ncmpi_iput_var1_double(int ncid, int varid, const MPI_Offset *start,
+ const double *op, int *req);
-int ncmpi_get_vara_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], double *ip);
+extern int
+ncmpi_iput_var1_longlong(int ncid, int varid, const MPI_Offset *start,
+ const long long *op, int *req);
-int ncmpi_get_vara_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], double *ip);
+extern int
+ncmpi_iget_var1(int ncid, int varid, const MPI_Offset *start, void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-int ncmpi_get_vara_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long long *ip);
+extern int
+ncmpi_iget_var1_schar(int ncid, int varid, const MPI_Offset *start,
+ signed char *ip, int *req);
-int ncmpi_get_vara_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long long *ip);
+extern int
+ncmpi_iget_var1_text(int ncid, int varid, const MPI_Offset *start,
+ char *ip, int *req);
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
+extern int
+ncmpi_iget_var1_short(int ncid, int varid, const MPI_Offset *start,
+ short *ip, int *req);
-int ncmpi_put_vara_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned char *op);
+extern int
+ncmpi_iget_var1_int(int ncid, int varid, const MPI_Offset *start,
+ int *ip, int *req);
-int ncmpi_put_vara_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned char *op);
+extern int
+ncmpi_iget_var1_float(int ncid, int varid, const MPI_Offset *start,
+ float *ip, int *req);
-int ncmpi_put_vara_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned short *op);
+extern int
+ncmpi_iget_var1_double(int ncid, int varid, const MPI_Offset *start,
+ double *ip, int *req);
-int ncmpi_put_vara_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned short *op);
+extern int
+ncmpi_iget_var1_longlong(int ncid, int varid, const MPI_Offset *start,
+ long long *ip, int *req);
-int ncmpi_put_vara_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned int *op);
+extern int
+ncmpi_bput_var1(int ncid, int varid, const MPI_Offset *start, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-int ncmpi_put_vara_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned int *op);
+extern int
+ncmpi_bput_var1_text(int ncid, int varid, const MPI_Offset *start,
+ const char *op, int *req);
-int ncmpi_put_vara_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long *op);
+extern int
+ncmpi_bput_var1_schar(int ncid, int varid, const MPI_Offset *start,
+ const signed char *op, int *req);
-int ncmpi_put_vara_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long *op);
+extern int
+ncmpi_bput_var1_short(int ncid, int varid, const MPI_Offset *start,
+ const short *op, int *req);
-int ncmpi_put_vara_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned long long *op);
+extern int
+ncmpi_bput_var1_int(int ncid, int varid, const MPI_Offset *start,
+ const int *op, int *req);
-int ncmpi_put_vara_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned long long *op);
+extern int
+ncmpi_bput_var1_float(int ncid, int varid, const MPI_Offset *start,
+ const float *op, int *req);
-int ncmpi_get_vara_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned char *ip);
+extern int
+ncmpi_bput_var1_double(int ncid, int varid, const MPI_Offset *start,
+ const double *op, int *req);
-int ncmpi_get_vara_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned char *ip);
+extern int
+ncmpi_bput_var1_longlong(int ncid, int varid, const MPI_Offset *start,
+ const long long *op, int *req);
-int ncmpi_get_vara_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned short *ip);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_get_vara_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned short *ip);
+extern int
+ncmpi_iput_var1_uchar(int ncid, int varid, const MPI_Offset *start,
+ const unsigned char *op, int *req);
-int ncmpi_get_vara_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned int *ip);
+extern int
+ncmpi_iput_var1_ushort(int ncid, int varid, const MPI_Offset *start,
+ const unsigned short *op, int *req);
-int ncmpi_get_vara_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned int *ip);
+extern int
+ncmpi_iput_var1_uint(int ncid, int varid, const MPI_Offset *start,
+ const unsigned int *op, int *req);
-int ncmpi_get_vara_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long *ip);
+extern int
+ncmpi_iput_var1_long(int ncid, int varid, const MPI_Offset *start,
+ const long *ip, int *req);
-int ncmpi_get_vara_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long *ip);
+extern int
+ncmpi_iput_var1_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const unsigned long long *op, int *req);
-int ncmpi_get_vara_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned long long *ip);
+extern int
+ncmpi_iget_var1_uchar(int ncid, int varid, const MPI_Offset *start,
+ unsigned char *ip, int *req);
-int ncmpi_get_vara_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned long long *ip);
+extern int
+ncmpi_iget_var1_ushort(int ncid, int varid, const MPI_Offset *start,
+ unsigned short *ip, int *req);
-/* End Skip Prototypes for Fortran binding */
+extern int
+ncmpi_iget_var1_uint(int ncid, int varid, const MPI_Offset *start,
+ unsigned int *ip, int *req);
-/* End {put,get}_vara */
+extern int
+ncmpi_iget_var1_long(int ncid, int varid, const MPI_Offset *start,
+ long *ip, int *req);
-/* Begin {put,get}_vars */
+extern int
+ncmpi_iget_var1_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ unsigned long long *ip, int *req);
-int ncmpi_put_vars(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_bput_var1_uchar(int ncid, int varid, const MPI_Offset *start,
+ const unsigned char *op, int *req);
-int ncmpi_put_vars_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_bput_var1_ushort(int ncid, int varid, const MPI_Offset *start,
+ const unsigned short *op, int *req);
-int ncmpi_put_vars_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const char *op);
+extern int
+ncmpi_bput_var1_uint(int ncid, int varid, const MPI_Offset *start,
+ const unsigned int *op, int *req);
-int ncmpi_put_vars_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const char *op);
+extern int
+ncmpi_bput_var1_long(int ncid, int varid, const MPI_Offset *start,
+ const long *ip, int *req);
-int ncmpi_put_vars_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const signed char *op);
+extern int
+ncmpi_bput_var1_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const unsigned long long *op, int *req);
-int ncmpi_put_vars_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const signed char *op);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_vars_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const short *op);
+/* End {iput,iget,bput}_var1 */
-int ncmpi_put_vars_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const short *op);
+/* Begin {iput,iget,bput}_var */
-int ncmpi_put_vars_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const int *op);
+extern int
+ncmpi_iput_var(int ncid, int varid, const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_put_vars_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const int *op);
+extern int
+ncmpi_iput_var_schar(int ncid, int varid, const signed char *op, int *req);
-int ncmpi_put_vars_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const float *op);
+extern int
+ncmpi_iput_var_text(int ncid, int varid, const char *op, int *req);
-int ncmpi_put_vars_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const float *op);
+extern int
+ncmpi_iput_var_short(int ncid, int varid, const short *op, int *req);
-int ncmpi_put_vars_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const double *op);
+extern int
+ncmpi_iput_var_int(int ncid, int varid, const int *op, int *req);
-int ncmpi_put_vars_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const double *op);
+extern int
+ncmpi_iput_var_float(int ncid, int varid, const float *op, int *req);
-int ncmpi_put_vars_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long long *op);
+extern int
+ncmpi_iput_var_double(int ncid, int varid, const double *op, int *req);
-int ncmpi_put_vars_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long long *op);
+extern int
+ncmpi_iput_var_longlong(int ncid, int varid, const long long *op, int *req);
-int ncmpi_get_vars(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_iget_var(int ncid, int varid, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_get_vars_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- void *buf, MPI_Offset bufcount, MPI_Datatype buftype);
+extern int
+ncmpi_iget_var_schar(int ncid, int varid, signed char *ip, int *req);
-int ncmpi_get_vars_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- signed char *ip);
+extern int
+ncmpi_iget_var_text(int ncid, int varid, char *ip, int *req);
-int ncmpi_get_vars_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- signed char *ip);
+extern int
+ncmpi_iget_var_short(int ncid, int varid, short *ip, int *req);
-int ncmpi_get_vars_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- char *ip);
+extern int
+ncmpi_iget_var_int(int ncid, int varid, int *ip, int *req);
-int ncmpi_get_vars_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- char *ip);
+extern int
+ncmpi_iget_var_float(int ncid, int varid, float *ip, int *req);
-int ncmpi_get_vars_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- short *ip);
+extern int
+ncmpi_iget_var_double(int ncid, int varid, double *ip, int *req);
-int ncmpi_get_vars_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- short *ip);
+extern int
+ncmpi_iget_var_longlong(int ncid, int varid, long long *ip, int *req);
-int ncmpi_get_vars_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- int *ip);
+extern int
+ncmpi_bput_var(int ncid, int varid, const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_get_vars_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- int *ip);
+extern int
+ncmpi_bput_var_schar(int ncid, int varid, const signed char *op, int *req);
-int ncmpi_get_vars_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- float *ip);
+extern int
+ncmpi_bput_var_text(int ncid, int varid, const char *op, int *req);
-int ncmpi_get_vars_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- float *ip);
+extern int
+ncmpi_bput_var_short(int ncid, int varid, const short *op, int *req);
-int ncmpi_get_vars_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- double *ip);
+extern int
+ncmpi_bput_var_int(int ncid, int varid, const int *op, int *req);
-int ncmpi_get_vars_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- double *ip);
+extern int
+ncmpi_bput_var_float(int ncid, int varid, const float *op, int *req);
-int ncmpi_get_vars_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long long *ip);
+extern int
+ncmpi_bput_var_double(int ncid, int varid, const double *op, int *req);
-int ncmpi_get_vars_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long long *ip);
+extern int
+ncmpi_bput_var_longlong(int ncid, int varid, const long long *op, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_vars_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned char *op);
-
-int ncmpi_put_vars_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned char *op);
-
-int ncmpi_put_vars_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned short *op);
-
-int ncmpi_put_vars_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned short *op);
+extern int
+ncmpi_iput_var_uchar(int ncid, int varid, const unsigned char *op, int *req);
-int ncmpi_put_vars_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned int *op);
+extern int
+ncmpi_iput_var_ushort(int ncid, int varid, const unsigned short *op, int *req);
-int ncmpi_put_vars_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned int *op);
+extern int
+ncmpi_iput_var_uint(int ncid, int varid, const unsigned int *op, int *req);
-int ncmpi_put_vars_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long *op);
+extern int
+ncmpi_iput_var_long(int ncid, int varid, const long *op, int *req);
-int ncmpi_put_vars_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long *op);
+extern int
+ncmpi_iput_var_ulonglong(int ncid, int varid, const unsigned long long *op,
+ int *req);
-int ncmpi_put_vars_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned long long *op);
+extern int
+ncmpi_iget_var_uchar(int ncid, int varid, unsigned char *ip, int *req);
-int ncmpi_put_vars_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned long long *op);
+extern int
+ncmpi_iget_var_ushort(int ncid, int varid, unsigned short *ip, int *req);
-int ncmpi_get_vars_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned char *ip);
+extern int
+ncmpi_iget_var_uint(int ncid, int varid, unsigned int *ip, int *req);
-int ncmpi_get_vars_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned char *ip);
+extern int
+ncmpi_iget_var_long(int ncid, int varid, long *ip, int *req);
-int ncmpi_get_vars_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned short *ip);
+extern int
+ncmpi_iget_var_ulonglong(int ncid, int varid, unsigned long long *ip, int *req);
-int ncmpi_get_vars_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned short *ip);
+extern int
+ncmpi_bput_var_uchar(int ncid, int varid, const unsigned char *op, int *req);
-int ncmpi_get_vars_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned int *ip);
+extern int
+ncmpi_bput_var_ushort(int ncid, int varid, const unsigned short *op, int *req);
-int ncmpi_get_vars_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned int *ip);
+extern int
+ncmpi_bput_var_uint(int ncid, int varid, const unsigned int *op, int *req);
-int ncmpi_get_vars_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long *ip);
+extern int
+ncmpi_bput_var_long(int ncid, int varid, const long *op, int *req);
-int ncmpi_get_vars_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long *ip);
-
-int ncmpi_get_vars_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned long long *ip);
-
-int ncmpi_get_vars_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned long long *ip);
+extern int
+ncmpi_bput_var_ulonglong(int ncid, int varid, const unsigned long long *op,
+ int *req);
/* End Skip Prototypes for Fortran binding */
-/* End {put,get}_vars */
-
-/* Begin {put,get}_varm */
-
-int ncmpi_put_varm(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-
-int ncmpi_put_varm_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-
-int ncmpi_put_varm_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const char *op);
-
-int ncmpi_put_varm_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const char *op);
-
-int ncmpi_put_varm_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const signed char *op);
-
-int ncmpi_put_varm_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const signed char *op);
-
-int ncmpi_put_varm_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const short *op);
+/* End {iput,iget,bput}_var */
-int ncmpi_put_varm_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const short *op);
+/* Begin {iput,iget,bput}_vara */
-int ncmpi_put_varm_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const int *op);
+extern int
+ncmpi_iput_vara(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-int ncmpi_put_varm_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const int *op);
+extern int
+ncmpi_iput_vara_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const signed char *op, int *req);
-int ncmpi_put_varm_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const float *op);
+extern int
+ncmpi_iput_vara_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const char *op, int *req);
-int ncmpi_put_varm_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const float *op);
+extern int
+ncmpi_iput_vara_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const short *op, int *req);
-int ncmpi_put_varm_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const double *op);
+extern int
+ncmpi_iput_vara_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const int *op, int *req);
-int ncmpi_put_varm_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const double *op);
+extern int
+ncmpi_iput_vara_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const float *op, int *req);
-int ncmpi_put_varm_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long long *op);
+extern int
+ncmpi_iput_vara_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const double *op, int *req);
-int ncmpi_put_varm_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long long *op);
+extern int
+ncmpi_iput_vara_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long long *op, int *req);
-int ncmpi_get_varm(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_iget_vara(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_get_varm_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
+extern int
+ncmpi_iget_vara_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, signed char *ip, int *req);
-int ncmpi_get_varm_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], signed char *ip);
+extern int
+ncmpi_iget_vara_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, char *ip, int *req);
-int ncmpi_get_varm_schar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], signed char *ip);
+extern int
+ncmpi_iget_vara_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, short *ip, int *req);
-int ncmpi_get_varm_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], char *ip);
+extern int
+ncmpi_iget_vara_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, int *ip, int *req);
-int ncmpi_get_varm_text_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], char *ip);
+extern int
+ncmpi_iget_vara_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, float *ip, int *req);
-int ncmpi_get_varm_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], short *ip);
+extern int
+ncmpi_iget_vara_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, double *ip, int *req);
-int ncmpi_get_varm_short_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], short *ip);
+extern int
+ncmpi_iget_vara_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long long *ip, int *req);
-int ncmpi_get_varm_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], int *ip);
+extern int
+ncmpi_bput_vara(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-int ncmpi_get_varm_int_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], int *ip);
+extern int
+ncmpi_bput_vara_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const signed char *op, int *req);
-int ncmpi_get_varm_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], float *ip);
+extern int
+ncmpi_bput_vara_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const char *op, int *req);
-int ncmpi_get_varm_float_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], float *ip);
+extern int
+ncmpi_bput_vara_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const short *op, int *req);
-int ncmpi_get_varm_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], double *ip);
+extern int
+ncmpi_bput_vara_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const int *op, int *req);
-int ncmpi_get_varm_double_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], double *ip);
+extern int
+ncmpi_bput_vara_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const float *op, int *req);
-int ncmpi_get_varm_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long long *ip);
+extern int
+ncmpi_bput_vara_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const double *op, int *req);
-int ncmpi_get_varm_longlong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long long *ip);
+extern int
+ncmpi_bput_vara_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long long *op, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_varm_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned char *op);
-
-int ncmpi_put_varm_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned char *op);
-
-int ncmpi_put_varm_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned short *op);
+extern int
+ncmpi_iput_vara_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned char *op, int *req);
-int ncmpi_put_varm_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned short *op);
+extern int
+ncmpi_iput_vara_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned short *op, int *req);
-int ncmpi_put_varm_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned int *op);
+extern int
+ncmpi_iput_vara_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned int *op, int *req);
-int ncmpi_put_varm_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned int *op);
+extern int
+ncmpi_iput_vara_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long *op, int *req);
-int ncmpi_put_varm_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long *op);
+extern int
+ncmpi_iput_vara_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned long long *op,
+ int *req);
-int ncmpi_put_varm_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long *op);
+extern int
+ncmpi_iget_vara_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned char *ip, int *req);
-int ncmpi_put_varm_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned long long *op);
+extern int
+ncmpi_iget_vara_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned short *ip, int *req);
-int ncmpi_put_varm_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned long long *op);
+extern int
+ncmpi_iget_vara_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned int *ip, int *req);
-int ncmpi_get_varm_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned char *ip);
+extern int
+ncmpi_iget_vara_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, long *ip, int *req);
-int ncmpi_get_varm_uchar_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned char *ip);
+extern int
+ncmpi_iget_vara_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, unsigned long long *ip, int *req);
-int ncmpi_get_varm_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned short *ip);
+extern int
+ncmpi_bput_vara_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned char *op, int *req);
-int ncmpi_get_varm_ushort_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned short *ip);
+extern int
+ncmpi_bput_vara_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned short *op, int *req);
-int ncmpi_get_varm_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned int *ip);
+extern int
+ncmpi_bput_vara_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned int *op, int *req);
-int ncmpi_get_varm_uint_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned int *ip);
+extern int
+ncmpi_bput_vara_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const long *op, int *req);
-int ncmpi_get_varm_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long *ip);
-
-int ncmpi_get_varm_long_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long *ip);
-
-int ncmpi_get_varm_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned long long *ip);
-
-int ncmpi_get_varm_ulonglong_all(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned long long *ip);
+extern int
+ncmpi_bput_vara_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const unsigned long long *op,
+ int *req);
/* End Skip Prototypes for Fortran binding */
-/* End {put,get}_varm */
-
-/* Begin of {put,get}_varn{kind} */
-
-int ncmpi_put_varn(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_put_varn_all(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_get_varn(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_get_varn_all(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype);
-
-int ncmpi_put_varn_text(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const char *buf);
-
-int ncmpi_put_varn_schar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const signed char *buf);
-
-int ncmpi_put_varn_short(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const short *buf);
-
-int ncmpi_put_varn_int(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const int *buf);
-
-int ncmpi_put_varn_float(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const float *buf);
-
-int ncmpi_put_varn_double(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const double *buf);
+/* End {iput,iget,bput}_vara */
-int ncmpi_put_varn_longlong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long long *buf);
+/* Begin {iput,iget,bput}_vars */
+extern int
+ncmpi_iput_vars(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_iput_vars_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const signed char *op, int *req);
+
+extern int
+ncmpi_iput_vars_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const char *op, int *req);
+
+extern int
+ncmpi_iput_vars_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const short *op, int *req);
+
+extern int
+ncmpi_iput_vars_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const int *op, int *req);
+
+extern int
+ncmpi_iput_vars_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const float *op, int *req);
+
+extern int
+ncmpi_iput_vars_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const double *op, int *req);
+
+extern int
+ncmpi_iput_vars_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long long *op, int *req);
+
+extern int
+ncmpi_iget_vars(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride, void *ip,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_iget_vars_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ signed char *ip, int *req);
+
+extern int
+ncmpi_iget_vars_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ char *ip, int *req);
+
+extern int
+ncmpi_iget_vars_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ short *ip, int *req);
+
+extern int
+ncmpi_iget_vars_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ int *ip, int *req);
+
+extern int
+ncmpi_iget_vars_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ float *ip, int *req);
+
+extern int
+ncmpi_iget_vars_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ double *ip, int *req);
+
+extern int
+ncmpi_iget_vars_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long long *ip, int *req);
+
+extern int
+ncmpi_bput_vars(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_bput_vars_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const signed char *op, int *req);
+
+extern int
+ncmpi_bput_vars_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const char *op, int *req);
+
+extern int
+ncmpi_bput_vars_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const short *op, int *req);
+
+extern int
+ncmpi_bput_vars_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const int *op, int *req);
+
+extern int
+ncmpi_bput_vars_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const float *op, int *req);
+
+extern int
+ncmpi_bput_vars_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const double *op, int *req);
+
+extern int
+ncmpi_bput_vars_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long long *op, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_varn_uchar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned char *buf);
-
-int ncmpi_put_varn_ushort(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned short *buf);
-
-int ncmpi_put_varn_uint(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned int *buf);
-
-int ncmpi_put_varn_long(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long *buf);
-
-int ncmpi_put_varn_ulonglong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned long long *buf);
+extern int
+ncmpi_iput_vars_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned char *op, int *req);
+
+extern int
+ncmpi_iput_vars_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned short *op, int *req);
+
+extern int
+ncmpi_iput_vars_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned int *op, int *req);
+
+extern int
+ncmpi_iput_vars_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long *op, int *req);
+
+extern int
+ncmpi_iput_vars_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned long long *op, int *req);
+
+extern int
+ncmpi_iget_vars_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned char *ip, int *req);
+
+extern int
+ncmpi_iget_vars_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned short *ip, int *req);
+
+extern int
+ncmpi_iget_vars_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned int *ip, int *req);
+
+extern int
+ncmpi_iget_vars_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ long *ip, int *req);
+
+extern int
+ncmpi_iget_vars_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ unsigned long long *ip, int *req);
+
+extern int
+ncmpi_bput_vars_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned char *op, int *req);
+
+extern int
+ncmpi_bput_vars_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned short *op, int *req);
+
+extern int
+ncmpi_bput_vars_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned int *op, int *req);
+
+extern int
+ncmpi_bput_vars_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const long *op, int *req);
+
+extern int
+ncmpi_bput_vars_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const unsigned long long *op, int *req);
/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_varn_text_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const char *buf);
-
-int ncmpi_put_varn_schar_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const signed char *buf);
-
-int ncmpi_put_varn_short_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const short *buf);
-
-int ncmpi_put_varn_int_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const int *buf);
-
-int ncmpi_put_varn_float_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const float *buf);
-
-int ncmpi_put_varn_double_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const double *buf);
+/* End {iput,iget,bput}_vars */
-int ncmpi_put_varn_longlong_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long long *buf);
+/* Begin {iput,iget,bput}_varm */
+extern int
+ncmpi_iput_varm(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_iput_varm_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const signed char *op,
+ int *req);
+
+extern int
+ncmpi_iput_varm_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const char *op, int *req);
+
+extern int
+ncmpi_iput_varm_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const short *op, int *req);
+
+extern int
+ncmpi_iput_varm_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const int *op, int *req);
+
+extern int
+ncmpi_iput_varm_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const float *op, int *req);
+
+extern int
+ncmpi_iput_varm_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const double *op, int *req);
+
+extern int
+ncmpi_iput_varm_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long long *op, int *req);
+
+extern int
+ncmpi_iget_varm(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, void *ip, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_iget_varm_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, signed char *ip, int *req);
+
+extern int
+ncmpi_iget_varm_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, char *ip, int *req);
+
+extern int
+ncmpi_iget_varm_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, short *ip, int *req);
+
+extern int
+ncmpi_iget_varm_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, int *ip, int *req);
+
+extern int
+ncmpi_iget_varm_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, float *ip, int *req);
+
+extern int
+ncmpi_iget_varm_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, double *ip, int *req);
+
+extern int
+ncmpi_iget_varm_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long long *ip, int *req);
+
+extern int
+ncmpi_bput_varm(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
+
+extern int
+ncmpi_bput_varm_schar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const signed char *op, int *req);
+
+extern int
+ncmpi_bput_varm_text(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const char *op, int *req);
+
+extern int
+ncmpi_bput_varm_short(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const short *op, int *req);
+
+extern int
+ncmpi_bput_varm_int(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const int *op, int *req);
+
+extern int
+ncmpi_bput_varm_float(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const float *op, int *req);
+
+extern int
+ncmpi_bput_varm_double(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const double *op, int *req);
+
+extern int
+ncmpi_bput_varm_longlong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long long *op, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_put_varn_uchar_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned char *buf);
+extern int
+ncmpi_iput_varm_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned char *op, int *req);
+
+extern int
+ncmpi_iput_varm_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned short *op, int *req);
+
+extern int
+ncmpi_iput_varm_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned int *op, int *req);
+
+extern int
+ncmpi_iput_varm_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long *op, int *req);
+
+extern int
+ncmpi_iput_varm_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned long long *op,
+ int *req);
+
+extern int
+ncmpi_iget_varm_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned char *ip, int *req);
+
+extern int
+ncmpi_iget_varm_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned short *ip, int *req);
+
+extern int
+ncmpi_iget_varm_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned int *ip, int *req);
+
+extern int
+ncmpi_iget_varm_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, long *ip, int *req);
+
+extern int
+ncmpi_iget_varm_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, unsigned long long *ip, int *req);
+
+extern int
+ncmpi_bput_varm_uchar(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned char *op,
+ int *req);
+
+extern int
+ncmpi_bput_varm_ushort(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned short *op,
+ int *req);
+
+extern int
+ncmpi_bput_varm_uint(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned int *op,
+ int *req);
+
+extern int
+ncmpi_bput_varm_long(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const long *op, int *req);
+
+extern int
+ncmpi_bput_varm_ulonglong(int ncid, int varid, const MPI_Offset *start,
+ const MPI_Offset *count, const MPI_Offset *stride,
+ const MPI_Offset *imap, const unsigned long long *op,
+ int *req);
-int ncmpi_put_varn_ushort_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned short *buf);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_put_varn_uint_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned int *buf);
+/* End {iput,iget,bput}_varm */
-int ncmpi_put_varn_long_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long *buf);
+/* Begin of nonblocking {iput,iget}_varn{kind} */
-int ncmpi_put_varn_ulonglong_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned long long *buf);
+extern int
+ncmpi_iput_varn(int ncid, int varid, int num, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-/* End Skip Prototypes for Fortran binding */
+extern int
+ncmpi_iget_varn(int ncid, int varid, int num, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, void *op, MPI_Offset bufcount,
+ MPI_Datatype buftype, int *req);
-int ncmpi_get_varn_text(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *buf);
+extern int
+ncmpi_iput_varn_text(int ncid, int varid, int num,
+ MPI_Offset* const *starts,
+ MPI_Offset* const *counts, const char *op, int *req);
-int ncmpi_get_varn_schar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *buf);
+extern int
+ncmpi_iput_varn_schar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const signed char *op, int *req);
-int ncmpi_get_varn_short(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *buf);
+extern int
+ncmpi_iput_varn_short(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const short *op, int *req);
-int ncmpi_get_varn_int(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *buf);
+extern int
+ncmpi_iput_varn_int(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const int *op, int *req);
-int ncmpi_get_varn_float(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *buf);
+extern int
+ncmpi_iput_varn_float(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const float *op, int *req);
-int ncmpi_get_varn_double(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *buf);
+extern int
+ncmpi_iput_varn_double(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const double *op, int *req);
-int ncmpi_get_varn_longlong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *buf);
+extern int
+ncmpi_iput_varn_longlong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long long *op, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_get_varn_uchar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *buf);
+extern int
+ncmpi_iput_varn_uchar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned char *op, int *req);
-int ncmpi_get_varn_ushort(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *buf);
+extern int
+ncmpi_iput_varn_ushort(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned short *op, int *req);
-int ncmpi_get_varn_uint(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *buf);
+extern int
+ncmpi_iput_varn_uint(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned int *op, int *req);
-int ncmpi_get_varn_long(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *buf);
+extern int
+ncmpi_iput_varn_long(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long *op, int *req);
-int ncmpi_get_varn_ulonglong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *buf);
+extern int
+ncmpi_iput_varn_ulonglong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned long long *op, int *req);
/* End Skip Prototypes for Fortran binding */
-int ncmpi_get_varn_text_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *buf);
+extern int
+ncmpi_iget_varn_text(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *ip, int *req);
-int ncmpi_get_varn_schar_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *buf);
+extern int
+ncmpi_iget_varn_schar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *ip, int *req);
-int ncmpi_get_varn_short_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *buf);
+extern int
+ncmpi_iget_varn_short(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *ip, int *req);
-int ncmpi_get_varn_int_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *buf);
+extern int
+ncmpi_iget_varn_int(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *ip, int *req);
-int ncmpi_get_varn_float_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *buf);
+extern int
+ncmpi_iget_varn_float(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *ip, int *req);
-int ncmpi_get_varn_double_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *buf);
+extern int
+ncmpi_iget_varn_double(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *ip, int *req);
-int ncmpi_get_varn_longlong_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *buf);
+extern int
+ncmpi_iget_varn_longlong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *ip, int *req);
/* Begin Skip Prototypes for Fortran binding */
/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_get_varn_uchar_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *buf);
+extern int
+ncmpi_iget_varn_uchar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *ip, int *req);
-int ncmpi_get_varn_ushort_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *buf);
+extern int
+ncmpi_iget_varn_ushort(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *ip, int *req);
-int ncmpi_get_varn_uint_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *buf);
+extern int
+ncmpi_iget_varn_uint(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *ip, int *req);
-int ncmpi_get_varn_long_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *buf);
+extern int
+ncmpi_iget_varn_long(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *ip, int *req);
-int ncmpi_get_varn_ulonglong_all(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *buf);
+extern int
+ncmpi_iget_varn_ulonglong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *ip, int *req);
/* End Skip Prototypes for Fortran binding */
-/* End of {put,get}_varn{kind} */
-
-/* Begin {put,get}_vard */
-int ncmpi_get_vard(int ncid, int varid, MPI_Datatype filetype, void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-int ncmpi_get_vard_all(int ncid, int varid, MPI_Datatype filetype, void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-int ncmpi_put_vard(int ncid, int varid, MPI_Datatype filetype, const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-int ncmpi_put_vard_all(int ncid, int varid, MPI_Datatype filetype, const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype);
-/* End of {put,get}_vard */
-
-/* Begin {mput,mget}_var */
-
-/* #################################################################### */
-/* Begin: more prototypes to be included for Fortran binding conversion */
-
-/* Begin non-blocking data access functions */
-
-int ncmpi_wait(int ncid, int count, int array_of_requests[],
- int array_of_statuses[]);
-
-int ncmpi_wait_all(int ncid, int count, int array_of_requests[],
- int array_of_statuses[]);
-
-int ncmpi_cancel(int ncid, int num, int *requests, int *statuses);
+/* End of {iput,iget}_varn{kind} */
-int ncmpi_buffer_attach(int ncid, MPI_Offset bufsize);
-int ncmpi_buffer_detach(int ncid);
-int ncmpi_inq_buffer_usage(int ncid, MPI_Offset *usage);
-int ncmpi_inq_buffer_size(int ncid, MPI_Offset *buf_size);
-int ncmpi_inq_nreqs(int ncid, int *nreqs);
+/* Begin of nonblocking bput_varn{kind} */
-/* Begin {iput,iget,bput}_var1 */
+extern int
+ncmpi_bput_varn(int ncid, int varid, int num, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, const void *op,
+ MPI_Offset bufcount, MPI_Datatype buftype, int *req);
-int ncmpi_iput_var1(int ncid, int varid, const MPI_Offset index[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
+extern int
+ncmpi_bput_varn_text(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const char *op, int *req);
-int ncmpi_iput_var1_text(int ncid, int varid, const MPI_Offset index[],
- const char *op, int *request);
+extern int
+ncmpi_bput_varn_schar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const signed char *op, int *req);
-int ncmpi_iput_var1_schar(int ncid, int varid, const MPI_Offset index[],
- const signed char *op, int *request);
+extern int
+ncmpi_bput_varn_short(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const short *op, int *req);
-int ncmpi_iput_var1_short(int ncid, int varid, const MPI_Offset index[],
- const short *op, int *request);
+extern int
+ncmpi_bput_varn_int(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const int *op, int *req);
-int ncmpi_iput_var1_int(int ncid, int varid, const MPI_Offset index[],
- const int *op, int *request);
+extern int
+ncmpi_bput_varn_float(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const float *op, int *req);
-int ncmpi_iput_var1_float(int ncid, int varid, const MPI_Offset index[],
- const float *op, int *request);
+extern int
+ncmpi_bput_varn_double(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const double *op, int *req);
-int ncmpi_iput_var1_double(int ncid, int varid, const MPI_Offset index[],
- const double *op, int *request);
+extern int
+ncmpi_bput_varn_longlong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long long *op, int *req);
-int ncmpi_iput_var1_longlong(int ncid, int varid, const MPI_Offset index[],
- const long long *op, int *request);
-int ncmpi_iget_var1(int ncid, int varid, const MPI_Offset index[], void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype, int *request);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-int ncmpi_iget_var1_schar(int ncid, int varid, const MPI_Offset index[],
- signed char *ip, int *request);
+extern int
+ncmpi_bput_varn_uchar(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned char *op, int *req);
-int ncmpi_iget_var1_text(int ncid, int varid, const MPI_Offset index[],
- char *ip, int *request);
+extern int
+ncmpi_bput_varn_ushort(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned short *op, int *req);
-int ncmpi_iget_var1_short(int ncid, int varid, const MPI_Offset index[],
- short *ip, int *request);
+extern int
+ncmpi_bput_varn_uint(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned int *op, int *req);
-int ncmpi_iget_var1_int(int ncid, int varid, const MPI_Offset index[],
- int *ip, int *request);
+extern int
+ncmpi_bput_varn_long(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const long *op, int *req);
-int ncmpi_iget_var1_float(int ncid, int varid, const MPI_Offset index[],
- float *ip, int *request);
+extern int
+ncmpi_bput_varn_ulonglong(int ncid, int varid, int num,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ const unsigned long long *op, int *req);
-int ncmpi_iget_var1_double(int ncid, int varid, const MPI_Offset index[],
- double *ip, int *request);
+/* End Skip Prototypes for Fortran binding */
-int ncmpi_iget_var1_longlong(int ncid, int varid, const MPI_Offset index[],
- long long *ip, int *request);
+/* End of bput_varn{kind} */
-int ncmpi_bput_var1(int ncid, int varid, const MPI_Offset index[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
+/* End non-blocking data access functions */
-int ncmpi_bput_var1_text(int ncid, int varid, const MPI_Offset index[],
- const char *op, int *request);
+/* Begin Skip Prototypes for Fortran binding */
+/* skip all mput/mget APIs as Fortran cannot handle array of buffers */
-int ncmpi_bput_var1_schar(int ncid, int varid, const MPI_Offset index[],
- const signed char *op, int *request);
+extern int
+ncmpi_mput_var(int ncid, int num, int *varids, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_var_all(int ncid, int num, int *varids, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_var_text(int ncid, int num, int *varids, char *bufs[]);
+extern int
+ncmpi_mput_var_text_all(int ncid, int num, int *varids, char *bufs[]);
+
+extern int
+ncmpi_mput_var_schar(int ncid, int num, int *varids, signed char *bufs[]);
+extern int
+ncmpi_mput_var_schar_all(int ncid, int num, int *varids, signed char *bufs[]);
+
+extern int
+ncmpi_mput_var_uchar(int ncid, int num, int *varids, unsigned char *bufs[]);
+extern int
+ncmpi_mput_var_uchar_all(int ncid, int num, int *varids, unsigned char *bufs[]);
+
+extern int
+ncmpi_mput_var_short(int ncid, int num, int *varids, short *bufs[]);
+extern int
+ncmpi_mput_var_short_all(int ncid, int num, int *varids, short *bufs[]);
+
+extern int
+ncmpi_mput_var_ushort(int ncid, int num, int *varids, unsigned short *bufs[]);
+extern int
+ncmpi_mput_var_ushort_all(int ncid, int num, int *varids,
+ unsigned short *bufs[]);
-int ncmpi_bput_var1_short(int ncid, int varid, const MPI_Offset index[],
- const short *op, int *request);
+extern int
+ncmpi_mput_var_int(int ncid, int num, int *varids, int *bufs[]);
+extern int
+ncmpi_mput_var_int_all(int ncid, int num, int *varids, int *bufs[]);
+
+extern int
+ncmpi_mput_var_uint(int ncid, int num, int *varids, unsigned int *bufs[]);
+extern int
+ncmpi_mput_var_uint_all(int ncid, int num, int *varids, unsigned int *bufs[]);
+
+extern int
+ncmpi_mput_var_long(int ncid, int num, int *varids, long *bufs[]);
+extern int
+ncmpi_mput_var_long_all(int ncid, int num, int *varids, long *bufs[]);
+
+extern int
+ncmpi_mput_var_float(int ncid, int num, int *varids, float *bufs[]);
+extern int
+ncmpi_mput_var_float_all(int ncid, int num, int *varids, float *bufs[]);
+
+extern int
+ncmpi_mput_var_double(int ncid, int num, int *varids, double *bufs[]);
+extern int
+ncmpi_mput_var_double_all(int ncid, int num, int *varids, double *bufs[]);
+
+extern int
+ncmpi_mput_var_longlong(int ncid, int num, int *varids, long long *bufs[]);
+extern int
+ncmpi_mput_var_longlong_all(int ncid, int num, int *varids, long long *bufs[]);
+
+extern int
+ncmpi_mput_var_ulonglong(int ncid, int num, int *varids,
+ unsigned long long *bufs[]);
+extern int
+ncmpi_mput_var_ulonglong_all(int ncid, int num, int *varids,
+ unsigned long long *bufs[]);
-int ncmpi_bput_var1_int(int ncid, int varid, const MPI_Offset index[],
- const int *op, int *request);
+extern int
+ncmpi_mput_var1(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+extern int
+ncmpi_mput_var1_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_var1_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, char *bufs[]);
+extern int
+ncmpi_mput_var1_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, char *bufs[]);
+
+extern int
+ncmpi_mput_var1_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, signed char *bufs[]);
+extern int
+ncmpi_mput_var1_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, signed char *bufs[]);
+
+extern int
+ncmpi_mput_var1_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned char *bufs[]);
+extern int
+ncmpi_mput_var1_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned char *bufs[]);
+
+extern int
+ncmpi_mput_var1_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, short *bufs[]);
+extern int
+ncmpi_mput_var1_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, short *bufs[]);
+
+extern int
+ncmpi_mput_var1_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned short *bufs[]);
+extern int
+ncmpi_mput_var1_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned short *bufs[]);
+
+extern int
+ncmpi_mput_var1_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, int *bufs[]);
+extern int
+ncmpi_mput_var1_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, int *bufs[]);
+
+extern int
+ncmpi_mput_var1_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned int *bufs[]);
+extern int
+ncmpi_mput_var1_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned int *bufs[]);
+
+extern int
+ncmpi_mput_var1_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long *bufs[]);
+extern int
+ncmpi_mput_var1_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long *bufs[]);
+
+extern int
+ncmpi_mput_var1_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, float *bufs[]);
+extern int
+ncmpi_mput_var1_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, float *bufs[]);
+
+extern int
+ncmpi_mput_var1_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, double *bufs[]);
+extern int
+ncmpi_mput_var1_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, double *bufs[]);
+
+extern int
+ncmpi_mput_var1_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long long *bufs[]);
+extern int
+ncmpi_mput_var1_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long long *bufs[]);
+
+extern int
+ncmpi_mput_var1_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned long long *bufs[]);
+extern int
+ncmpi_mput_var1_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned long long *bufs[]);
+
+
+extern int
+ncmpi_mput_vara(int ncid, int num, int *varids, MPI_Offset* const *starts,
+ MPI_Offset* const *counts, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+extern int
+ncmpi_mput_vara_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_vara_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *bufs[]);
+extern int
+ncmpi_mput_vara_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *bufs[]);
-int ncmpi_bput_var1_float(int ncid, int varid, const MPI_Offset index[],
- const float *op, int *request);
+extern int
+ncmpi_mput_vara_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *bufs[]);
+extern int
+ncmpi_mput_vara_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *bufs[]);
-int ncmpi_bput_var1_double(int ncid, int varid, const MPI_Offset index[],
- const double *op, int *request);
+extern int
+ncmpi_mput_vara_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *bufs[]);
+extern int
+ncmpi_mput_vara_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *bufs[]);
-int ncmpi_bput_var1_longlong(int ncid, int varid, const MPI_Offset index[],
- const long long *op, int *request);
+extern int
+ncmpi_mput_vara_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *bufs[]);
+extern int
+ncmpi_mput_vara_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *bufs[]);
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
+extern int
+ncmpi_mput_vara_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *bufs[]);
+extern int
+ncmpi_mput_vara_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *bufs[]);
-int ncmpi_iput_var1_uchar(int ncid, int varid, const MPI_Offset index[],
- const unsigned char *op, int *request);
+extern int
+ncmpi_mput_vara_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *bufs[]);
+extern int
+ncmpi_mput_vara_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *bufs[]);
-int ncmpi_iput_var1_ushort(int ncid, int varid, const MPI_Offset index[],
- const unsigned short *op, int *request);
+extern int
+ncmpi_mput_vara_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *bufs[]);
+extern int
+ncmpi_mput_vara_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *bufs[]);
-int ncmpi_iput_var1_uint(int ncid, int varid, const MPI_Offset index[],
- const unsigned int *op, int *request);
+extern int
+ncmpi_mput_vara_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *bufs[]);
+extern int
+ncmpi_mput_vara_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *bufs[]);
-int ncmpi_iput_var1_long(int ncid, int varid, const MPI_Offset index[],
- const long *ip, int *request);
+extern int
+ncmpi_mput_vara_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *bufs[]);
+extern int
+ncmpi_mput_vara_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *bufs[]);
-int ncmpi_iput_var1_ulonglong(int ncid, int varid, const MPI_Offset index[],
- const unsigned long long *op, int *request);
+extern int
+ncmpi_mput_vara_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *bufs[]);
+extern int
+ncmpi_mput_vara_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *bufs[]);
-int ncmpi_iget_var1_uchar(int ncid, int varid, const MPI_Offset index[],
- unsigned char *ip, int *request);
+extern int
+ncmpi_mput_vara_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *bufs[]);
+extern int
+ncmpi_mput_vara_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *bufs[]);
-int ncmpi_iget_var1_ushort(int ncid, int varid, const MPI_Offset index[],
- unsigned short *ip, int *request);
+extern int
+ncmpi_mput_vara_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *bufs[]);
+extern int
+ncmpi_mput_vara_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *bufs[]);
-int ncmpi_iget_var1_uint(int ncid, int varid, const MPI_Offset index[],
- unsigned int *ip, int *request);
-int ncmpi_iget_var1_long(int ncid, int varid, const MPI_Offset index[],
- long *ip, int *request);
+extern int
+ncmpi_mput_vars(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_vars_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_vars_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, char *bufs[]);
+extern int
+ncmpi_mput_vars_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, char *bufs[]);
+
+extern int
+ncmpi_mput_vars_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, signed char *bufs[]);
+extern int
+ncmpi_mput_vars_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, signed char *bufs[]);
+
+extern int
+ncmpi_mput_vars_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned char *bufs[]);
+extern int
+ncmpi_mput_vars_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned char *bufs[]);
+
+extern int
+ncmpi_mput_vars_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, short *bufs[]);
+extern int
+ncmpi_mput_vars_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, short *bufs[]);
+
+extern int
+ncmpi_mput_vars_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned short *bufs[]);
+extern int
+ncmpi_mput_vars_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned short *bufs[]);
+
+extern int
+ncmpi_mput_vars_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, int *bufs[]);
+extern int
+ncmpi_mput_vars_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, int *bufs[]);
+
+extern int
+ncmpi_mput_vars_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned int *bufs[]);
+extern int
+ncmpi_mput_vars_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned int *bufs[]);
+
+extern int
+ncmpi_mput_vars_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long *bufs[]);
+extern int
+ncmpi_mput_vars_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long *bufs[]);
+
+extern int
+ncmpi_mput_vars_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, float *bufs[]);
+extern int
+ncmpi_mput_vars_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, float *bufs[]);
+
+extern int
+ncmpi_mput_vars_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, double *bufs[]);
+extern int
+ncmpi_mput_vars_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, double *bufs[]);
+
+extern int
+ncmpi_mput_vars_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long long *bufs[]);
+extern int
+ncmpi_mput_vars_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long long *bufs[]);
+
+extern int
+ncmpi_mput_vars_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned long long *bufs[]);
+extern int
+ncmpi_mput_vars_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned long long *bufs[]);
+
+extern int
+ncmpi_mput_varm(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+extern int
+ncmpi_mput_varm_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype datatypes[]);
+
+extern int
+ncmpi_mput_varm_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ char *bufs[]);
+extern int
+ncmpi_mput_varm_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ char *bufs[]);
-int ncmpi_iget_var1_ulonglong(int ncid, int varid, const MPI_Offset index[],
- unsigned long long *ip, int *request);
+extern int
+ncmpi_mput_varm_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ signed char *bufs[]);
+extern int
+ncmpi_mput_varm_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ signed char *bufs[]);
-int ncmpi_bput_var1_uchar(int ncid, int varid, const MPI_Offset index[],
- const unsigned char *op, int *request);
+extern int
+ncmpi_mput_varm_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned char *bufs[]);
+extern int
+ncmpi_mput_varm_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned char *bufs[]);
-int ncmpi_bput_var1_ushort(int ncid, int varid, const MPI_Offset index[],
- const unsigned short *op, int *request);
+extern int
+ncmpi_mput_varm_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ short *bufs[]);
+extern int
+ncmpi_mput_varm_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ short *bufs[]);
-int ncmpi_bput_var1_uint(int ncid, int varid, const MPI_Offset index[],
- const unsigned int *op, int *request);
+extern int
+ncmpi_mput_varm_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned short *bufs[]);
+extern int
+ncmpi_mput_varm_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned short *bufs[]);
-int ncmpi_bput_var1_long(int ncid, int varid, const MPI_Offset index[],
- const long *ip, int *request);
+extern int
+ncmpi_mput_varm_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ int *bufs[]);
+extern int
+ncmpi_mput_varm_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ int *bufs[]);
-int ncmpi_bput_var1_ulonglong(int ncid, int varid, const MPI_Offset index[],
- const unsigned long long *op, int *request);
+extern int
+ncmpi_mput_varm_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned int *bufs[]);
+extern int
+ncmpi_mput_varm_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned int *bufs[]);
-/* End Skip Prototypes for Fortran binding */
+extern int
+ncmpi_mput_varm_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long *bufs[]);
+extern int
+ncmpi_mput_varm_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long *bufs[]);
-/* End {iput,iget,bput}_var1 */
+extern int
+ncmpi_mput_varm_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ float *bufs[]);
+extern int
+ncmpi_mput_varm_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ float *bufs[]);
-/* Begin {iput,iget,bput}_var */
+extern int
+ncmpi_mput_varm_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ double *bufs[]);
+extern int
+ncmpi_mput_varm_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ double *bufs[]);
-int ncmpi_iput_var(int ncid, int varid, const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
+extern int
+ncmpi_mput_varm_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long long *bufs[]);
+extern int
+ncmpi_mput_varm_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long long *bufs[]);
-int ncmpi_iput_var_schar(int ncid, int varid, const signed char *op,
- int *request);
+extern int
+ncmpi_mput_varm_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned long long *bufs[]);
+extern int
+ncmpi_mput_varm_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned long long *bufs[]);
-int ncmpi_iput_var_text(int ncid, int varid, const char *op, int *request);
+extern int
+ncmpi_mget_var(int ncid, int num, int *varids, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_var_all(int ncid, int num, int *varids, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_var_text(int ncid, int num, int *varids, char *bufs[]);
+extern int
+ncmpi_mget_var_text_all(int ncid, int num, int *varids, char *bufs[]);
+
+extern int
+ncmpi_mget_var_schar(int ncid, int num, int *varids, signed char *bufs[]);
+extern int
+ncmpi_mget_var_schar_all(int ncid, int num, int *varids, signed char *bufs[]);
+
+extern int
+ncmpi_mget_var_uchar(int ncid, int num, int *varids, unsigned char *bufs[]);
+extern int
+ncmpi_mget_var_uchar_all(int ncid, int num, int *varids, unsigned char *bufs[]);
+
+extern int
+ncmpi_mget_var_short(int ncid, int num, int *varids, short *bufs[]);
+extern int
+ncmpi_mget_var_short_all(int ncid, int num, int *varids, short *bufs[]);
+
+extern int
+ncmpi_mget_var_ushort(int ncid, int num, int *varids, unsigned short *bufs[]);
+extern int
+ncmpi_mget_var_ushort_all(int ncid, int num, int *varids,
+ unsigned short *bufs[]);
-int ncmpi_iput_var_short(int ncid, int varid, const short *op, int *request);
+extern int
+ncmpi_mget_var_int(int ncid, int num, int *varids, int *bufs[]);
+extern int
+ncmpi_mget_var_int_all(int ncid, int num, int *varids, int *bufs[]);
+
+extern int
+ncmpi_mget_var_uint(int ncid, int num, int *varids, unsigned int *bufs[]);
+extern int
+ncmpi_mget_var_uint_all(int ncid, int num, int *varids, unsigned int *bufs[]);
+
+extern int
+ncmpi_mget_var_long(int ncid, int num, int *varids, long *bufs[]);
+extern int
+ncmpi_mget_var_long_all(int ncid, int num, int *varids, long *bufs[]);
+
+extern int
+ncmpi_mget_var_float(int ncid, int num, int *varids, float *bufs[]);
+extern int
+ncmpi_mget_var_float_all(int ncid, int num, int *varids, float *bufs[]);
+
+extern int
+ncmpi_mget_var_double(int ncid, int num, int *varids, double *bufs[]);
+extern int
+ncmpi_mget_var_double_all(int ncid, int num, int *varids, double *bufs[]);
+
+extern int
+ncmpi_mget_var_longlong(int ncid, int num, int *varids, long long *bufs[]);
+extern int
+ncmpi_mget_var_longlong_all(int ncid, int num, int *varids, long long *bufs[]);
+
+extern int
+ncmpi_mget_var_ulonglong(int ncid, int num, int *varids,
+ unsigned long long *bufs[]);
+extern int
+ncmpi_mget_var_ulonglong_all(int ncid, int num, int *varids,
+ unsigned long long *bufs[]);
-int ncmpi_iput_var_int(int ncid, int varid, const int *op, int *request);
+extern int
+ncmpi_mget_var1(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+extern int
+ncmpi_mget_var1_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_var1_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, char *bufs[]);
+extern int
+ncmpi_mget_var1_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, char *bufs[]);
+
+extern int
+ncmpi_mget_var1_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, signed char *bufs[]);
+extern int
+ncmpi_mget_var1_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, signed char *bufs[]);
+
+extern int
+ncmpi_mget_var1_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned char *bufs[]);
+extern int
+ncmpi_mget_var1_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned char *bufs[]);
+
+extern int
+ncmpi_mget_var1_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, short *bufs[]);
+extern int
+ncmpi_mget_var1_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, short *bufs[]);
+
+extern int
+ncmpi_mget_var1_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned short *bufs[]);
+extern int
+ncmpi_mget_var1_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned short *bufs[]);
+
+extern int
+ncmpi_mget_var1_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, int *bufs[]);
+extern int
+ncmpi_mget_var1_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, int *bufs[]);
+
+extern int
+ncmpi_mget_var1_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned int *bufs[]);
+extern int
+ncmpi_mget_var1_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned int *bufs[]);
+
+extern int
+ncmpi_mget_var1_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long *bufs[]);
+extern int
+ncmpi_mget_var1_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long *bufs[]);
+
+extern int
+ncmpi_mget_var1_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, float *bufs[]);
+extern int
+ncmpi_mget_var1_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, float *bufs[]);
+
+extern int
+ncmpi_mget_var1_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, double *bufs[]);
+extern int
+ncmpi_mget_var1_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, double *bufs[]);
+
+extern int
+ncmpi_mget_var1_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long long *bufs[]);
+extern int
+ncmpi_mget_var1_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, long long *bufs[]);
+
+extern int
+ncmpi_mget_var1_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned long long *bufs[]);
+extern int
+ncmpi_mget_var1_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, unsigned long long *bufs[]);
+
+
+extern int
+ncmpi_mget_vara(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+extern int
+ncmpi_mget_vara_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_vara_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *bufs[]);
+extern int
+ncmpi_mget_vara_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ char *bufs[]);
-int ncmpi_iput_var_float(int ncid, int varid, const float *op, int *request);
+extern int
+ncmpi_mget_vara_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *bufs[]);
+extern int
+ncmpi_mget_vara_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ signed char *bufs[]);
-int ncmpi_iput_var_double(int ncid, int varid, const double *op, int *request);
+extern int
+ncmpi_mget_vara_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *bufs[]);
+extern int
+ncmpi_mget_vara_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned char *bufs[]);
-int ncmpi_iput_var_longlong(int ncid, int varid, const long long *op, int *request);
+extern int
+ncmpi_mget_vara_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *bufs[]);
+extern int
+ncmpi_mget_vara_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ short *bufs[]);
-int ncmpi_iget_var(int ncid, int varid, void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
+extern int
+ncmpi_mget_vara_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *bufs[]);
+extern int
+ncmpi_mget_vara_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned short *bufs[]);
-int ncmpi_iget_var_schar(int ncid, int varid, signed char *ip, int *request);
+extern int
+ncmpi_mget_vara_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *bufs[]);
+extern int
+ncmpi_mget_vara_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ int *bufs[]);
-int ncmpi_iget_var_text(int ncid, int varid, char *ip, int *request);
+extern int
+ncmpi_mget_vara_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *bufs[]);
+extern int
+ncmpi_mget_vara_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned int *bufs[]);
-int ncmpi_iget_var_short(int ncid, int varid, short *ip, int *request);
+extern int
+ncmpi_mget_vara_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *bufs[]);
+extern int
+ncmpi_mget_vara_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long *bufs[]);
-int ncmpi_iget_var_int(int ncid, int varid, int *ip, int *request);
+extern int
+ncmpi_mget_vara_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *bufs[]);
+extern int
+ncmpi_mget_vara_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ float *bufs[]);
-int ncmpi_iget_var_float(int ncid, int varid, float *ip, int *request);
+extern int
+ncmpi_mget_vara_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *bufs[]);
+extern int
+ncmpi_mget_vara_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ double *bufs[]);
-int ncmpi_iget_var_double(int ncid, int varid, double *ip, int *request);
+extern int
+ncmpi_mget_vara_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *bufs[]);
+extern int
+ncmpi_mget_vara_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ long long *bufs[]);
-int ncmpi_iget_var_longlong(int ncid, int varid, long long *ip, int *request);
+extern int
+ncmpi_mget_vara_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *bufs[]);
+extern int
+ncmpi_mget_vara_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ unsigned long long *bufs[]);
-int ncmpi_bput_var(int ncid, int varid, const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
+extern int
+ncmpi_mget_vars(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+extern int
+ncmpi_mget_vars_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, void *bufs[],
+ MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_vars_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, char *bufs[]);
+extern int
+ncmpi_mget_vars_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, char *bufs[]);
+
+extern int
+ncmpi_mget_vars_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, signed char *bufs[]);
+extern int
+ncmpi_mget_vars_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, signed char *bufs[]);
+
+extern int
+ncmpi_mget_vars_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned char *bufs[]);
+extern int
+ncmpi_mget_vars_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned char *bufs[]);
+
+extern int
+ncmpi_mget_vars_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, short *bufs[]);
+extern int
+ncmpi_mget_vars_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, short *bufs[]);
+
+extern int
+ncmpi_mget_vars_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned short *bufs[]);
+extern int
+ncmpi_mget_vars_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned short *bufs[]);
+
+extern int
+ncmpi_mget_vars_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, int *bufs[]);
+extern int
+ncmpi_mget_vars_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, int *bufs[]);
+
+extern int
+ncmpi_mget_vars_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned int *bufs[]);
+extern int
+ncmpi_mget_vars_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned int *bufs[]);
+
+extern int
+ncmpi_mget_vars_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long *bufs[]);
+extern int
+ncmpi_mget_vars_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long *bufs[]);
+
+extern int
+ncmpi_mget_vars_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, float *bufs[]);
+extern int
+ncmpi_mget_vars_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, float *bufs[]);
+
+extern int
+ncmpi_mget_vars_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, double *bufs[]);
+extern int
+ncmpi_mget_vars_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, double *bufs[]);
+
+extern int
+ncmpi_mget_vars_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long long *bufs[]);
+extern int
+ncmpi_mget_vars_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, long long *bufs[]);
+
+extern int
+ncmpi_mget_vars_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned long long *bufs[]);
+extern int
+ncmpi_mget_vars_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, unsigned long long *bufs[]);
+
+extern int
+ncmpi_mget_varm(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_varm_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ void *bufs[], MPI_Offset *bufcounts, MPI_Datatype *datatypes);
+
+extern int
+ncmpi_mget_varm_text(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ char *bufs[]);
+extern int
+ncmpi_mget_varm_text_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ char *bufs[]);
-int ncmpi_bput_var_schar(int ncid, int varid, const signed char *op,
- int *request);
+extern int
+ncmpi_mget_varm_schar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ signed char *bufs[]);
+extern int
+ncmpi_mget_varm_schar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ signed char *bufs[]);
-int ncmpi_bput_var_text(int ncid, int varid, const char *op, int *request);
+extern int
+ncmpi_mget_varm_uchar(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned char *bufs[]);
+extern int
+ncmpi_mget_varm_uchar_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned char *bufs[]);
-int ncmpi_bput_var_short(int ncid, int varid, const short *op, int *request);
+extern int
+ncmpi_mget_varm_short(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ short *bufs[]);
+extern int
+ncmpi_mget_varm_short_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ short *bufs[]);
-int ncmpi_bput_var_int(int ncid, int varid, const int *op, int *request);
+extern int
+ncmpi_mget_varm_ushort(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned short *bufs[]);
+extern int
+ncmpi_mget_varm_ushort_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned short *bufs[]);
-int ncmpi_bput_var_float(int ncid, int varid, const float *op, int *request);
+extern int
+ncmpi_mget_varm_int(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ int *bufs[]);
+extern int
+ncmpi_mget_varm_int_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ int *bufs[]);
-int ncmpi_bput_var_double(int ncid, int varid, const double *op, int *request);
+extern int
+ncmpi_mget_varm_uint(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned int *bufs[]);
+extern int
+ncmpi_mget_varm_uint_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ unsigned int *bufs[]);
-int ncmpi_bput_var_longlong(int ncid, int varid, const long long *op, int *request);
+extern int
+ncmpi_mget_varm_long(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long *bufs[]);
+extern int
+ncmpi_mget_varm_long_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long *bufs[]);
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
+extern int
+ncmpi_mget_varm_float(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ float *bufs[]);
+extern int
+ncmpi_mget_varm_float_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ float *bufs[]);
-int ncmpi_iput_var_uchar(int ncid, int varid, const unsigned char *op,
- int *request);
+extern int
+ncmpi_mget_varm_double(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ double *bufs[]);
+extern int
+ncmpi_mget_varm_double_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ double *bufs[]);
-int ncmpi_iput_var_ushort(int ncid, int varid, const unsigned short *op,
- int *request);
+extern int
+ncmpi_mget_varm_longlong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long long *bufs[]);
+extern int
+ncmpi_mget_varm_longlong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
+ long long *bufs[]);
-int ncmpi_iput_var_uint(int ncid, int varid, const unsigned int *op,
- int *request);
-
-int ncmpi_iput_var_long(int ncid, int varid, const long *op, int *request);
-
-int ncmpi_iput_var_ulonglong(int ncid, int varid, const unsigned long long *op,
- int *request);
-
-int ncmpi_iget_var_uchar(int ncid, int varid, unsigned char *ip, int *request);
-
-int ncmpi_iget_var_ushort(int ncid, int varid, unsigned short *ip, int *request);
-
-int ncmpi_iget_var_uint(int ncid, int varid, unsigned int *ip, int *request);
-
-int ncmpi_iget_var_long(int ncid, int varid, long *ip, int *request);
-
-int ncmpi_iget_var_ulonglong(int ncid, int varid, unsigned long long *ip, int *request);
-
-int ncmpi_bput_var_uchar(int ncid, int varid, const unsigned char *op,
- int *request);
-
-int ncmpi_bput_var_ushort(int ncid, int varid, const unsigned short *op,
- int *request);
-
-int ncmpi_bput_var_uint(int ncid, int varid, const unsigned int *op,
- int *request);
-
-int ncmpi_bput_var_long(int ncid, int varid, const long *op, int *request);
-
-int ncmpi_bput_var_ulonglong(int ncid, int varid, const unsigned long long *op,
- int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End {iput,iget,bput}_var */
-
-/* Begin {iput,iget,bput}_vara */
-
-int ncmpi_iput_vara(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype, int *request);
-
-int ncmpi_iput_vara_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const signed char *op,
- int *request);
-
-int ncmpi_iput_vara_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const char *op, int *request);
-
-int ncmpi_iput_vara_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const short *op, int *request);
-
-int ncmpi_iput_vara_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const int *op, int *request);
-
-int ncmpi_iput_vara_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const float *op, int *request);
-
-int ncmpi_iput_vara_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const double *op, int *request);
-
-int ncmpi_iput_vara_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long long *op, int *request);
-
-int ncmpi_iget_vara(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_iget_vara_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], signed char *ip, int *request);
-
-int ncmpi_iget_vara_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], char *ip, int *request);
-
-int ncmpi_iget_vara_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], short *ip, int *request);
-
-int ncmpi_iget_vara_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], int *ip, int *request);
-
-int ncmpi_iget_vara_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], float *ip, int *request);
-
-int ncmpi_iget_vara_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], double *ip, int *request);
-
-int ncmpi_iget_vara_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long long *ip, int *request);
-
-int ncmpi_bput_vara(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype, int *request);
-
-int ncmpi_bput_vara_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const signed char *op,
- int *request);
-
-int ncmpi_bput_vara_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const char *op, int *request);
-
-int ncmpi_bput_vara_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const short *op, int *request);
-
-int ncmpi_bput_vara_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const int *op, int *request);
-
-int ncmpi_bput_vara_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const float *op, int *request);
-
-int ncmpi_bput_vara_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const double *op, int *request);
-
-int ncmpi_bput_vara_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long long *op, int *request);
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_iput_vara_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned char *op,
- int *request);
-
-int ncmpi_iput_vara_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned short *op,
- int *request);
-
-int ncmpi_iput_vara_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned int *op,
- int *request);
-
-int ncmpi_iput_vara_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long *op, int *request);
-
-int ncmpi_iput_vara_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned long long *op,
- int *request);
-
-int ncmpi_iget_vara_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned char *ip, int *request);
-
-int ncmpi_iget_vara_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned short *ip, int *request);
-
-int ncmpi_iget_vara_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned int *ip, int *request);
-
-int ncmpi_iget_vara_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], long *ip, int *request);
-
-int ncmpi_iget_vara_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], unsigned long long *ip, int *request);
-
-int ncmpi_bput_vara_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned char *op,
- int *request);
-
-int ncmpi_bput_vara_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned short *op,
- int *request);
-
-int ncmpi_bput_vara_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned int *op,
- int *request);
-
-int ncmpi_bput_vara_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const long *op, int *request);
-
-int ncmpi_bput_vara_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const unsigned long long *op,
- int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End {iput,iget,bput}_vara */
-
-/* Begin {iput,iget,bput}_vars */
-
-int ncmpi_iput_vars(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_iput_vars_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const signed char *op, int *request);
-
-int ncmpi_iput_vars_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const char *op, int *request);
-
-int ncmpi_iput_vars_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const short *op, int *request);
-
-int ncmpi_iput_vars_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const int *op, int *request);
-
-int ncmpi_iput_vars_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const float *op, int *request);
-
-int ncmpi_iput_vars_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const double *op, int *request);
-
-int ncmpi_iput_vars_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long long *op, int *request);
-
-int ncmpi_iget_vars(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- void *buf, MPI_Offset bufcount, MPI_Datatype buftype,
- int *request);
-
-int ncmpi_iget_vars_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- signed char *ip, int *request);
-
-int ncmpi_iget_vars_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- char *ip, int *request);
-
-int ncmpi_iget_vars_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- short *ip, int *request);
-
-int ncmpi_iget_vars_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- int *ip, int *request);
-
-int ncmpi_iget_vars_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- float *ip, int *request);
-
-int ncmpi_iget_vars_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- double *ip, int *request);
-
-int ncmpi_iget_vars_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long long *ip, int *request);
-
-int ncmpi_bput_vars(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_bput_vars_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const signed char *op, int *request);
-
-int ncmpi_bput_vars_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const char *op, int *request);
-
-int ncmpi_bput_vars_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const short *op, int *request);
-
-int ncmpi_bput_vars_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const int *op, int *request);
-
-int ncmpi_bput_vars_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const float *op, int *request);
-
-int ncmpi_bput_vars_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const double *op, int *request);
-
-int ncmpi_bput_vars_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long long *op, int *request);
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_iput_vars_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned char *op, int *request);
-
-int ncmpi_iput_vars_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned short *op, int *request);
-
-int ncmpi_iput_vars_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned int *op, int *request);
-
-int ncmpi_iput_vars_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long *op, int *request);
-
-int ncmpi_iput_vars_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned long long *op, int *request);
-
-int ncmpi_iget_vars_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned char *ip, int *request);
-
-int ncmpi_iget_vars_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned short *ip, int *request);
-
-int ncmpi_iget_vars_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned int *ip, int *request);
-
-int ncmpi_iget_vars_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- long *ip, int *request);
-
-int ncmpi_iget_vars_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- unsigned long long *ip, int *request);
-
-int ncmpi_bput_vars_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned char *op, int *request);
-
-int ncmpi_bput_vars_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned short *op, int *request);
-
-int ncmpi_bput_vars_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned int *op, int *request);
-
-int ncmpi_bput_vars_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const long *op, int *request);
-
-int ncmpi_bput_vars_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const unsigned long long *op, int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End {iput,iget,bput}_vars */
-
-/* Begin {iput,iget,bput}_varm */
-
-int ncmpi_iput_varm(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype, int *request);
-
-int ncmpi_iput_varm_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const signed char *op,
- int *request);
-
-int ncmpi_iput_varm_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const char *op, int *request);
-
-int ncmpi_iput_varm_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const short *op, int *request);
-
-int ncmpi_iput_varm_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const int *op, int *request);
-
-int ncmpi_iput_varm_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const float *op, int *request);
-
-int ncmpi_iput_varm_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const double *op, int *request);
-
-int ncmpi_iput_varm_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long long *op, int *request);
-
-int ncmpi_iget_varm(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_iget_varm_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], signed char *ip, int *request);
-
-int ncmpi_iget_varm_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], char *ip, int *request);
-
-int ncmpi_iget_varm_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], short *ip, int *request);
-
-int ncmpi_iget_varm_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], int *ip, int *request);
-
-int ncmpi_iget_varm_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], float *ip, int *request);
-
-int ncmpi_iget_varm_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], double *ip, int *request);
-
-int ncmpi_iget_varm_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long long *ip, int *request);
-
-int ncmpi_bput_varm(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const void *buf,
- MPI_Offset bufcount, MPI_Datatype buftype, int *request);
-
-int ncmpi_bput_varm_schar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const signed char *op,
- int *request);
-
-int ncmpi_bput_varm_text(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const char *op, int *request);
-
-int ncmpi_bput_varm_short(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const short *op, int *request);
-
-int ncmpi_bput_varm_int(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const int *op, int *request);
-
-int ncmpi_bput_varm_float(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const float *op, int *request);
-
-int ncmpi_bput_varm_double(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const double *op, int *request);
-
-int ncmpi_bput_varm_longlong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long long *op, int *request);
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_iput_varm_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned char *op,
- int *request);
-
-int ncmpi_iput_varm_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned short *op,
- int *request);
-
-int ncmpi_iput_varm_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned int *op,
- int *request);
-
-int ncmpi_iput_varm_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long *op, int *request);
-
-int ncmpi_iput_varm_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned long long *op,
- int *request);
-
-int ncmpi_iget_varm_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned char *ip, int *request);
-
-int ncmpi_iget_varm_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned short *ip, int *request);
-
-int ncmpi_iget_varm_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned int *ip, int *request);
-
-int ncmpi_iget_varm_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], long *ip, int *request);
-
-int ncmpi_iget_varm_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], unsigned long long *ip, int *request);
-
-int ncmpi_bput_varm_uchar(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned char *op,
- int *request);
-
-int ncmpi_bput_varm_ushort(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned short *op,
- int *request);
-
-int ncmpi_bput_varm_uint(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned int *op,
- int *request);
-
-int ncmpi_bput_varm_long(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const long *op, int *request);
-
-int ncmpi_bput_varm_ulonglong(int ncid, int varid, const MPI_Offset start[],
- const MPI_Offset count[], const MPI_Offset stride[],
- const MPI_Offset imap[], const unsigned long long *op,
- int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End {iput,iget,bput}_varm */
-
-/* Begin of nonblocking {iput,iget}_varn{kind} */
-
-int ncmpi_iput_varn(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_iget_varn(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_iput_varn_text(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const char *buf, int *request);
-
-int ncmpi_iput_varn_schar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const signed char *buf, int *request);
-
-int ncmpi_iput_varn_short(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const short *buf, int *request);
-
-int ncmpi_iput_varn_int(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const int *buf, int *request);
-
-int ncmpi_iput_varn_float(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const float *buf, int *request);
-
-int ncmpi_iput_varn_double(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const double *buf, int *request);
-
-int ncmpi_iput_varn_longlong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long long *buf, int *request);
-
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_iput_varn_uchar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned char *buf, int *request);
-
-int ncmpi_iput_varn_ushort(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned short *buf, int *request);
-
-int ncmpi_iput_varn_uint(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned int *buf, int *request);
-
-int ncmpi_iput_varn_long(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long *buf, int *request);
-
-int ncmpi_iput_varn_ulonglong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned long long *buf, int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-int ncmpi_iget_varn_text(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *buf, int *request);
-
-int ncmpi_iget_varn_schar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *buf, int *request);
-
-int ncmpi_iget_varn_short(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *buf, int *request);
-
-int ncmpi_iget_varn_int(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *buf, int *request);
-
-int ncmpi_iget_varn_float(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *buf, int *request);
-
-int ncmpi_iget_varn_double(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *buf, int *request);
-
-int ncmpi_iget_varn_longlong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *buf, int *request);
-
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_iget_varn_uchar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *buf, int *request);
-
-int ncmpi_iget_varn_ushort(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *buf, int *request);
-
-int ncmpi_iget_varn_uint(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *buf, int *request);
-
-int ncmpi_iget_varn_long(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *buf, int *request);
-
-int ncmpi_iget_varn_ulonglong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *buf, int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End of {iput,iget}_varn{kind} */
-
-/* Begin of nonblocking bput_varn{kind} */
-
-int ncmpi_bput_varn(int ncid, int varid, int num, MPI_Offset* const starts[],
- MPI_Offset* const counts[], const void *buf, MPI_Offset bufcount,
- MPI_Datatype buftype, int *request);
-
-int ncmpi_bput_varn_text(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const char *buf, int *request);
-
-int ncmpi_bput_varn_schar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const signed char *buf, int *request);
-
-int ncmpi_bput_varn_short(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const short *buf, int *request);
-
-int ncmpi_bput_varn_int(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const int *buf, int *request);
-
-int ncmpi_bput_varn_float(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const float *buf, int *request);
-
-int ncmpi_bput_varn_double(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const double *buf, int *request);
-
-int ncmpi_bput_varn_longlong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long long *buf, int *request);
-
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip types: uchar, ubyte, ushort, uint, long, ulonglong string */
-
-int ncmpi_bput_varn_uchar(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned char *buf, int *request);
-
-int ncmpi_bput_varn_ushort(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned short *buf, int *request);
-
-int ncmpi_bput_varn_uint(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned int *buf, int *request);
-
-int ncmpi_bput_varn_long(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const long *buf, int *request);
-
-int ncmpi_bput_varn_ulonglong(int ncid, int varid, int num,
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- const unsigned long long *buf, int *request);
-
-/* End Skip Prototypes for Fortran binding */
-
-/* End of bput_varn{kind} */
-
-/* End non-blocking data access functions */
-
-/* Begin Skip Prototypes for Fortran binding */
-/* skip all mput/mget APIs as Fortran cannot handle array of buffers */
-
-int ncmpi_mput_var(int ncid, int num, int varids[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_var_all(int ncid, int num, int varids[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_var_text(int ncid, int num, int varids[],
- char *bufs[]);
-
-int ncmpi_mput_var_schar(int ncid, int num, int varids[],
- signed char *bufs[]);
-
-int ncmpi_mput_var_uchar(int ncid, int num, int varids[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_var_short(int ncid, int num, int varids[],
- short *bufs[]);
-
-int ncmpi_mput_var_ushort(int ncid, int num, int varids[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_var_int(int ncid, int num, int varids[],
- int *bufs[]);
-
-int ncmpi_mput_var_uint(int ncid, int num, int varids[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_var_long(int ncid, int num, int varids[],
- long *bufs[]);
-
-int ncmpi_mput_var_float(int ncid, int num, int varids[],
- float *bufs[]);
-
-int ncmpi_mput_var_double(int ncid, int num, int varids[],
- double *bufs[]);
-
-int ncmpi_mput_var_longlong(int ncid, int num, int varids[],
- long long *bufs[]);
-
-int ncmpi_mput_var_ulonglong(int ncid, int num, int varids[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mput_var_text_all(int ncid, int num, int varids[],
- char *bufs[]);
-
-int ncmpi_mput_var_schar_all(int ncid, int num, int varids[],
- signed char *bufs[]);
-
-int ncmpi_mput_var_uchar_all(int ncid, int num, int varids[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_var_short_all(int ncid, int num, int varids[],
- short *bufs[]);
-
-int ncmpi_mput_var_ushort_all(int ncid, int num, int varids[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_var_int_all(int ncid, int num, int varids[],
- int *bufs[]);
-
-int ncmpi_mput_var_uint_all(int ncid, int num, int varids[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_var_long_all(int ncid, int num, int varids[],
- long *bufs[]);
-
-int ncmpi_mput_var_float_all(int ncid, int num, int varids[],
- float *bufs[]);
-
-int ncmpi_mput_var_double_all(int ncid, int num, int varids[],
- double *bufs[]);
-
-int ncmpi_mput_var_longlong_all(int ncid, int num, int varids[],
- long long *bufs[]);
-
-int ncmpi_mput_var_ulonglong_all(int ncid, int num, int varids[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mput_var1(int ncid, int num, int varids[],
- MPI_Offset* const starts[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_var1_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_var1_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], char *bufs[]);
-
-int ncmpi_mput_var1_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], signed char *bufs[]);
-
-int ncmpi_mput_var1_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned char *bufs[]);
-
-int ncmpi_mput_var1_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], short *bufs[]);
-
-int ncmpi_mput_var1_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned short *bufs[]);
-
-int ncmpi_mput_var1_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], int *bufs[]);
-
-int ncmpi_mput_var1_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned int *bufs[]);
-
-int ncmpi_mput_var1_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long *bufs[]);
-
-int ncmpi_mput_var1_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], float *bufs[]);
-
-int ncmpi_mput_var1_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], double *bufs[]);
-
-int ncmpi_mput_var1_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long long *bufs[]);
-
-int ncmpi_mput_var1_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned long long *bufs[]);
-
-
-int ncmpi_mput_var1_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], char *bufs[]);
-
-int ncmpi_mput_var1_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], signed char *bufs[]);
-
-int ncmpi_mput_var1_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned char *bufs[]);
-
-int ncmpi_mput_var1_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], short *bufs[]);
-
-int ncmpi_mput_var1_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned short *bufs[]);
-
-int ncmpi_mput_var1_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], int *bufs[]);
-
-int ncmpi_mput_var1_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned int *bufs[]);
-
-int ncmpi_mput_var1_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long *bufs[]);
-
-int ncmpi_mput_var1_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], float *bufs[]);
-
-int ncmpi_mput_var1_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], double *bufs[]);
-
-int ncmpi_mput_var1_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long long *bufs[]);
-
-int ncmpi_mput_var1_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned long long *bufs[]);
-
-
-int ncmpi_mput_vara(int ncid, int num, int varids[], MPI_Offset* const starts[],
- MPI_Offset* const counts[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_vara_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mput_vara_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *bufs[]);
-
-int ncmpi_mput_vara_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *bufs[]);
-
-int ncmpi_mput_vara_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_vara_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *bufs[]);
-
-int ncmpi_mput_vara_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_vara_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *bufs[]);
-
-int ncmpi_mput_vara_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_vara_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *bufs[]);
-
-int ncmpi_mput_vara_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *bufs[]);
-
-int ncmpi_mput_vara_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *bufs[]);
-
-int ncmpi_mput_vara_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *bufs[]);
-
-int ncmpi_mput_vara_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mput_vara_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *bufs[]);
-
-int ncmpi_mput_vara_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *bufs[]);
-
-int ncmpi_mput_vara_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_vara_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *bufs[]);
-
-int ncmpi_mput_vara_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_vara_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *bufs[]);
-
-int ncmpi_mput_vara_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_vara_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *bufs[]);
-
-int ncmpi_mput_vara_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *bufs[]);
-
-int ncmpi_mput_vara_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *bufs[]);
-
-int ncmpi_mput_vara_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *bufs[]);
-
-int ncmpi_mput_vara_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mput_vars(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_vars_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mput_vars_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], char *bufs[]);
-
-int ncmpi_mput_vars_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], signed char *bufs[]);
-
-int ncmpi_mput_vars_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned char *bufs[]);
-
-int ncmpi_mput_vars_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], short *bufs[]);
-
-int ncmpi_mput_vars_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned short *bufs[]);
-
-int ncmpi_mput_vars_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], int *bufs[]);
-
-int ncmpi_mput_vars_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned int *bufs[]);
-
-int ncmpi_mput_vars_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long *bufs[]);
-
-int ncmpi_mput_vars_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], float *bufs[]);
-
-int ncmpi_mput_vars_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], double *bufs[]);
-
-int ncmpi_mput_vars_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long long *bufs[]);
-
-int ncmpi_mput_vars_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned long long *bufs[]);
-
-
-int ncmpi_mput_vars_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], char *bufs[]);
-
-int ncmpi_mput_vars_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], signed char *bufs[]);
-
-int ncmpi_mput_vars_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned char *bufs[]);
-
-int ncmpi_mput_vars_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], short *bufs[]);
-
-int ncmpi_mput_vars_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned short *bufs[]);
-
-int ncmpi_mput_vars_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], int *bufs[]);
-
-int ncmpi_mput_vars_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned int *bufs[]);
-
-int ncmpi_mput_vars_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long *bufs[]);
-
-int ncmpi_mput_vars_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], float *bufs[]);
-
-int ncmpi_mput_vars_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], double *bufs[]);
-
-int ncmpi_mput_vars_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long long *bufs[]);
-
-int ncmpi_mput_vars_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned long long *bufs[]);
-
-
-int ncmpi_mput_varm(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mput_varm_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mput_varm_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- char *bufs[]);
-
-int ncmpi_mput_varm_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- signed char *bufs[]);
-
-int ncmpi_mput_varm_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_varm_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- short *bufs[]);
-
-int ncmpi_mput_varm_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_varm_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- int *bufs[]);
-
-int ncmpi_mput_varm_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_varm_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long *bufs[]);
-
-int ncmpi_mput_varm_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- float *bufs[]);
-
-int ncmpi_mput_varm_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- double *bufs[]);
-
-int ncmpi_mput_varm_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long long *bufs[]);
-
-int ncmpi_mput_varm_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mput_varm_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- char *bufs[]);
-
-int ncmpi_mput_varm_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- signed char *bufs[]);
-
-int ncmpi_mput_varm_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned char *bufs[]);
-
-int ncmpi_mput_varm_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- short *bufs[]);
-
-int ncmpi_mput_varm_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned short *bufs[]);
-
-int ncmpi_mput_varm_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- int *bufs[]);
-
-int ncmpi_mput_varm_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned int *bufs[]);
-
-int ncmpi_mput_varm_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long *bufs[]);
-
-int ncmpi_mput_varm_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- float *bufs[]);
-
-int ncmpi_mput_varm_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- double *bufs[]);
-
-int ncmpi_mput_varm_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long long *bufs[]);
-
-int ncmpi_mput_varm_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mget_var(int ncid, int num, int varids[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_var_all(int ncid, int num, int varids[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_var_text(int ncid, int num, int varids[],
- char *bufs[]);
-
-int ncmpi_mget_var_schar(int ncid, int num, int varids[],
- signed char *bufs[]);
-
-int ncmpi_mget_var_uchar(int ncid, int num, int varids[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_var_short(int ncid, int num, int varids[],
- short *bufs[]);
-
-int ncmpi_mget_var_ushort(int ncid, int num, int varids[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_var_int(int ncid, int num, int varids[],
- int *bufs[]);
-
-int ncmpi_mget_var_uint(int ncid, int num, int varids[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_var_long(int ncid, int num, int varids[],
- long *bufs[]);
-
-int ncmpi_mget_var_float(int ncid, int num, int varids[],
- float *bufs[]);
-
-int ncmpi_mget_var_double(int ncid, int num, int varids[],
- double *bufs[]);
-
-int ncmpi_mget_var_longlong(int ncid, int num, int varids[],
- long long *bufs[]);
-
-int ncmpi_mget_var_ulonglong(int ncid, int num, int varids[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mget_var_text_all(int ncid, int num, int varids[],
- char *bufs[]);
-
-int ncmpi_mget_var_schar_all(int ncid, int num, int varids[],
- signed char *bufs[]);
-
-int ncmpi_mget_var_uchar_all(int ncid, int num, int varids[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_var_short_all(int ncid, int num, int varids[],
- short *bufs[]);
-
-int ncmpi_mget_var_ushort_all(int ncid, int num, int varids[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_var_int_all(int ncid, int num, int varids[],
- int *bufs[]);
-
-int ncmpi_mget_var_uint_all(int ncid, int num, int varids[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_var_long_all(int ncid, int num, int varids[],
- long *bufs[]);
-
-int ncmpi_mget_var_float_all(int ncid, int num, int varids[],
- float *bufs[]);
-
-int ncmpi_mget_var_double_all(int ncid, int num, int varids[],
- double *bufs[]);
-
-int ncmpi_mget_var_longlong_all(int ncid, int num, int varids[],
- long long *bufs[]);
-
-int ncmpi_mget_var_ulonglong_all(int ncid, int num, int varids[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mget_var1(int ncid, int num, int varids[],
- MPI_Offset* const starts[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_var1_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_var1_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], char *bufs[]);
-
-int ncmpi_mget_var1_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], signed char *bufs[]);
-
-int ncmpi_mget_var1_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned char *bufs[]);
-
-int ncmpi_mget_var1_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], short *bufs[]);
-
-int ncmpi_mget_var1_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned short *bufs[]);
-
-int ncmpi_mget_var1_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], int *bufs[]);
-
-int ncmpi_mget_var1_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned int *bufs[]);
-
-int ncmpi_mget_var1_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long *bufs[]);
-
-int ncmpi_mget_var1_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], float *bufs[]);
-
-int ncmpi_mget_var1_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], double *bufs[]);
-
-int ncmpi_mget_var1_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long long *bufs[]);
-
-int ncmpi_mget_var1_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned long long *bufs[]);
-
-
-int ncmpi_mget_var1_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], char *bufs[]);
-
-int ncmpi_mget_var1_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], signed char *bufs[]);
-
-int ncmpi_mget_var1_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned char *bufs[]);
-
-int ncmpi_mget_var1_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], short *bufs[]);
-
-int ncmpi_mget_var1_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned short *bufs[]);
-
-int ncmpi_mget_var1_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], int *bufs[]);
-
-int ncmpi_mget_var1_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned int *bufs[]);
-
-int ncmpi_mget_var1_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long *bufs[]);
-
-int ncmpi_mget_var1_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], float *bufs[]);
-
-int ncmpi_mget_var1_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], double *bufs[]);
-
-int ncmpi_mget_var1_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], long long *bufs[]);
-
-int ncmpi_mget_var1_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], unsigned long long *bufs[]);
-
-
-int ncmpi_mget_vara(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mget_vara_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mget_vara_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *bufs[]);
-
-int ncmpi_mget_vara_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *bufs[]);
-
-int ncmpi_mget_vara_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_vara_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *bufs[]);
-
-int ncmpi_mget_vara_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_vara_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *bufs[]);
-
-int ncmpi_mget_vara_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_vara_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *bufs[]);
-
-int ncmpi_mget_vara_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *bufs[]);
-
-int ncmpi_mget_vara_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *bufs[]);
-
-int ncmpi_mget_vara_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *bufs[]);
-
-int ncmpi_mget_vara_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mget_vara_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- char *bufs[]);
-
-int ncmpi_mget_vara_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- signed char *bufs[]);
-
-int ncmpi_mget_vara_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_vara_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- short *bufs[]);
-
-int ncmpi_mget_vara_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_vara_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- int *bufs[]);
-
-int ncmpi_mget_vara_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_vara_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long *bufs[]);
-
-int ncmpi_mget_vara_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- float *bufs[]);
-
-int ncmpi_mget_vara_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- double *bufs[]);
-
-int ncmpi_mget_vara_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- long long *bufs[]);
-
-int ncmpi_mget_vara_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- unsigned long long *bufs[]);
-
-
-int ncmpi_mget_vars(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_vars_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], void *bufs[],
- MPI_Offset bufcounts[], MPI_Datatype datatypes[]);
-
-int ncmpi_mget_vars_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], char *bufs[]);
-
-int ncmpi_mget_vars_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], signed char *bufs[]);
-
-int ncmpi_mget_vars_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned char *bufs[]);
-
-int ncmpi_mget_vars_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], short *bufs[]);
-
-int ncmpi_mget_vars_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned short *bufs[]);
-
-int ncmpi_mget_vars_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], int *bufs[]);
-
-int ncmpi_mget_vars_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned int *bufs[]);
-
-int ncmpi_mget_vars_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long *bufs[]);
-
-int ncmpi_mget_vars_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], float *bufs[]);
-
-int ncmpi_mget_vars_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], double *bufs[]);
-
-int ncmpi_mget_vars_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long long *bufs[]);
-
-int ncmpi_mget_vars_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned long long *bufs[]);
-
-
-int ncmpi_mget_vars_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], char *bufs[]);
-
-int ncmpi_mget_vars_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], signed char *bufs[]);
-
-int ncmpi_mget_vars_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned char *bufs[]);
-
-int ncmpi_mget_vars_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], short *bufs[]);
-
-int ncmpi_mget_vars_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned short *bufs[]);
-
-int ncmpi_mget_vars_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], int *bufs[]);
-
-int ncmpi_mget_vars_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned int *bufs[]);
-
-int ncmpi_mget_vars_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long *bufs[]);
-
-int ncmpi_mget_vars_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], float *bufs[]);
-
-int ncmpi_mget_vars_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], double *bufs[]);
-
-int ncmpi_mget_vars_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], long long *bufs[]);
-
-int ncmpi_mget_vars_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], unsigned long long *bufs[]);
-
-
-int ncmpi_mget_varm(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mget_varm_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- void *bufs[], MPI_Offset bufcounts[],
- MPI_Datatype datatypes[]);
-
-int ncmpi_mget_varm_text(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- char *bufs[]);
-
-int ncmpi_mget_varm_schar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- signed char *bufs[]);
-
-int ncmpi_mget_varm_uchar(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_varm_short(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- short *bufs[]);
-
-int ncmpi_mget_varm_ushort(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_varm_int(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- int *bufs[]);
-
-int ncmpi_mget_varm_uint(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_varm_long(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long *bufs[]);
-
-int ncmpi_mget_varm_float(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- float *bufs[]);
-
-int ncmpi_mget_varm_double(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- double *bufs[]);
-
-int ncmpi_mget_varm_longlong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long long *bufs[]);
-
-int ncmpi_mget_varm_ulonglong(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
+extern int
+ncmpi_mget_varm_ulonglong(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
unsigned long long *bufs[]);
-
-
-int ncmpi_mget_varm_text_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- char *bufs[]);
-
-int ncmpi_mget_varm_schar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- signed char *bufs[]);
-
-int ncmpi_mget_varm_uchar_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned char *bufs[]);
-
-int ncmpi_mget_varm_short_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- short *bufs[]);
-
-int ncmpi_mget_varm_ushort_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned short *bufs[]);
-
-int ncmpi_mget_varm_int_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- int *bufs[]);
-
-int ncmpi_mget_varm_uint_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- unsigned int *bufs[]);
-
-int ncmpi_mget_varm_long_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long *bufs[]);
-
-int ncmpi_mget_varm_float_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- float *bufs[]);
-
-int ncmpi_mget_varm_double_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- double *bufs[]);
-
-int ncmpi_mget_varm_longlong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
- long long *bufs[]);
-
-int ncmpi_mget_varm_ulonglong_all(int ncid, int num, int varids[],
- MPI_Offset* const starts[], MPI_Offset* const counts[],
- MPI_Offset* const strides[], MPI_Offset* const imaps[],
+extern int
+ncmpi_mget_varm_ulonglong_all(int ncid, int num, int *varids,
+ MPI_Offset* const *starts, MPI_Offset* const *counts,
+ MPI_Offset* const *strides, MPI_Offset* const *imaps,
unsigned long long *bufs[]);
/* End Skip Prototypes for Fortran binding */
diff --git a/src/lib/subfile.c b/src/lib/subfile.c
index 1e5a109..60e1eb5 100644
--- a/src/lib/subfile.c
+++ b/src/lib/subfile.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: subfile.c 2475 2016-09-05 23:15:29Z wkliao $ */
+/* $Id: subfile.c 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -190,8 +190,7 @@ int ncmpii_subfile_close(NC *ncp)
NC *ncp_sf;
status = ncmpii_NC_check_id(ncp->ncid_sf, &ncp_sf);
- if (status != NC_NOERR)
- return status;
+ if (status != NC_NOERR) DEBUG_RETURN_ERROR(status)
status = ncmpii_close(ncp_sf);
if (status != NC_NOERR)
diff --git a/src/lib/util.c b/src/lib/util.c
index 927fb9a..cb087a5 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: util.c 2597 2016-11-04 22:12:08Z wkliao $ */
+/* $Id: util.c 2686 2016-12-07 20:02:41Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -14,12 +14,18 @@
#include "nc.h"
#include "macro.h"
#include "ncmpidtype.h"
+#include "ncx.h"
/*----< ncmpii_sanity_check() >----------------------------------------------*/
+/* check the following errors and in that precedence.
+ * NC_EBADID, NC_EPERM, NC_EINDEFINE, NC_EINDEP/NC_ENOTINDEP, NC_ENOTVAR,
+ * NC_ECHAR, NC_EINVALCOORDS, NC_EEDGE, NC_ESTRIDE, NC_EINVAL.
+ */
int ncmpii_sanity_check(int ncid,
int varid,
const MPI_Offset *start,
const MPI_Offset *count,
+ const MPI_Offset *stride,
const MPI_Offset bufcount,
MPI_Datatype buftype, /* internal datatype */
enum API_KIND api,
@@ -31,16 +37,22 @@ int ncmpii_sanity_check(int ncid,
NC_var **varp) /* OUT */
{
/* all errors detected here are fatal, must return immediately */
- int err;
+ int i, firstDim, err;
- /* check if ncid is valid */
+ /* check if ncid is valid (check NC_EBADID) */
err = ncmpii_NC_check_id(ncid, ncp);
- if (err != NC_NOERR) return err;
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* For invalid ncid, we must return error now, as there is no way to
* continue with invalid ncp. However, collective APIs might hang if this
* error occurs only on a subset of processes
*/
+ /* check file write permission if this is write request */
+ if (rw_flag == WRITE_REQ && NC_readonly(*ncp)) {
+ DEBUG_ASSIGN_ERROR(err, NC_EPERM)
+ goto fn_exit;
+ }
+
/* if this call must be made in data mode, check if currently is in define
* mode */
if (mustInDataMode && NC_indef(*ncp)) {
@@ -48,12 +60,6 @@ int ncmpii_sanity_check(int ncid,
goto fn_exit;
}
- /* check file write permission if this is write request */
- if (rw_flag == WRITE_REQ && NC_readonly(*ncp)) {
- DEBUG_ASSIGN_ERROR(err, NC_EPERM)
- goto fn_exit;
- }
-
if (io_method != NONBLOCKING_IO) { /* for blocking APIs */
/* check if in the right collective or independent mode and initialize
* MPI file handlers */
@@ -61,7 +67,7 @@ int ncmpii_sanity_check(int ncid,
if (err != NC_NOERR) goto fn_exit;
}
- /* check if varid is valid */
+ /* check if varid is valid (check NC_ENOTVAR) */
err = ncmpii_NC_lookupvar(*ncp, varid, varp);
if (err != NC_NOERR) goto fn_exit;
@@ -90,24 +96,175 @@ int ncmpii_sanity_check(int ncid,
if (err != NC_NOERR) goto fn_exit;
}
- /* for API var1, vara, vars, varm, and varn, start cannot be NULL */
- if (start == NULL && api >= API_VAR1 && (*varp)->ndims > 0) {
+ /* for flexible APIs, bufcount cannot be negative */
+ if (bufcount < 0) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVAL)
+ goto fn_exit;
+ }
+
+ if ((*varp)->ndims == 0) { /* scalar variable: ignore start/count/stride */
+ err = NC_NOERR;
+ goto fn_exit;
+ }
+
+ if (api <= API_VAR) { /* var/varn/vard APIs, start/count/stride are NULL */
+ err = NC_NOERR;
+ goto fn_exit;
+ }
+
+ /* Now only check var1, vara, vars, and varm APIs */
+
+ /* Check NC_EINVALCOORDS
+ * for API var1/vara/vars/varm, start cannot be NULL, except for scalars */
+ if (start == NULL) {
DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
goto fn_exit;
}
- /* for API vara, vars, and varm, count cannot be NULL */
- if (count == NULL && api >= API_VARA && (*varp)->ndims > 0) {
+ firstDim = 0;
+ if (IS_RECVAR(*varp)) {
+ if (start[0] < 0) { /* no negative value */
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+
+ if ((*ncp)->format < 5 && /* not CDF-5 */
+ start[0] > X_UINT_MAX) { /* sanity check */
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+
+ /* for record variable, [0] is the NC_UNLIMITED dimension */
+ if (rw_flag == READ_REQ) {
+ /* read cannot go beyond current numrecs */
+#ifdef RELAX_COORD_BOUND
+ if (start[0] > (*ncp)->numrecs) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ if (start[0] == (*ncp)->numrecs) {
+ if (api == API_VAR1) {
+ /* for var1 APIs, count[0] is considered of 1 */
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ else if (count != NULL && count[0] > 0) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ }
+#else
+ if (start[0] >= (*ncp)->numrecs) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+#endif
+ }
+ firstDim = 1; /* skip checking the record dimension */
+ }
+
+ for (i=firstDim; i<(*varp)->ndims; i++) {
+#ifdef RELAX_COORD_BOUND
+ if (start[i] < 0 || start[i] > (*varp)->shape[i]) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ if (start[i] == (*ncp)->numrecs) {
+ if (api == API_VAR1) {
+ /* for var1 APIs, count[0] is considered of 1 */
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ else if (count != NULL && count[i] > 0) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+ }
+#else
+ if (start[i] < 0 || start[i] >= (*varp)->shape[i]) {
+ DEBUG_ASSIGN_ERROR(err, NC_EINVALCOORDS)
+ goto fn_exit;
+ }
+#endif
+ }
+
+ if (api <= API_VAR1) {
+ /* var1/var APIs have no count argument */
+ err = NC_NOERR;
+ goto fn_exit;
+ }
+
+ /* Check NC_EEDGE
+ * for API vara/vars/varm, count cannot be NULL, except for scalars */
+ if (count == NULL) {
DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
goto fn_exit;
}
+ firstDim = 0;
+ if (IS_RECVAR(*varp)) {
+ if (count[0] < 0) { /* no negative count[] */
+ DEBUG_ASSIGN_ERROR(err, NC_ENEGATIVECNT)
+ goto fn_exit;
+ }
+ /* for record variable, [0] is the NC_UNLIMITED dimension */
+ if (rw_flag == READ_REQ) { /* read cannot go beyond current numrecs */
+ if (stride == NULL) { /* for vara APIs */
+ if (start[0] + count[0] > (*ncp)->numrecs) {
+ DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
+ goto fn_exit;
+ }
+ }
+ else { /* for vars/varm APIs */
+ if (count[0] > 0 &&
+ start[0] + (count[0]-1) * stride[0] >= (*ncp)->numrecs) {
+ DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
+ goto fn_exit;
+ }
+ }
+ }
+ firstDim = 1; /* skip checking the record dimension */
+ }
- /* for flexible APIs, bufcount cannot be negative */
- if (bufcount < 0) {
- DEBUG_ASSIGN_ERROR(err, NC_EINVAL)
+ for (i=firstDim; i<(*varp)->ndims; i++) {
+ if ((*varp)->shape[i] < 0) {
+ DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
+ goto fn_exit;
+ }
+ if (count[i] < 0) { /* no negative count[] */
+ DEBUG_ASSIGN_ERROR(err, NC_ENEGATIVECNT)
+ goto fn_exit;
+ }
+
+ if (stride == NULL) { /* for vara APIs */
+ if (count[i] > (*varp)->shape[i] ||
+ start[i] + count[i] > (*varp)->shape[i]) {
+ DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
+ goto fn_exit;
+ }
+ }
+ else { /* for vars APIs */
+ if (count[i] > 0 &&
+ start[i] + (count[i]-1) * stride[i] >= (*varp)->shape[i]) {
+ DEBUG_ASSIGN_ERROR(err, NC_EEDGE)
+ goto fn_exit;
+ }
+ }
+ }
+
+ if (api <= API_VARA) {
+ /* vara APIs have no stride argument */
+ err = NC_NOERR;
goto fn_exit;
}
+ /* Check NC_ESTRIDE */
+ for (i=0; i<(*varp)->ndims; i++) {
+ if (stride != NULL && stride[i] == 0) {
+ DEBUG_ASSIGN_ERROR(err, NC_ESTRIDE)
+ goto fn_exit;
+ }
+ }
+
fn_exit:
if ((*ncp)->safe_mode == 1 && io_method == COLL_IO) {
int min_st, mpireturn;
diff --git a/src/lib/var.c b/src/lib/var.c
index 7b6ecd0..baadeca 100644
--- a/src/lib/var.c
+++ b/src/lib/var.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: var.c 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: var.c 2683 2016-12-07 06:42:58Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -622,13 +622,7 @@ ncmpi_def_var(int ncid,
/* check if ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
-
- /* check whether file's write permission */
- if (NC_readonly(ncp)) {
- DEBUG_ASSIGN_ERROR(err, NC_EPERM)
- goto err_check;
- }
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check if called in define mode */
if (!NC_indef(ncp)) {
@@ -804,7 +798,7 @@ ncmpi_inq_varid(int ncid,
NC *ncp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (name == NULL || *name == 0 || strlen(name) > NC_MAX_NAME)
DEBUG_RETURN_ERROR(NC_EBADNAME)
@@ -836,7 +830,7 @@ ncmpi_inq_var(int ncid,
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -890,7 +884,7 @@ ncmpi_inq_varname(int ncid,
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -919,7 +913,7 @@ ncmpi_inq_vartype(int ncid,
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -944,7 +938,7 @@ ncmpi_inq_varndims(int ncid, int varid, int *ndimsp)
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -976,7 +970,7 @@ ncmpi_inq_vardimid(int ncid, int varid, int *dimids)
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -1011,7 +1005,7 @@ ncmpi_inq_varnatts(int ncid,
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (varid == NC_GLOBAL) {
if (nattsp != NULL)
@@ -1046,7 +1040,7 @@ ncmpi_rename_var(int ncid,
/* check whether ncid is valid */
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* check whether file's write permission */
if (NC_readonly(ncp)) {
@@ -1181,7 +1175,7 @@ ncmpi_inq_varoffset(int ncid,
NC_var *varp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
/* using NC_GLOBAL in varid is illegal for this API. See
* http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2015/msg00196.html
@@ -1208,7 +1202,7 @@ ncmpi_print_all_var_offsets(int ncid) {
NC *ncp=NULL;
err = ncmpii_NC_check_id(ncid, &ncp);
- if (err != NC_NOERR || ncp == NULL) DEBUG_RETURN_ERROR(err)
+ if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
if (ncp->begin_var%1048576)
printf("%s header size (ncp->begin_var)=%lld MB + %lld\n",
diff --git a/src/lib/vard.c b/src/lib/vard.c
index 4abfb29..95a3934 100644
--- a/src/lib/vard.c
+++ b/src/lib/vard.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: vard.c 2588 2016-10-30 04:14:15Z wkliao $ */
+/* $Id: vard.c 2695 2016-12-10 17:02:11Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -214,6 +214,8 @@ err_check:
return err;
}
/* else for COLL_IO, must participate successive collective calls */
+ offset = 0;
+ bufcount = 0;
}
status = err;
@@ -337,8 +339,9 @@ ncmpi_get_vard(int ncid,
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARD, 1, 1, READ_REQ, INDEP_IO, &ncp, &varp);
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARD, 1, 1, READ_REQ, INDEP_IO,
+ &ncp, &varp);
if (status != NC_NOERR) return status;
return ncmpii_getput_vard(ncp, varp, filetype, buf, bufcount, buftype,
@@ -354,13 +357,26 @@ ncmpi_get_vard_all(int ncid,
MPI_Offset bufcount,
MPI_Datatype buftype) /* data type of the buffer */
{
- int status;
+ int err, status;
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARD, 1, 1, READ_REQ, COLL_IO, &ncp, &varp);
- if (status != NC_NOERR) return status;
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARD, 1, 1, READ_REQ, COLL_IO,
+ &ncp, &varp);
+ if (status != NC_NOERR) {
+ if (status == NC_EBADID || status == NC_EPERM ||
+ status == NC_EINDEFINE || status == NC_EINDEP)
+ return status; /* fatal error, cannot continue */
+
+ /* for collective API, participate the collective I/O with zero-length
+ * request for this process */
+ err = ncmpii_getput_zero_req(ncp, READ_REQ);
+ assert(err == NC_NOERR);
+
+ /* return the error code from sanity check */
+ return status;
+ }
return ncmpii_getput_vard(ncp, varp, filetype, buf, bufcount, buftype,
READ_REQ, COLL_IO);
@@ -379,8 +395,9 @@ ncmpi_put_vard(int ncid,
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARD, 1, 1, WRITE_REQ, INDEP_IO, &ncp, &varp);
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARD, 1, 1, WRITE_REQ, INDEP_IO,
+ &ncp, &varp);
if (status != NC_NOERR) return status;
return ncmpii_getput_vard(ncp, varp, filetype, (void*)buf, bufcount,
@@ -396,13 +413,26 @@ ncmpi_put_vard_all(int ncid,
MPI_Offset bufcount,
MPI_Datatype buftype) /* data type of the buffer */
{
- int status;
+ int err, status;
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARD, 1, 1, WRITE_REQ, COLL_IO, &ncp, &varp);
- if (status != NC_NOERR) return status;
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARD, 1, 1, WRITE_REQ, COLL_IO,
+ &ncp, &varp);
+ if (status != NC_NOERR) {
+ if (status == NC_EBADID || status == NC_EPERM ||
+ status == NC_EINDEFINE || status == NC_EINDEP)
+ return status; /* fatal error, cannot continue */
+
+ /* for collective API, participate the collective I/O with zero-length
+ * request for this process */
+ err = ncmpii_getput_zero_req(ncp, WRITE_REQ);
+ assert(err == NC_NOERR);
+
+ /* return the error code from sanity check */
+ return status;
+ }
return ncmpii_getput_vard(ncp, varp, filetype, (void*)buf, bufcount,
buftype, WRITE_REQ, COLL_IO);
diff --git a/src/lib/varn.m4 b/src/lib/varn.m4
index 4ddff5d..d4664f7 100644
--- a/src/lib/varn.m4
+++ b/src/lib/varn.m4
@@ -7,7 +7,7 @@ dnl
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: varn.m4 2559 2016-10-16 20:47:09Z wkliao $ */
+/* $Id: varn.m4 2695 2016-12-10 17:02:11Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -49,16 +49,16 @@ include(`utils.m4')
*/
static int
-ncmpii_getput_varn(NC *ncp,
- NC_var *varp,
- int num,
- MPI_Offset* const starts[], /* [num][varp->ndims] */
- MPI_Offset* const counts[], /* [num][varp->ndims] */
- void *buf,
- MPI_Offset bufcount,
- MPI_Datatype buftype, /* data type of the buffer */
- int rw_flag,
- int io_method);
+ncmpii_getput_varn(NC *ncp,
+ NC_var *varp,
+ int num,
+ MPI_Offset* const *starts, /* [num][varp->ndims] */
+ MPI_Offset* const *counts, /* [num][varp->ndims] */
+ void *buf,
+ MPI_Offset bufcount,
+ MPI_Datatype buftype, /* data type of the buffer */
+ int rw_flag,
+ int io_method);
define(`BufConst', `ifelse(`$1', `put', `const')')dnl
@@ -72,20 +72,36 @@ int
ncmpi_$1_varn$2(int ncid,
int varid,
int num,
- MPI_Offset* const starts[],
- MPI_Offset* const counts[],
+ MPI_Offset* const *starts,
+ MPI_Offset* const *counts,
BufConst($1) void *buf,
MPI_Offset bufcount,
MPI_Datatype buftype)
{
- int status;
+ int err, status;
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, bufcount, buftype,
- API_VARN, 1,
- 1, ReadWrite($1), CollIndep($2), &ncp, &varp);
- if (status != NC_NOERR) return status;
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, bufcount,
+ buftype, API_VARN, 1, 1, ReadWrite($1),
+ CollIndep($2), &ncp, &varp);
+ if (status != NC_NOERR) {
+ if (CollIndep($2) == INDEP_IO ||
+ status == NC_EBADID ||
+ status == NC_EPERM ||
+ status == NC_EINDEFINE ||
+ status == NC_EINDEP ||
+ status == NC_ENOTINDEP)
+ return status; /* fatal error, cannot continue */
+
+ /* for collective API, participate the collective I/O with zero-length
+ * request for this process */
+ err = ncmpii_getput_zero_req(ncp, ReadWrite($1));
+ assert(err == NC_NOERR);
+
+ /* return the error code from sanity check */
+ return status;
+ }
return ncmpii_getput_varn(ncp, varp, num, starts, counts, (void*)buf,
bufcount, buftype, ReadWrite($1), CollIndep($2));
@@ -108,18 +124,34 @@ int
ncmpi_$1_varn_$3$2(int ncid,
int varid,
int num,
- MPI_Offset* const starts[],
- MPI_Offset* const counts[],
+ MPI_Offset* const *starts,
+ MPI_Offset* const *counts,
BufConst($1) $4 *buf)
{
- int status;
+ int err, status;
NC *ncp;
NC_var *varp=NULL;
- status = ncmpii_sanity_check(ncid, varid, NULL, NULL, 0, ITYPE2MPI($3),
- API_VARN, 0,
- 1, ReadWrite($1), CollIndep($2), &ncp, &varp);
- if (status != NC_NOERR) return status;
+ status = ncmpii_sanity_check(ncid, varid, NULL, NULL, NULL, 0,
+ ITYPE2MPI($3), API_VARN, 0, 1, ReadWrite($1),
+ CollIndep($2), &ncp, &varp);
+ if (status != NC_NOERR) {
+ if (CollIndep($2) == INDEP_IO ||
+ status == NC_EBADID ||
+ status == NC_EPERM ||
+ status == NC_EINDEFINE ||
+ status == NC_EINDEP ||
+ status == NC_ENOTINDEP)
+ return status; /* fatal error, cannot continue */
+
+ /* for collective API, participate the collective I/O with zero-length
+ * request for this process */
+ err = ncmpii_getput_zero_req(ncp, ReadWrite($1));
+ assert(err == NC_NOERR);
+
+ /* return the error code from sanity check */
+ return status;
+ }
/* set bufcount to -1 indicating non-flexible API */
return ncmpii_getput_varn(ncp, varp, num, starts, counts, (void*)buf,
@@ -135,16 +167,16 @@ foreach(`putget', (put, get),
/*----< ncmpii_getput_varn() >------------------------------------------------*/
static int
-ncmpii_getput_varn(NC *ncp,
- NC_var *varp,
- int num,
- MPI_Offset* const starts[], /* [num][varp->ndims] */
- MPI_Offset* const counts[], /* [num][varp->ndims] */
- void *buf,
- MPI_Offset bufcount,
- MPI_Datatype buftype, /* data type of the buffer */
- int rw_flag, /* WRITE_REQ or READ_REQ */
- int io_method) /* COLL_IO or INDEP_IO */
+ncmpii_getput_varn(NC *ncp,
+ NC_var *varp,
+ int num,
+ MPI_Offset* const *starts, /* [num][varp->ndims] */
+ MPI_Offset* const *counts, /* [num][varp->ndims] */
+ void *buf,
+ MPI_Offset bufcount,
+ MPI_Datatype buftype, /* data type of the buffer */
+ int rw_flag, /* WRITE_REQ or READ_REQ */
+ int io_method) /* COLL_IO or INDEP_IO */
{
int i, j, el_size, status=NC_NOERR, min_st, err, free_cbuf=0;
int req_id=NC_REQ_NULL, st, isSameGroup, position;
diff --git a/src/libcxx/Makefile.in b/src/libcxx/Makefile.in
index 3744491..e5b428e 100755
--- a/src/libcxx/Makefile.in
+++ b/src/libcxx/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2014, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2285 2015-12-30 20:48:25Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -61,7 +61,13 @@ DIST_GARBAGE =
all: $(CXX_HEADER) $(LIBRARY)
-library $(LIBRARY): $(LIB_OBJS)
+objs: $(CXX_HEADER) $(LIB_OBJS)
+
+library:
+ $(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
+ $(RANLIB) $(LIBRARY)
+
+$(LIBRARY): $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
$(RANLIB) $(LIBRARY)
diff --git a/src/libcxx/ncmpiFile.cpp b/src/libcxx/ncmpiFile.cpp
index fb018a7..80f29f6 100644
--- a/src/libcxx/ncmpiFile.cpp
+++ b/src/libcxx/ncmpiFile.cpp
@@ -203,3 +203,8 @@ void NcmpiFile::Inq_header_extent(MPI_Offset *header_extent)
ncmpiCheck(ncmpi_inq_header_extent(myId, header_extent),__FILE__,__LINE__);
}
+void NcmpiFile::Inq_path(int *pathlen, char *path)
+{
+ ncmpiCheck(ncmpi_inq_path(myId, pathlen, path),__FILE__,__LINE__);
+}
+
diff --git a/src/libcxx/ncmpiFile.h b/src/libcxx/ncmpiFile.h
index 515286f..47a88b6 100644
--- a/src/libcxx/ncmpiFile.h
+++ b/src/libcxx/ncmpiFile.h
@@ -107,6 +107,8 @@ namespace PnetCDF
void Inq_header_extent(MPI_Offset *header_extent);
+ void Inq_path(int *pathlen, char *path);
+
private:
/* Do not allow definition of NcmpiFile involving copying any NcmpiFile
or NcmpiGroup. Because the destructor closes the file and releases
diff --git a/src/libf/Makefile.in b/src/libf/Makefile.in
index 3b467b4..448c8c3 100644
--- a/src/libf/Makefile.in
+++ b/src/libf/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2584 2016-10-27 18:53:05Z wkliao $
+# $Id: Makefile.in 2678 2016-12-05 06:30:43Z wkliao $
#
# @configure_input@
@@ -24,335 +24,11 @@ LIBRARY = ../lib/libpnetcdf.a
ld_netcdf = -L../lib -lpnetcdf
UTIL_SRCS = issyserrf.c \
- nfxutil.c \
- xstrerrorf.c \
- xstrerrnof.c \
- xinq_libversf.c
+ xstrerrorf.c \
+ xstrerrnof.c \
+ xinq_libversf.c
-C2F_SRCS = createf.c \
- openf.c \
- inq_file_infof.c \
- get_file_infof.c \
- deletef.c \
- enddeff.c \
- _enddeff.c \
- redeff.c \
- set_default_formatf.c inq_default_formatf.c \
- syncf.c \
- sync_numrecsf.c \
- abortf.c \
- begin_indep_dataf.c \
- end_indep_dataf.c \
- closef.c \
- set_fillf.c def_var_fillf.c inq_var_fillf.c fill_var_recf.c \
- def_dimf.c \
- def_varf.c \
- rename_dimf.c \
- rename_varf.c \
- inqf.c \
- inq_formatf.c \
- inq_file_formatf.c \
- inq_versionf.c \
- inq_stripingf.c \
- inq_ndimsf.c \
- inq_nvarsf.c \
- inq_num_rec_varsf.c \
- inq_num_fix_varsf.c \
- inq_nattsf.c \
- inq_unlimdimf.c \
- inq_dimidf.c \
- inq_dimf.c \
- inq_dimnamef.c \
- inq_dimlenf.c \
- inq_varf.c \
- inq_varidf.c \
- inq_varnamef.c \
- inq_vartypef.c \
- inq_varndimsf.c \
- inq_vardimidf.c \
- inq_varnattsf.c \
- inq_varoffsetf.c \
- inq_attf.c \
- inq_attidf.c \
- inq_atttypef.c \
- inq_attlenf.c \
- inq_attnamef.c \
- copy_attf.c \
- rename_attf.c \
- del_attf.c \
- put_attf.c \
- put_att_textf.c \
- put_att_int1f.c \
- put_att_int2f.c \
- put_att_intf.c \
- put_att_realf.c \
- put_att_doublef.c \
- put_att_int8f.c \
- get_attf.c \
- get_att_textf.c \
- get_att_int1f.c \
- get_att_int2f.c \
- get_att_intf.c \
- get_att_realf.c \
- get_att_doublef.c \
- get_att_int8f.c \
- put_var1f.c put_var1_allf.c \
- put_var1_textf.c put_var1_text_allf.c \
- put_var1_int1f.c put_var1_int1_allf.c \
- put_var1_int2f.c put_var1_int2_allf.c \
- put_var1_intf.c put_var1_int_allf.c \
- put_var1_realf.c put_var1_real_allf.c \
- put_var1_doublef.c put_var1_double_allf.c \
- put_var1_int8f.c put_var1_int8_allf.c \
- get_var1f.c get_var1_allf.c \
- get_var1_textf.c get_var1_text_allf.c \
- get_var1_int1f.c get_var1_int1_allf.c \
- get_var1_int2f.c get_var1_int2_allf.c \
- get_var1_intf.c get_var1_int_allf.c \
- get_var1_realf.c get_var1_real_allf.c \
- get_var1_doublef.c get_var1_double_allf.c \
- get_var1_int8f.c get_var1_int8_allf.c \
- put_varf.c put_var_allf.c \
- put_var_textf.c put_var_text_allf.c \
- put_var_int1f.c put_var_int1_allf.c \
- put_var_int2f.c put_var_int2_allf.c \
- put_var_intf.c put_var_int_allf.c \
- put_var_realf.c put_var_real_allf.c \
- put_var_doublef.c put_var_double_allf.c \
- put_var_int8f.c put_var_int8_allf.c \
- get_varf.c get_var_allf.c \
- get_var_textf.c get_var_text_allf.c \
- get_var_int1f.c get_var_int1_allf.c \
- get_var_int2f.c get_var_int2_allf.c \
- get_var_intf.c get_var_int_allf.c \
- get_var_realf.c get_var_real_allf.c \
- get_var_doublef.c get_var_double_allf.c \
- get_var_int8f.c get_var_int8_allf.c \
- put_varaf.c put_vara_allf.c \
- put_vara_textf.c put_vara_text_allf.c \
- put_vara_int1f.c put_vara_int1_allf.c \
- put_vara_int2f.c put_vara_int2_allf.c \
- put_vara_intf.c put_vara_int_allf.c \
- put_vara_realf.c put_vara_real_allf.c \
- put_vara_doublef.c put_vara_double_allf.c \
- put_vara_int8f.c put_vara_int8_allf.c \
- get_varaf.c get_vara_allf.c \
- get_vara_textf.c get_vara_text_allf.c \
- get_vara_int1f.c get_vara_int1_allf.c \
- get_vara_int2f.c get_vara_int2_allf.c \
- get_vara_intf.c get_vara_int_allf.c \
- get_vara_realf.c get_vara_real_allf.c \
- get_vara_doublef.c get_vara_double_allf.c \
- get_vara_int8f.c get_vara_int8_allf.c \
- put_varsf.c put_vars_allf.c \
- put_vars_textf.c put_vars_text_allf.c \
- put_vars_int1f.c put_vars_int1_allf.c \
- put_vars_int2f.c put_vars_int2_allf.c \
- put_vars_intf.c put_vars_int_allf.c \
- put_vars_realf.c put_vars_real_allf.c \
- put_vars_doublef.c put_vars_double_allf.c \
- put_vars_int8f.c put_vars_int8_allf.c \
- get_varsf.c get_vars_allf.c \
- get_vars_int1f.c get_vars_int1_allf.c \
- get_vars_textf.c get_vars_text_allf.c \
- get_vars_int2f.c get_vars_int2_allf.c \
- get_vars_intf.c get_vars_int_allf.c \
- get_vars_realf.c get_vars_real_allf.c \
- get_vars_doublef.c get_vars_double_allf.c \
- get_vars_int8f.c get_vars_int8_allf.c \
- put_varmf.c put_varm_allf.c \
- put_varm_textf.c put_varm_text_allf.c \
- put_varm_int1f.c put_varm_int1_allf.c \
- put_varm_int2f.c put_varm_int2_allf.c \
- put_varm_intf.c put_varm_int_allf.c \
- put_varm_realf.c put_varm_real_allf.c \
- put_varm_doublef.c put_varm_double_allf.c \
- put_varm_int8f.c put_varm_int8_allf.c \
- get_varmf.c get_varm_allf.c \
- get_varm_int1f.c get_varm_int1_allf.c \
- get_varm_textf.c get_varm_text_allf.c \
- get_varm_int2f.c get_varm_int2_allf.c \
- get_varm_intf.c get_varm_int_allf.c \
- get_varm_realf.c get_varm_real_allf.c \
- get_varm_doublef.c get_varm_double_allf.c \
- get_varm_int8f.c get_varm_int8_allf.c \
- waitf.c \
- wait_allf.c \
- cancelf.c \
- iput_var1f.c \
- iput_var1_textf.c \
- iput_var1_int1f.c \
- iput_var1_int2f.c \
- iput_var1_intf.c \
- iput_var1_realf.c \
- iput_var1_doublef.c \
- iput_var1_int8f.c \
- iget_var1f.c \
- iget_var1_textf.c \
- iget_var1_int1f.c \
- iget_var1_int2f.c \
- iget_var1_intf.c \
- iget_var1_realf.c \
- iget_var1_doublef.c \
- iget_var1_int8f.c \
- bput_var1f.c \
- bput_var1_textf.c \
- bput_var1_int1f.c \
- bput_var1_int2f.c \
- bput_var1_intf.c \
- bput_var1_realf.c \
- bput_var1_doublef.c \
- bput_var1_int8f.c \
- iput_varf.c \
- iput_var_textf.c \
- iput_var_int1f.c \
- iput_var_int2f.c \
- iput_var_intf.c \
- iput_var_realf.c \
- iput_var_doublef.c \
- iput_var_int8f.c \
- iget_varf.c \
- iget_var_textf.c \
- iget_var_int1f.c \
- iget_var_int2f.c \
- iget_var_intf.c \
- iget_var_realf.c \
- iget_var_doublef.c \
- iget_var_int8f.c \
- bput_varf.c \
- bput_var_textf.c \
- bput_var_int1f.c \
- bput_var_int2f.c \
- bput_var_intf.c \
- bput_var_realf.c \
- bput_var_doublef.c \
- bput_var_int8f.c \
- iput_varaf.c \
- iput_vara_textf.c \
- iput_vara_int1f.c \
- iput_vara_int2f.c \
- iput_vara_intf.c \
- iput_vara_realf.c \
- iput_vara_doublef.c \
- iput_vara_int8f.c \
- iget_varaf.c \
- iget_vara_textf.c \
- iget_vara_int1f.c \
- iget_vara_int2f.c \
- iget_vara_intf.c \
- iget_vara_realf.c \
- iget_vara_doublef.c \
- iget_vara_int8f.c \
- bput_varaf.c \
- bput_vara_textf.c \
- bput_vara_int1f.c \
- bput_vara_int2f.c \
- bput_vara_intf.c \
- bput_vara_realf.c \
- bput_vara_doublef.c \
- bput_vara_int8f.c \
- iput_varsf.c \
- iput_vars_textf.c \
- iput_vars_int1f.c \
- iput_vars_int2f.c \
- iput_vars_intf.c \
- iput_vars_realf.c \
- iput_vars_doublef.c \
- iput_vars_int8f.c \
- iget_varsf.c \
- iget_vars_textf.c \
- iget_vars_int1f.c \
- iget_vars_int2f.c \
- iget_vars_intf.c \
- iget_vars_realf.c \
- iget_vars_doublef.c \
- iget_vars_int8f.c \
- bput_varsf.c \
- bput_vars_textf.c \
- bput_vars_int1f.c \
- bput_vars_int2f.c \
- bput_vars_intf.c \
- bput_vars_realf.c \
- bput_vars_doublef.c \
- bput_vars_int8f.c \
- iput_varmf.c \
- iput_varm_textf.c \
- iput_varm_int1f.c \
- iput_varm_int2f.c \
- iput_varm_intf.c \
- iput_varm_realf.c \
- iput_varm_doublef.c \
- iput_varm_int8f.c \
- iget_varmf.c \
- iget_varm_textf.c \
- iget_varm_int1f.c \
- iget_varm_int2f.c \
- iget_varm_intf.c \
- iget_varm_realf.c \
- iget_varm_doublef.c \
- iget_varm_int8f.c \
- bput_varmf.c \
- bput_varm_textf.c \
- bput_varm_int1f.c \
- bput_varm_int2f.c \
- bput_varm_intf.c \
- bput_varm_realf.c \
- bput_varm_doublef.c \
- bput_varm_int8f.c \
- bufattachf.c \
- bufdetachf.c \
- inq_buffer_usagef.c \
- inq_buffer_sizef.c \
- inq_put_sizef.c \
- inq_get_sizef.c \
- inq_header_sizef.c \
- inq_header_extentf.c \
- inq_malloc_sizef.c inq_malloc_max_sizef.c inq_malloc_listf.c \
- inq_files_openedf.c \
- inq_nreqsf.c \
- inq_recsizef.c \
- get_varnf.c get_varn_allf.c \
- get_varn_textf.c get_varn_text_allf.c \
- get_varn_int1f.c get_varn_int1_allf.c \
- get_varn_int2f.c get_varn_int2_allf.c \
- get_varn_intf.c get_varn_int_allf.c \
- get_varn_realf.c get_varn_real_allf.c \
- get_varn_doublef.c get_varn_double_allf.c \
- get_varn_int8f.c get_varn_int8_allf.c \
- put_varnf.c put_varn_allf.c \
- put_varn_textf.c put_varn_text_allf.c \
- put_varn_int1f.c put_varn_int1_allf.c \
- put_varn_int2f.c put_varn_int2_allf.c \
- put_varn_intf.c put_varn_int_allf.c \
- put_varn_realf.c put_varn_real_allf.c \
- put_varn_doublef.c put_varn_double_allf.c \
- put_varn_int8f.c put_varn_int8_allf.c \
- iget_varnf.c \
- iget_varn_textf.c \
- iget_varn_int1f.c \
- iget_varn_int2f.c \
- iget_varn_intf.c \
- iget_varn_realf.c \
- iget_varn_doublef.c \
- iget_varn_int8f.c \
- iput_varnf.c \
- iput_varn_textf.c \
- iput_varn_int1f.c \
- iput_varn_int2f.c \
- iput_varn_intf.c \
- iput_varn_realf.c \
- iput_varn_doublef.c \
- iput_varn_int8f.c \
- bput_varnf.c \
- bput_varn_textf.c \
- bput_varn_int1f.c \
- bput_varn_int2f.c \
- bput_varn_intf.c \
- bput_varn_realf.c \
- bput_varn_doublef.c \
- bput_varn_int8f.c \
- get_vardf.c get_vard_allf.c \
- put_vardf.c put_vard_allf.c
+C2F_SRCS = allf.c
LIB_CSRCS = $(C2F_SRCS) $(UTIL_SRCS)
@@ -369,20 +45,27 @@ PACKING_LIST = $(LIB_FSRCS) \
LIB_OBJS = $(LIB_CSRCS:.c=.o) $(LIB_FSRCS:.f=.o)
-GARBAGE = nfconfig.inc $(LIB_CSRCS) mpifnetcdf.h
-DIST_GARBAGE = nfconfig_inc pnetcdf.inc
+GARBAGE = nfconfig.inc $(LIB_CSRCS) mpifnetcdf.h
+DIST_GARBAGE = nfconfig_inc pnetcdf.inc
-all: $(LIB_CSRCS) nfconfig.inc $(LIBRARY)
+all: nfconfig.inc $(LIBRARY)
-library $(LIBRARY): $(LIB_OBJS)
+objs: nfconfig.inc $(LIB_OBJS)
+
+library:
+ $(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
+ $(RANLIB) $(LIBRARY)
+
+$(LIBRARY): $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
$(RANLIB) $(LIBRARY)
$(LIB_CSRCS): mpifnetcdf.h
-$(LIB_OBJS): mpifnetcdf.h
mpifnetcdf.h: defs buildiface $(HEADER)
- $(srcdir)/buildiface -infile=$(HEADER) -deffile=$(srcdir)/defs
+ $(RM) -f $@ allf.c
+ $(srcdir)/buildiface -infile=$(HEADER) -deffile=$(srcdir)/defs > allf.c
+ @touch $(LIB_CSRCS)
# Starting from 1.4.0, nfconfig.inc is only used in test/nf_test/tests.inc and
# test/nf90_test/tests.inc
diff --git a/src/libf/buildiface b/src/libf/buildiface
index 32062d9..202901e 100755
--- a/src/libf/buildiface
+++ b/src/libf/buildiface
@@ -22,7 +22,7 @@ use warnings;
%CtoFName = ();
@ExtraRoutines = ();
-$buildfiles = 1;
+$buildfiles = 0;
$build_prototypes = 1;
$buildMakefile = 1;
$prototype_header_file = "fproto.h";
@@ -750,7 +750,17 @@ sub print_header {
my $args = $_[2];
my $extra = $_[3];
- &print_copyright( );
+ if ($OUTFD ne STDOUT) {
+ &print_copyright( );
+ &print_gcc_pragma( );
+ if ($build_prototypes) {
+ print $OUTFD "\
+/* Prototypes for the Fortran interfaces */\
+#include \"$prototype_header_file\"\
+";
+ }
+ }
+
if ($extra) {
print $OUTFD $extra;
}
@@ -763,6 +773,14 @@ sub print_header {
}
}
+sub print_gcc_pragma {
+ print $OUTFD "\
+#ifdef __GNUC__\
+#pragma GCC diagnostic ignored \"-Wunused-parameter\"\
+#endif\
+#include \"${header_file}\"\n\n";
+}
+
sub print_copyright {
print $OUTFD "/* -*- Mode: C; c-basic-offset:4 ; -*- */\
/* \
@@ -772,11 +790,7 @@ sub print_copyright {
* This file is automatically generated by command:\
* ./buildiface $arg_string\
* DO NOT EDIT\
- */\
-#ifdef __GNUC__\
-#pragma GCC diagnostic ignored \"-Wunused-parameter\"\
-#endif\
-#include \"${header_file}\"\n\n";
+ */";
}
#
@@ -963,12 +977,6 @@ sub print_name_map_block {
#endif /* MPICH_MPI_FROM_PMPI */
";
}
- if ($build_prototypes) {
- print $OUTFD "
-/* Prototypes for the Fortran interfaces */
-#include \"$prototype_header_file\"
-";
- }
}
# Print the arguments for the routine DEFINITION.
@@ -2669,6 +2677,7 @@ sub build_specials {
#setbot.c is not one of the mpi_sources files
#$files[$#files+1] = $filename;
&print_copyright;
+ &print_gcc_pragma;
print $OUTFD "
#ifdef F77_NAME_UPPER
@@ -3247,6 +3256,27 @@ sub print_mpif_int {
print MPIFFD " PARAMETER ($key=$value)\n";
}
+sub inq_file_info {
+ print $OUTFD "{
+ int ierr;
+ MPI_Info info;
+
+ ierr = ncmpi_inq_file_info( *v1, &info );
+ *v2 = MPI_Info_c2f(info);
+ return ierr;
+}\n";
+}
+
+sub get_file_info {
+ print $OUTFD "{
+ int ierr;
+ MPI_Info info;
+
+ ierr = ncmpi_get_file_info( *v1, &info );
+ *v2 = MPI_Info_c2f(info);
+ return ierr;
+}\n";
+}
sub ReadAndProcessInterface {
my $prototype_file = $_[0];
@@ -3262,6 +3292,18 @@ sub ReadAndProcessInterface {
if ( /\/\*\s*Begin Prototypes/ ) { last; }
}
+ if (! $buildfiles) {
+ $OUTFD = STDOUT;
+ &print_copyright( );
+ &print_gcc_pragma( );
+ if ($build_prototypes) {
+ print $OUTFD "
+/* Prototypes for the Fortran interfaces */
+#include \"$prototype_header_file\"
+";
+ }
+ }
+
# Read each one
while (<FD>) {
$linecount ++;
@@ -3292,7 +3334,10 @@ sub ReadAndProcessInterface {
}
}
- if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
+ # if (/^int\s+$routine_prefix($routine_pattern)\s*\((.*)/) {
+ if (/extern int/) { # next line is the API
+ $_ = <FD>;
+ if (/$routine_prefix($routine_pattern)\s*\((.*)/) {
$routine_name = $1;
$args = $2;
while (! ($args =~ /;/)) {
@@ -3303,7 +3348,7 @@ sub ReadAndProcessInterface {
$args =~ s/[\r\n]*//g;
# remove qualifiers from args
### TEMP - REMEMBER const because we may need it later
- #$args =~ s/\s*const\s+//g;
+ $args =~ s/\s*const\s+//g;
# Convert MPIO_Request to MPI_Request (temporary)
# $args =~ s/MPIO_Request/MPI_Request/g;
@@ -3371,34 +3416,42 @@ sub ReadAndProcessInterface {
print "Printing arguments for $routine_prefix${lcname}_\n" if $debug;
&print_args( $OUTFD, $args, 0, $lcname );
- #&print_attr;
- print $OUTFD "{\n";
- &specialInitClear;
- if ($protectMPIO) {
- print $OUTFD "#ifdef MPI_MODE_RDONLY\n";
- }
- &print_special_decls( $routine_name );
- if (defined($ChangeCall{$routine_name})) {
- my ($newName,$extraArgs) =
- split(/:/,$ChangeCall{$routine_name} );
- print $OUTFD " $errparmlval = $newName";
- my $largs = $args . "," . $extraArgs;
- &print_call_args( $largs );
- }
- else {
- print $OUTFD " $errparmlval = $routine_prefix$routine_name";
- print "Printing call arguments for mpi_${lcname}_\n" if $debug;
- &print_call_args( $args );
- }
- # Print any post call processing
- &print_post_call( $routine_name, $args );
- if ($protectMPIO) {
- print $OUTFD "#else\n$errparmlval = MPI_ERR_INTERN;\n#endif\n";
- }
- if ($returnErrval) {
- print $OUTFD " return $errparmrval;\n";
- }
- print $OUTFD "}\n";
+ if ($lcname eq "inq_file_info") {
+ &inq_file_info( );
+ }
+ elsif ($lcname eq "get_file_info") {
+ &get_file_info( );
+ }
+ else {
+ #&print_attr;
+ print $OUTFD "{\n";
+ &specialInitClear;
+ if ($protectMPIO) {
+ print $OUTFD "#ifdef MPI_MODE_RDONLY\n";
+ }
+ &print_special_decls( $routine_name );
+ if (defined($ChangeCall{$routine_name})) {
+ my ($newName,$extraArgs) =
+ split(/:/,$ChangeCall{$routine_name} );
+ print $OUTFD " $errparmlval = $newName";
+ my $largs = $args . "," . $extraArgs;
+ &print_call_args( $largs );
+ }
+ else {
+ print $OUTFD " $errparmlval = $routine_prefix$routine_name";
+ print "Printing call arguments for mpi_${lcname}_\n" if $debug;
+ &print_call_args( $args );
+ }
+ # Print any post call processing
+ &print_post_call( $routine_name, $args );
+ if ($protectMPIO) {
+ print $OUTFD "#else\n$errparmlval = MPI_ERR_INTERN;\n#endif\n";
+ }
+ if ($returnErrval) {
+ print $OUTFD " return $errparmrval;\n";
+ }
+ print $OUTFD "}\n";
+ }
if ($buildfiles) {
close ($OUTFD);
&ReplaceIfDifferent( $filename, $newfilename );
@@ -3415,6 +3468,7 @@ sub ReadAndProcessInterface {
print PROTOFD ";\n";
}
}
+ }
}
}
}
diff --git a/src/libf/defs b/src/libf/defs
index 76fa08f..6970042 100644
--- a/src/libf/defs
+++ b/src/libf/defs
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: defs 2584 2016-10-27 18:53:05Z wkliao $
+# $Id: defs 2727 2016-12-18 06:53:45Z wkliao $
$routine_prefix = "ncmpi_";
$routine_pattern = "[a-z0-9_]*";
@@ -2403,11 +2403,9 @@ sub blankpad_out_ftoc {
# Functions to add routines that need special handling
$ExtraRoutines[$#ExtraRoutines+1] = "ncfxstrerror";
$ExtraRoutines[$#ExtraRoutines+1] = "ncfxstrerrno";
-$ExtraRoutines[$#ExtraRoutines+1] = "ncfxutil";
$ExtraRoutines[$#ExtraRoutines+1] = "ncfxinqlibvers";
$ExtraRoutines[$#ExtraRoutines+1] = "ncfissyserr";
-$ExtraRoutines[$#ExtraRoutines+1] = "get_file_info";
-$ExtraRoutines[$#ExtraRoutines+1] = "inq_file_info";
+# $ExtraRoutines[$#ExtraRoutines+1] = "ncfxutil";
sub ncfxstrerror {
$OUTFD = "NCFXSTRERRORFD";
@@ -2422,10 +2420,10 @@ sub ncfxstrerror {
const char *p = ncmpi_strerror( *v1 );
size_t len = strlen(p);
/* d2 is the length of the string passed into the routine */
- if (len > d2) len = d2; /* MIN(len, d2) */
+ if (len > (size_t)d2) len = d2; /* MIN(len, d2) */
memcpy(v2, p, len);
/* Blank pad */
- if (len < d2) memset(v2+len, ' ', d2-len);
+ if (len < (size_t)d2) memset(v2+len, ' ', (size_t)d2-len);
return 0;
}\n";
close ($OUTFD);
@@ -2444,10 +2442,10 @@ sub ncfxstrerrno {
const char *p = ncmpi_strerrno( *v1 );
size_t len = strlen(p);
/* d2 is the length of the string passed into the routine */
- if (len > d2) len = d2; /* MIN(len, d2) */
+ if (len > (size_t)d2) len = d2; /* MIN(len, d2) */
memcpy(v2, p, len);
/* Blank pad */
- if (len < d2) memset(v2+len, ' ', d2-len);
+ if (len < (size_t)d2) memset(v2+len, ' ', (size_t)d2-len);
return 0;
}\n";
close ($OUTFD);
@@ -2459,6 +2457,7 @@ sub ncfxutil {
open( $OUTFD, ">nfxutil.c" ) || die "Cannot open nfxutil.c\n";
$files[$#files+1] = "nfxutil.c";
&print_copyright( );
+ &print_gcc_pragma( );
print $OUTFD "
int ncmpixVardim( int ncid, int varid )
{
@@ -2483,10 +2482,10 @@ sub ncfxinqlibvers {
const char *p = ncmpi_inq_libvers();
size_t len = strlen(p);
/* d1 is the length of the string passed into the routine */
- if (len > d1) len = d1; /* MIN(len, d1) */
+ if (len > (size_t)d1) len = d1; /* MIN(len, d1) */
memcpy(v1, p, len);
/* Blank pad */
- if (len < d1) memset(v1+len, ' ', d1-len);
+ if (len < (size_t)d1) memset(v1+len, ' ', (size_t)d1-len);
return 0;
}\n";
close ($OUTFD);
@@ -2511,47 +2510,6 @@ sub ncfissyserr {
}
-sub inq_file_info {
- $OUTFD = "GETFILEINFOFD";
- open( $OUTFD, ">inq_file_infof.c" ) || die "Cannot open inq_file_infof.c\n";
- $out_prefix = "nfmpi_";
- $files[$#files+1] = "inq_file_infof.c";
- $args = "int *, int *";
- &print_header( "ncfmpi_inq_file_info", "inq_file_info", $args );
- &print_routine_type_decl( $OUTFD, "inq_file_info" );
- &print_args( $OUTFD, $args, 0, "inq_file_info" );
- print $OUTFD "{
- int ierr;
- MPI_Info info;
-
- ierr = ncmpi_inq_file_info( *v1, &info );
- *v2 = MPI_Info_c2f(info);
- return ierr;
-}\n";
- close ($OUTFD);
-}
-
-sub get_file_info {
- $OUTFD = "GETFILEINFOFD";
- open( $OUTFD, ">get_file_infof.c" ) || die "Cannot open get_file_infof.c\n";
- $out_prefix = "nfmpi_";
- $files[$#files+1] = "get_file_infof.c";
- $args = "int *, int *";
- &print_header( "ncfmpi_get_file_info", "get_file_info", $args );
- &print_routine_type_decl( $OUTFD, "get_file_info" );
- &print_args( $OUTFD, $args, 0, "get_file_info" );
- print $OUTFD "{
- int ierr;
- MPI_Info info;
-
- ierr = ncmpi_get_file_info( *v1, &info );
- *v2 = MPI_Info_c2f(info);
- return ierr;
-}\n";
- close ($OUTFD);
-}
-
-
return 1;
# Local variables:
diff --git a/src/libf/pnetcdf.inc.in b/src/libf/pnetcdf.inc.in
index f400748..4c4cf3c 100644
--- a/src/libf/pnetcdf.inc.in
+++ b/src/libf/pnetcdf.inc.in
@@ -169,10 +169,10 @@
integer nf_max_name
integer nf_max_var_dims
- parameter (nf_max_dims = 512)
- parameter (nf_max_attrs = 4092)
- parameter (nf_max_vars = 4096)
- parameter (nf_max_name = 128)
+ parameter (nf_max_dims = 1024)
+ parameter (nf_max_attrs = 8192)
+ parameter (nf_max_vars = 8192)
+ parameter (nf_max_name = 256)
parameter (nf_max_var_dims = nf_max_dims)
!
@@ -1424,6 +1424,7 @@
integer nfmpi_inq_header_extent
integer nfmpi_inq_varoffset
integer nfmpi_inq_nreqs
+ integer nfmpi_inq_path
external nfmpi_buffer_attach
external nfmpi_buffer_detach
@@ -1435,6 +1436,7 @@
external nfmpi_inq_header_extent
external nfmpi_inq_varoffset
external nfmpi_inq_nreqs
+ external nfmpi_inq_path
!
! varn routines:
diff --git a/src/libf/strerrnof.f b/src/libf/strerrnof.f
index 05c0667..54f9109 100644
--- a/src/libf/strerrnof.f
+++ b/src/libf/strerrnof.f
@@ -6,5 +6,8 @@
external nfmpi_xstrerrno
ierr = nfmpi_xstrerrno( err, tmpstr )
+ if (tmpstr(1:2) .EQ. 'NC') then
+ tmpstr(2:2) = 'F'
+ end if
nfmpi_strerrno = tmpstr
end
diff --git a/src/libf90/Makefile.in b/src/libf90/Makefile.in
index 7b398f5..45a248c 100644
--- a/src/libf90/Makefile.in
+++ b/src/libf90/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2013, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2597 2016-11-04 22:12:08Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -30,7 +30,7 @@ ifeq (@UPPER_CASE_MOD@, yes)
endif
F90FLAGS += @FC_MODOUT at .
-M4FLAGS += -DINTENTV=@INTENTV@
+M4FFLAGS += -DINTENTV=@INTENTV@
M4_SRCS = getput_text.m4 \
getput_var.m4 \
@@ -66,7 +66,13 @@ DIST_GARBAGE = pnetcdf.f90 api.f90 nfmpi_constants.f90
all: $(LIBRARY)
-library $(LIBRARY): $(LIB_OBJS)
+objs: $(LIB_OBJS)
+
+library:
+ $(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
+ $(RANLIB) $(LIBRARY)
+
+$(LIBRARY): $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJS)
$(RANLIB) $(LIBRARY)
diff --git a/src/libf90/api.f90.in b/src/libf90/api.f90.in
index a1e037e..3e75e70 100644
--- a/src/libf90/api.f90.in
+++ b/src/libf90/api.f90.in
@@ -2,7 +2,7 @@
! Copyright (C) 2013, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: api.f90.in 2615 2016-11-13 23:58:41Z wkliao $
+! $Id: api.f90.in 2658 2016-11-27 22:13:48Z wkliao $
!
! @configure_input@
@@ -3427,6 +3427,12 @@ INTERFACE
INTEGER(KIND=MPI_OFFSET_KIND), INTENT(OUT) :: recsize
END FUNCTION nfmpi_inq_recsize
+ INTEGER FUNCTION nfmpi_inq_path(ncid, pathlen, path)
+ INTEGER, INTENT(IN) :: ncid
+ INTEGER, INTENT(OUT) :: pathlen
+ CHARACTER(len=*), INTENT(OUT) :: path
+ END FUNCTION nfmpi_inq_path
+
!
! Begin of varn subroutines:
!
diff --git a/src/libf90/dims.f90 b/src/libf90/dims.f90
index 92f4f4d..793b1ea 100644
--- a/src/libf90/dims.f90
+++ b/src/libf90/dims.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2013, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: dims.f90 1468 2013-10-26 16:53:18Z wkliao $
+! $Id: dims.f90 2688 2016-12-08 19:57:37Z wkliao $
!
! This file is taken from netcdf_dims.f90 with changes for PnetCDF use
!
@@ -50,6 +50,7 @@
integer (kind=MPI_OFFSET_KIND) :: length
nf90mpi_inquire_dimension = nfmpi_inq_dim(ncid, dimid, dimName, length)
+ if (nf90mpi_inquire_dimension .NE. NF90_NOERR) return
if(present(name)) name = trim(dimName)
if(present(len )) len = length
end function nf90mpi_inquire_dimension
diff --git a/src/libf90/file.f90 b/src/libf90/file.f90
index b61106e..e888ff0 100644
--- a/src/libf90/file.f90
+++ b/src/libf90/file.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2013, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: file.f90 2584 2016-10-27 18:53:05Z wkliao $
+! $Id: file.f90 2658 2016-11-27 22:13:48Z wkliao $
!
! This file is taken from netcdf_file.f90 with changes for PnetCDF use
!
@@ -14,7 +14,7 @@
! This file contains the netcdf file functions that are shared by
! netcdf-3 and netcdf-4.
-! $Id: file.f90 2584 2016-10-27 18:53:05Z wkliao $
+! $Id: file.f90 2658 2016-11-27 22:13:48Z wkliao $
! -------
function nf90mpi_inq_libvers()
character(len = 80) :: nf90mpi_inq_libvers
@@ -32,8 +32,15 @@ end function nf90mpi_strerror
function nf90mpi_strerrno(ncerr)
integer, intent( in) :: ncerr
character(len = 80) :: nf90mpi_strerrno
+ character(len = 80) :: strerrno
- nf90mpi_strerrno = nfmpi_strerrno(ncerr)
+ strerrno = nfmpi_strerrno(ncerr)
+ if (strerrno(1:3) .EQ. 'NF_') then
+ nf90mpi_strerrno(1:5) = 'NF90_'
+ nf90mpi_strerrno(6:80) = strerrno(4:78)
+ else
+ nf90mpi_strerrno = strerrno
+ end if
end function nf90mpi_strerrno
! -------
!
@@ -336,3 +343,13 @@ function nf90mpi_inq_default_format(default_format)
nf90mpi_inq_default_format = nfmpi_inq_default_format(default_format)
end function nf90mpi_inq_default_format
+! -------
+function nf90mpi_inq_path(ncid, pathlen, path)
+ integer, intent( in) :: ncid
+ integer, intent(out) :: pathlen
+ character (len = *), intent(out) :: path
+ integer :: nf90mpi_inq_path
+
+ nf90mpi_inq_path = nfmpi_inq_path(ncid, pathlen, path)
+end function nf90mpi_inq_path
+
diff --git a/src/libf90/visibility.f90 b/src/libf90/visibility.f90
index de632f6..4769f57 100644
--- a/src/libf90/visibility.f90
+++ b/src/libf90/visibility.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2013, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: visibility.f90 2584 2016-10-27 18:53:05Z wkliao $
+! $Id: visibility.f90 2658 2016-11-27 22:13:48Z wkliao $
!
! This file is taken from netcdf_visibility.f90 with changes for PnetCDF use
!
@@ -21,7 +21,7 @@
! File level inquiry
public :: nf90mpi_inquire, nf90mpi_inq_striping, &
nf90mpi_inq_num_rec_vars, nf90mpi_inq_num_fix_vars, &
- nf90mpi_inq_default_format
+ nf90mpi_inq_path, nf90mpi_inq_default_format
! Dimension routines
public :: nf90mpi_def_dim, nf90mpi_inq_dimid, &
@@ -492,7 +492,8 @@
nfmpi_inq_malloc_max_size, &
nfmpi_inq_malloc_list, &
nfmpi_inq_files_opened, &
- nfmpi_inq_recsize
+ nfmpi_inq_recsize, &
+ nfmpi_inq_path
!
! Begin of varn subroutines:
diff --git a/src/utils/ncmpidiff/Makefile.in b/src/utils/ncmpidiff/Makefile.in
index c40e95e..6421e85 100644
--- a/src/utils/ncmpidiff/Makefile.in
+++ b/src/utils/ncmpidiff/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2103 2015-09-18 23:34:03Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -60,4 +60,3 @@ TAGS: FORCE
include $(srcdir)/../../../rules.make
include $(srcdir)/depend
-.PHONY: $(LIBRARY)
diff --git a/src/utils/ncmpidiff/ncmpidiff.1 b/src/utils/ncmpidiff/ncmpidiff.1
index 3a7b045..625b77c 100644
--- a/src/utils/ncmpidiff/ncmpidiff.1
+++ b/src/utils/ncmpidiff/ncmpidiff.1
@@ -8,23 +8,26 @@ ncmpidiff \- compares two netCDF files in parallel
.SH SYNOPSIS
.ft B
.HP
-mpiexec -n 4 ncmpidiff
+mpiexec -n np ncmpidiff
.nh
\%[-b]
+\%[-q]
\%[-h]
\%[-v \fIvar1,...\fP]
\%\fIfile1 file2\fP
.hy
.ft
.SH DESCRIPTION
-\fBncmpidiff\fP compares the contents of the two files and reports
-the difference to the standard output.
+\fBncmpidiff\fP runs in parallel using np number of MPI processes to compare the
+contents of the two files and reports the difference to the standard output.
-If no argument is given besides the two file names, the entire
+If neither argument -v nor -h is given besides the two file names, the entire
files are compared.
.SH OPTIONS
.IP "\fB-b\fP"
-Verbose mode
+Verbose mode - print results (same or different) for all components (file, header, or variables) in comparison
+.IP "\fB-q\fP"
+Quiet mode - print nothing when two components in comparison are the same
.IP "\fB-h\fP"
Compare file header only
.IP "\fB-v\fP \fIvar1,...,varn\fP"
@@ -35,7 +38,7 @@ Compare only the given list of variables
.BR ncmpidump (1),
.BR pnetcdf (3)
.SH DATE
-$Date: 2013-11-17 00:21:28 -0600 (Sun, 17 Nov 2013) $
+$Date: 2016-12-18 19:49:08 -0600 (Sun, 18 Dec 2016) $
.LP
diff --git a/src/utils/ncmpidiff/ncmpidiff.c b/src/utils/ncmpidiff/ncmpidiff.c
index 9aec145..98af325 100644
--- a/src/utils/ncmpidiff/ncmpidiff.c
+++ b/src/utils/ncmpidiff/ncmpidiff.c
@@ -2,7 +2,7 @@
* Copyright (C) 2010, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: ncmpidiff.c 2382 2016-03-30 21:34:51Z wkliao $ */
+/* $Id: ncmpidiff.c 2731 2016-12-19 01:49:08Z wkliao $ */
/* wkliao: This diff utility compares header and variables of two files
* regardless the define order of the variables and attributes.
@@ -164,15 +164,15 @@ static void
usage(int rank, char *progname)
{
#define USAGE "\
- Compare the contents of two netCDF files.\n\n\
+ Compare the contents of two netCDF files.\n\
[-b] Verbose output\n\
- [-h] Compare header information only, no data\n\
- [-q] quiet mode (return 0/1 for same/different)\n\
+ [-q] quiet mode (no output if two files are the same)\n\
+ [-h] Compare header information only, no variables\n\
[-v var1[,...]] Compare variable(s) <var1>,... only\n\
file1 file2 File names of two input netCDF files to be compared\n"
if (rank == 0) {
- printf(" %s [-h] [-v ...] [-b] file1 file2\n%s", progname, USAGE);
+ printf(" %s [-b] [-q] [-h] [-v ...] file1 file2\n%s", progname, USAGE);
printf(" PnetCDF library version %s\n", ncmpi_inq_libvers());
}
MPI_Finalize();
@@ -734,22 +734,25 @@ int main(int argc, char **argv)
/* summary of the difference */
MPI_Reduce(&numVarDIFF, &varDIFF, 1, MPI_LONG_LONG_INT, MPI_SUM, 0, comm);
- if (!quiet && rank == 0) {
+ if (rank == 0) {
if (check_header) {
- if (numHeadDIFF == 0)
- printf("Headers of two files are the same\n");
+ if (numHeadDIFF == 0) {
+ if (!quiet) printf("Headers of two files are the same\n");
+ }
else
printf("Number of differences in header %lld\n",numHeadDIFF);
}
if (check_variable_list) {
- if (varDIFF == 0)
- printf("Compared variable(s) are the same\n");
+ if (varDIFF == 0) {
+ if (!quiet) printf("Compared variable(s) are the same\n");
+ }
else
printf("Compared variables(s) has %lld differences\n",varDIFF);
}
if (check_entire_file) {
- if (varDIFF == 0)
- printf("All variables of two files are the same\n");
+ if (varDIFF == 0) {
+ if (!quiet) printf("All variables of two files are the same\n");
+ }
else
printf("Number of differences in variables %lld\n",varDIFF);
}
diff --git a/src/utils/ncmpidump/Makefile.in b/src/utils/ncmpidump/Makefile.in
index 34193ce..e12a37d 100644
--- a/src/utils/ncmpidump/Makefile.in
+++ b/src/utils/ncmpidump/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2103 2015-09-18 23:34:03Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -71,4 +71,3 @@ TAGS: FORCE
include $(srcdir)/../../../rules.make
include $(srcdir)/depend
-.PHONY: $(LIBRARY)
diff --git a/src/utils/ncmpidump/dumplib.c b/src/utils/ncmpidump/dumplib.c
index d772d52..2ce6517 100644
--- a/src/utils/ncmpidump/dumplib.c
+++ b/src/utils/ncmpidump/dumplib.c
@@ -3,7 +3,7 @@
* See netcdf/README file for copying and redistribution conditions.
* $Header$
*********************************************************************/
-/* $Id: dumplib.c 1123 2013-01-26 17:35:03Z wkliao $ */
+/* $Id: dumplib.c 2725 2016-12-18 06:47:01Z wkliao $ */
/*
* We potentially include <stdarg.h> before <stdio.h> in order to obtain a
@@ -110,8 +110,9 @@ has_c_format_att(
case NC_NOERR:
if (cfmt_type == NC_CHAR && cfmt_len != 0 && cfmt_len < MAX_CFMT_LEN) {
ncmpi_stat = ncmpi_get_att_text(ncid, varid, "C_format", cfmt);
- if(ncmpi_stat != NC_NOERR)
+ if(ncmpi_stat != NC_NOERR) {
ncmpi_advise("Getting 'C_format' attribute", ncmpi_stat, "");
+ }
return &cfmt[0];
}
break;
diff --git a/src/utils/ncmpidump/ncmpidump.c b/src/utils/ncmpidump/ncmpidump.c
index 86ec499..e10a7be 100644
--- a/src/utils/ncmpidump/ncmpidump.c
+++ b/src/utils/ncmpidump/ncmpidump.c
@@ -3,7 +3,7 @@
* See netcdf/README file for copying and redistribution conditions.
* $Header$
*********************************************************************/
-/* $Id: ncmpidump.c 2567 2016-10-20 23:18:58Z wkliao $ */
+/* $Id: ncmpidump.c 2675 2016-12-04 18:55:24Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -842,9 +842,9 @@ main(int argc, char *argv[])
}
file_kind = check_file_signature(argv[0]);
- MPI_Bcast(&file_kind, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&file_kind, 1, MPI_INT, 0, MPI_COMM_WORLD);
- if (file_kind == UNKNOWN) {
+ if (file_kind == UNKNOWN || err != MPI_SUCCESS) {
err = EXIT_FAILURE;
goto fn_exit; /* file I/O error */
}
@@ -878,9 +878,9 @@ main(int argc, char *argv[])
do {
if (rank == 0)
file_kind = check_hdf5_signature(argv[i]);
- MPI_Bcast(&file_kind, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&file_kind, 1, MPI_INT, 0, MPI_COMM_WORLD);
- if (file_kind == UNKNOWN) {
+ if (file_kind == UNKNOWN || err != MPI_SUCCESS) {
err = EXIT_FAILURE;
goto fn_exit; /* file I/O error */
}
diff --git a/src/utils/ncmpigen/Makefile.in b/src/utils/ncmpigen/Makefile.in
index 18b1011..fdd4e2b 100644
--- a/src/utils/ncmpigen/Makefile.in
+++ b/src/utils/ncmpigen/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2264 2015-12-22 15:42:59Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -176,4 +176,3 @@ include $(srcdir)/../../../rules.make
include $(srcdir)/depend
-.PHONY: $(LIBRARY)
diff --git a/src/utils/ncmpivalid/Makefile.in b/src/utils/ncmpivalid/Makefile.in
index cc21cd2..ac62837 100644
--- a/src/utils/ncmpivalid/Makefile.in
+++ b/src/utils/ncmpivalid/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2103 2015-09-18 23:34:03Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -62,4 +62,3 @@ TAGS: FORCE
include $(srcdir)/../../../rules.make
include $(srcdir)/depend
-.PHONY: $(LIBRARY)
diff --git a/src/utils/ncmpivalid/ncmpivalid.c b/src/utils/ncmpivalid/ncmpivalid.c
index af0d39e..54a90b9 100644
--- a/src/utils/ncmpivalid/ncmpivalid.c
+++ b/src/utils/ncmpivalid/ncmpivalid.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: ncmpivalid.c 2569 2016-10-22 17:12:17Z wkliao $ */
+/* $Id: ncmpivalid.c 2726 2016-12-18 06:48:19Z wkliao $ */
#if HAVE_CONFIG_H
# include <ncconfig.h>
@@ -499,9 +499,8 @@ val_get_NC_attrarray(bufferinfo *gbp, NC_attrarray *ncap){
static int
val_get_NC_var(bufferinfo *gbp, NC_var **varpp) {
NC_string *strp;
- int status;
+ int dim, status;
MPI_Offset ndims, *tmp_dim;
- size_t dim;
NC_var *varp;
status = val_get_NC_string(gbp, &strp);
@@ -524,7 +523,7 @@ val_get_NC_var(bufferinfo *gbp, NC_var **varpp) {
for (dim = 0; dim < ndims; dim++ ) {
status = val_check_buffer(gbp, (gbp->version == 5 ? 8 : 4));
if(status != NC_NOERR) {
- printf("the dimid[%d] is expected for \"%s\" - ", (int)dim, strp->cp);
+ printf("the dimid[%d] is expected for \"%s\" - ", dim, strp->cp);
ncmpii_free_NC_var(varp);
return status;
}
diff --git a/src/utils/ncoffsets/ncoffsets.1 b/src/utils/ncoffsets/ncoffsets.1
index 0191668..578ca93 100644
--- a/src/utils/ncoffsets/ncoffsets.1
+++ b/src/utils/ncoffsets/ncoffsets.1
@@ -32,7 +32,7 @@ The output will include data values for the specified variables. One or more
variables must be specified by name in the comma-delimited list following this
option. The list must be a single argument to the command, hence cannot
contain blanks or other white space characters. The named variables must be
-valid netCDF variables in the input-file. The default, without this option is
+valid netCDF variables in the input file. The default, without this option is
to include data values for \fIall\fP variables in the output.
.IP "\fB-s\fP"
Print the variable size in bytes. For record variables, only the size of one
@@ -105,5 +105,5 @@ Check if there are gaps in between two adjacent fixed-size variables.
.LP
.BR pnetcdf (3)
.SH DATE
-$Date: 2016-01-10 14:33:45 -0600 (Sun, 10 Jan 2016) $
+$Date: 2016-11-16 15:33:05 -0600 (Wed, 16 Nov 2016) $
.LP
diff --git a/src/utils/ncoffsets/ncoffsets.c b/src/utils/ncoffsets/ncoffsets.c
index 87ea0ef..923c8e5 100644
--- a/src/utils/ncoffsets/ncoffsets.c
+++ b/src/utils/ncoffsets/ncoffsets.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: ncoffsets.c 2444 2016-05-22 23:48:35Z wkliao $ */
+/* $Id: ncoffsets.c 2709 2016-12-16 17:15:57Z wkliao $ */
#include <stdio.h>
#include <stdlib.h>
@@ -1707,23 +1707,24 @@ make_lvars(char *optarg, struct fspec* fspecp)
MALLOC_CHECK(fspecp->varp)
}
+/*----< check_gap_in_fixed_vars() >------------------------------------------*/
+/* check whether a gap (unused space in file between) two consecutive
+ * fixed-size variables. The gap is produced by file offset alignment which
+ * can be set by PnetCDF hint nc_var_align_size.
+ */
static int
check_gap_in_fixed_vars(NC *ncp)
{
int i, j;
- long long size, prev_end;
+ long long prev_end;
NC_var *varp, *prev;
- /* check only fixed-size variables */
+ /* check all fixed-size variables */
for (i=1; i<ncp->vars.ndefined; i++) {
varp = ncp->vars.value[i];
if (IS_RECVAR(varp)) continue;
- /* calculate the size in bytes of this variable */
- size = type_size(varp->type);
- if (varp->ndims) size *= varp->dsizes[0];
-
/* search for the previous fixed-size variable */
prev = NULL;
for (j=i-1; j>=0; j--) {
diff --git a/src/utils/pnetcdf_version/Makefile.in b/src/utils/pnetcdf_version/Makefile.in
index 4be7286..e9dac19 100644
--- a/src/utils/pnetcdf_version/Makefile.in
+++ b/src/utils/pnetcdf_version/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2014, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2478 2016-09-08 21:31:52Z wkliao $
+# $Id: Makefile.in 2659 2016-11-27 22:15:33Z wkliao $
#
# @configure_input@
@@ -53,4 +53,3 @@ uninstall:
include $(srcdir)/../../../rules.make
include $(srcdir)/depend
-.PHONY: $(LIBRARY)
diff --git a/src/utils/pnetcdf_version/pnetcdf_version.1 b/src/utils/pnetcdf_version/pnetcdf_version.1
index 35463d9..57c412a 100644
--- a/src/utils/pnetcdf_version/pnetcdf_version.1
+++ b/src/utils/pnetcdf_version/pnetcdf_version.1
@@ -10,7 +10,6 @@ pnetcdf_version \- print the version information of PnetCDF library
.HP
pnetcdf_version
.nh
-
\%[-v]
\%[-d]
\%[-c]
@@ -55,7 +54,7 @@ MPIF90: /usr/local/bin/mpif90 -g -O2
.LP
.BR pnetcdf (3)
.SH DATE
-$Date: 2014-07-11 13:07:40 -0500 (Fri, 11 Jul 2014) $
+$Date: 2016-11-16 15:33:05 -0600 (Wed, 16 Nov 2016) $
.LP
diff --git a/test/C/pres_temp_4D_rd.c b/test/C/pres_temp_4D_rd.c
index 8dad3a6..77562f0 100644
--- a/test/C/pres_temp_4D_rd.c
+++ b/test/C/pres_temp_4D_rd.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: pres_temp_4D_rd.c 2491 2016-09-25 03:36:28Z wkliao $ */
+/* $Id: pres_temp_4D_rd.c 2744 2016-12-28 16:25:22Z wkliao $ */
/*
This is an example which reads some 4D pressure and
@@ -16,12 +16,13 @@
Full documentation of the netCDF C API can be found at:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c
- $Id: pres_temp_4D_rd.c 2491 2016-09-25 03:36:28Z wkliao $
+ $Id: pres_temp_4D_rd.c 2744 2016-12-28 16:25:22Z wkliao $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <mpi.h>
#include <testutils.h>
@@ -108,9 +109,10 @@ main(int argc, char **argv)
if (argc == 2) filename = argv[1];
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for reading file", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for reading file", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* Open the file. */
@@ -226,5 +228,5 @@ main(int argc, char **argv)
}
MPI_Finalize();
- return 0;
+ return (nerrs) ? 2 : 0;
}
diff --git a/test/C/pres_temp_4D_wr.c b/test/C/pres_temp_4D_wr.c
index 2037606..4b32680 100644
--- a/test/C/pres_temp_4D_wr.c
+++ b/test/C/pres_temp_4D_wr.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: pres_temp_4D_wr.c 2392 2016-04-04 23:15:04Z wkliao $ */
+/* $Id: pres_temp_4D_wr.c 2744 2016-12-28 16:25:22Z wkliao $ */
/*
@@ -17,12 +17,13 @@
Full documentation of the netCDF C API can be found at:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c
- $Id: pres_temp_4D_wr.c 2392 2016-04-04 23:15:04Z wkliao $
+ $Id: pres_temp_4D_wr.c 2744 2016-12-28 16:25:22Z wkliao $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <mpi.h>
#include <testutils.h>
@@ -117,9 +118,10 @@ main(int argc, char ** argv)
if (argc == 2) filename = argv[1];
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for writing file", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for writing file", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* Create some pretend data. If this wasn't an example program, we
@@ -288,5 +290,5 @@ main(int argc, char ** argv)
MPI_Finalize();
- return 0;
+ return nerrs;
}
diff --git a/test/CXX/nctst.cpp b/test/CXX/nctst.cpp
index 1b9dcd7..950bbf5 100644
--- a/test/CXX/nctst.cpp
+++ b/test/CXX/nctst.cpp
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: nctst.cpp 2208 2015-11-29 00:52:26Z wkliao $ */
+/* $Id: nctst.cpp 2744 2016-12-28 16:25:22Z wkliao $ */
#include <stdio.h>
#include <stdlib.h>
@@ -13,6 +13,7 @@
using namespace std;
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf>
#include <testutils.h>
@@ -76,13 +77,14 @@ check_string_att(NcmpiAtt &att, const char *theName, const char *value)
att.getType() != ncmpiChar || att.getAttLength() != (long)strlen(value))
return NC_ERR;
+ int err=0;
char *value_in = (char*)malloc(strlen(value)+1);
att.getValues(value_in);
if (strncmp(value_in, value, strlen(value)))
- return NC_ERR;
+ err = NC_ERR;
free(value_in);
- return 0;
+ return err;
}
// Check the units and long_name attributes of a var to make sure they
@@ -497,7 +499,7 @@ int
main(int argc, char* argv[]) // test new netCDF interface
{
char filename[256];
- int rank, nprocs, verbose=0;
+ int rank, nprocs;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -508,21 +510,23 @@ main(int argc, char* argv[]) // test new netCDF interface
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
-
- if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C++ %s for APIs with different netCDF formats ", argv[0]);
- printf("%-66s ------ ", cmd_str);
- }
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+
+ if (rank == 0) {
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C++ %s for APIs with different netCDF formats ", basename(argv[0]));
+ printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
+ }
// Set up the format constants.
NcmpiFile::FileFormat format[NUM_FORMATS] =
{NcmpiFile::classic, NcmpiFile::classic2, NcmpiFile::classic5};
-
+#ifdef DEBUG
char format_name[NUM_FORMATS][NC_MAX_NAME] =
{"classic", "classic2", "classic5"};
+#endif
int nerrs = 0;
for (int i = 0; i < NUM_FORMATS; i++)
@@ -530,15 +534,20 @@ main(int argc, char* argv[]) // test new netCDF interface
if (gen(MPI_COMM_WORLD, filename, format[i]) ||
read(MPI_COMM_WORLD, filename, format[i]))
{
- if (verbose)
- cout << "*** FAILURE with format " << format_name[i] << "\n";
+#ifdef DEBUG
+ cout << "*** FAILURE with format " << format_name[i] << "\n";
+#endif
nerrs++;
}
- else if (verbose)
+#ifdef DEBUG
+ else
cout << "*** SUCCESS with format " << format_name[i] << "\n";
+#endif
}
- if (verbose) cout << "\n*** Total number of failures: " << nerrs << "\n";
+#ifdef DEBUG
+ cout << "\n*** Total number of failures: " << nerrs << "\n";
+#endif
MPI_Offset malloc_size, sum_size;
int err = ncmpi_inq_malloc_size(&malloc_size);
diff --git a/test/CXX/test_classic.cpp b/test/CXX/test_classic.cpp
index f9b6b1f..efe9fcf 100644
--- a/test/CXX/test_classic.cpp
+++ b/test/CXX/test_classic.cpp
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <iostream>
#include <pnetcdf>
#include <testutils.h>
@@ -20,13 +21,14 @@ int main( int argc, char *argv[] )
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C++ %s for creation of classic format file", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C++ %s for creation of classic format file", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
try
diff --git a/test/cdf_format/cdf_type.c b/test/cdf_format/cdf_type.c
index a7fb131..90f902f 100644
--- a/test/cdf_format/cdf_type.c
+++ b/test/cdf_format/cdf_type.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: cdf_type.c 2133 2015-09-26 19:16:01Z wkliao $ */
+/* $Id: cdf_type.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program tests if PnetCDF can detect CDF-5 data types that are not
* available in CDF-1 and CDF-2 formats
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -81,7 +82,7 @@ int test_var_types(char *filename,
/*----< main() >--------------------------------------------------------------*/
int main(int argc, char **argv)
{
- char *filename="testfile.nc";
+ char filename[256];
int rank, nerrs=0;
MPI_Init(&argc, &argv);
@@ -92,12 +93,14 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for CDF-5 type in CDF-1 and 2 ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for CDF-5 type in CDF-1 and 2 ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
nerrs += test_attr_types(filename, 0);
@@ -121,6 +124,6 @@ int main(int argc, char **argv)
}
MPI_Finalize();
- return 0;
+ return (nerrs) ? 2 : 0;
}
diff --git a/test/cdf_format/dim_cdf12.c b/test/cdf_format/dim_cdf12.c
index 0431ded..fae5417 100644
--- a/test/cdf_format/dim_cdf12.c
+++ b/test/cdf_format/dim_cdf12.c
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <limits.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -49,14 +50,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for defining dim in CDF-1/2 format ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for defining dim in CDF-1/2 format ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a new CDF-1 file ----------------------------------------------*/
@@ -197,6 +199,6 @@ int main(int argc, char** argv)
}
MPI_Finalize();
- return 0;
+ return (nerrs) ? 2 : 0;
}
diff --git a/test/cdf_format/test_inq_format.c b/test/cdf_format/test_inq_format.c
index 4222aaf..4cf5311 100644
--- a/test/cdf_format/test_inq_format.c
+++ b/test/cdf_format/test_inq_format.c
@@ -2,13 +2,14 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_inq_format.c 2250 2015-12-20 21:12:59Z wkliao $ */
+/* $Id: test_inq_format.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program tests if PnetCDF can report correct file formats */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -22,18 +23,20 @@ int main(int argc, char **argv) {
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- if (argc != 2) {
+ if (argc > 2) {
if (!rank) printf("Usage: %s dir_name\n",argv[0]);
MPI_Finalize();
return 0;
}
- strcpy(dir_name, argv[1]);
+ if (argc == 2) snprintf(dir_name, 256, "%s", argv[1]);
+ else strcpy(dir_name, ".");
MPI_Bcast(dir_name, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for inquiring CDF file formats ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for inquiring CDF file formats ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* test CDF-1 -----------------------------------------------------------*/
@@ -106,5 +109,5 @@ int main(int argc, char **argv) {
}
MPI_Finalize();
- return 0;
+ return (nerrs) ? 2 : 0;
}
diff --git a/test/common/testutils.c b/test/common/testutils.c
index 456d814..332acc4 100644
--- a/test/common/testutils.c
+++ b/test/common/testutils.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: testutils.c 2563 2016-10-18 02:43:48Z wkliao $ */
+/* $Id: testutils.c 2674 2016-12-04 05:35:09Z wkliao $ */
#include <stdio.h>
@@ -15,11 +15,13 @@
void parse_read_args(int argc, char **argv, int rank, params *p)
{
- int inlen, outlen;
+ int err, inlen, outlen;
if ( rank == 0 ) {
if (argc == 3 ) {
- strcpy(p->infname, argv[1]);
- strcpy(p->outfname, argv[2]);
+ strncpy(p->infname, argv[1], PATH_MAX-1);
+ strncpy(p->outfname, argv[2], PATH_MAX-1);
+ p->infname[PATH_MAX-1] = '\0';
+ p->outfname[PATH_MAX-1] = '\0';
} else if (argc == 1) {
strcpy(p->infname, "../data/test_double.nc");
strcpy(p->outfname, "testread.nc");
@@ -31,18 +33,24 @@ void parse_read_args(int argc, char **argv, int rank, params *p)
inlen = strlen(p->infname);
outlen = strlen(p->outfname);
}
- MPI_Bcast(&inlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(p->infname, inlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
- MPI_Bcast(&outlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(p->outfname, outlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+
+ err = MPI_Bcast(&inlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
+ err = MPI_Bcast(p->infname, inlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
+ err = MPI_Bcast(&outlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
+ err = MPI_Bcast(p->outfname, outlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
}
void parse_write_args(int argc, char **argv, int rank, params *p)
{
- int outlen;
+ int err, outlen;
if ( rank == 0 ) {
if (argc == 2 ) {
- strcpy(p->outfname, argv[1]);
+ strncpy(p->outfname, argv[1], PATH_MAX-1);
+ p->outfname[PATH_MAX-1] = '\0';
} else if (argc == 1) {
strcpy(p->outfname, "testwrite.nc");
} else {
@@ -51,8 +59,10 @@ void parse_write_args(int argc, char **argv, int rank, params *p)
}
outlen = strlen(p->outfname);
}
- MPI_Bcast(&outlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(p->outfname, outlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&outlen, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
+ err = MPI_Bcast(p->outfname, outlen+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
}
diff --git a/test/common/testutils.h b/test/common/testutils.h
index 80a04ce..48876ec 100644
--- a/test/common/testutils.h
+++ b/test/common/testutils.h
@@ -2,12 +2,14 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: testutils.h 2590 2016-10-31 21:37:02Z wkliao $ */
+/* $Id: testutils.h 2675 2016-12-04 18:55:24Z wkliao $ */
#ifndef _UTILS_H
#define _UTILS_H
+#include <stdlib.h>
+#include <string.h>
#include <limits.h>
#ifndef PATH_MAX
@@ -30,6 +32,14 @@ void parse_write_args(int argc, char **argv, int rank, params *p);
#define FAIL_STR "fail with %d mismatches\n"
#endif
+#define MPI_ERR(err) \
+ if (err != MPI_SUCCESS) { \
+ char err_string[MPI_MAX_ERROR_STRING+1]; \
+ int err_len; \
+ MPI_Error_string(err, err_string, &err_len); \
+ printf("MPI Error at file %s line %d (%s)\n",__FILE__,__LINE__,err_string); \
+ }
+
extern char* nc_err_code_name(int err);
#ifndef MPI_OFFSET
diff --git a/test/fandc/csnap.c b/test/fandc/csnap.c
index e7de071..d4539f8 100644
--- a/test/fandc/csnap.c
+++ b/test/fandc/csnap.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: csnap.c 2258 2015-12-22 04:50:40Z wkliao $ */
+/* $Id: csnap.c 2728 2016-12-18 17:49:20Z wkliao $ */
/******************************************************************************
@@ -91,14 +91,15 @@ int main(int argc, char *argv[]) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
sprintf(cmd_str, "*** TESTING C %s for 3D array write/read ", argv[0]);
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
verbose = 0;
diff --git a/test/header/header_consistency.c b/test/header/header_consistency.c
index 5e947ee..7966ca4 100644
--- a/test/header/header_consistency.c
+++ b/test/header/header_consistency.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: header_consistency.c 2497 2016-09-26 06:48:05Z wkliao $ */
+/* $Id: header_consistency.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program tests if PnetCDF can detect file header inconsistency and
* overwrite the inconsistent header with root's.
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -348,9 +349,10 @@ int main(int argc, char **argv)
if (argc == 2) filename = argv[1];
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for header consistency", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for header consistency", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
verbose = 1;
diff --git a/test/largefile/large_var.c b/test/largefile/large_var.c
index 19b9800..923911e 100644
--- a/test/largefile/large_var.c
+++ b/test/largefile/large_var.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: large_var.c 2300 2016-01-09 06:16:29Z wkliao $ */
+/* $Id: large_var.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -78,14 +79,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for writing to a large variable ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for writing to a large variable ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/nc_test/nc_test.c b/test/nc_test/nc_test.c
index 5f63f48..dde1d16 100644
--- a/test/nc_test/nc_test.c
+++ b/test/nc_test/nc_test.c
@@ -2,9 +2,10 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: nc_test.c 2606 2016-11-10 19:19:45Z wkliao $
+ * $Id: nc_test.c 2744 2016-12-28 16:25:22Z wkliao $
*/
+#include <libgen.h> /* basename() */
#include <unistd.h>
#include "tests.h"
@@ -159,7 +160,7 @@ main(int argc, char *argv[])
verbose = 1;
break;
case 'n': /* verbose mode */
- max_nmpt = atoi(optarg);
+ max_nmpt = (int)strtol(optarg,NULL,10);
break;
case '2':
cdf_format = 2;
@@ -211,9 +212,10 @@ main(int argc, char *argv[])
unlink(scratch);
}
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for format CDF-%d ", argv[0], cdf_format);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for format CDF-%d ", basename(argv[0]), cdf_format);
printf("%-66s ------ ",cmd_str);
+ free(cmd_str);
/* Test read-only functions, using pregenerated test-file */
NC_TEST(ncmpi_strerror);
diff --git a/test/nc_test/t_nc.c b/test/nc_test/t_nc.c
index fddcdfe..987df98 100644
--- a/test/nc_test/t_nc.c
+++ b/test/nc_test/t_nc.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: t_nc.c 2219 2015-12-11 22:30:03Z wkliao $ */
+/* $Id: t_nc.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program t_nc.c of the netCDF package */
@@ -27,6 +27,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -620,14 +621,15 @@ int main(int argc, char *argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF t_nc ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF t_nc ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* test CDF-1 format */
diff --git a/test/nc_test/test_get.m4 b/test/nc_test/test_get.m4
index f3b1366..1e81e56 100644
--- a/test/nc_test/test_get.m4
+++ b/test/nc_test/test_get.m4
@@ -10,7 +10,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_get.m4 2611 2016-11-11 19:26:14Z wkliao $ */
+/* $Id: test_get.m4 2672 2016-12-03 19:23:53Z wkliao $ */
dnl
dnl The command-line m4 macro "PNETCDF" is to differentiate PnetCDF and netCDF
@@ -21,6 +21,17 @@ dnl
#include "tests.h"
+ifdef(`PNETCDF',,`dnl
+#ifdef USE_PNETCDF
+#include <pnetcdf.h>
+#ifndef PNETCDF_VERSION_MAJOR
+#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
+#endif
+#ifndef PNETCDF_VERSION_MINOR
+#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
+#endif
+#endif')
+
define(`EXPECT_ERR',`error("expecting $1 but got %s",nc_err_code_name($2));')dnl
define(`IntType', `ifdef(`PNETCDF',`MPI_Offset',`size_t')')dnl
@@ -40,6 +51,22 @@ define(`GetVars',`ifdef(`PNETCDF',`ncmpi_get_vars_$1_all',`nc_get_vars_$1')')dnl
define(`GetVarm',`ifdef(`PNETCDF',`ncmpi_get_varm_$1_all',`nc_get_varm_$1')')dnl
define(`GetAtt', `ifdef(`PNETCDF',`ncmpi_get_att_$1',`nc_get_att_$1')')dnl
+define(`PNETCDF_CHECK_ERANGE',`dnl
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,`
+`#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)')',
+ `$1',`schar',`ifdef(`PNETCDF',,`
+`#'if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
+ else if (cdf_format < NC_FORMAT_CDF5) {
+`#'else')')
+ else {
+ifelse(`$1',`schar',`ifdef(`PNETCDF',,``#'endif')')
+ IF (err != NC_ERANGE)
+ EXPECT_ERR(NC_ERANGE, err)
+ ELSE_NOK
+ }
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')'
+)dnl
+
undefine(`index')dnl
dnl dnl dnl
dnl
@@ -121,7 +148,9 @@ ifdef(`PNETCDF',`dnl
CheckRange($1, expect)) {
IF (err != NC_NOERR) EXPECT_ERR(NC_NOERR, err)
}
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
else IF (err != NC_ERANGE) EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
}
else IF (err != NC_EINVALCOORDS) {
EXPECT_ERR(NC_EINVALCOORDS, err)
@@ -174,11 +203,8 @@ ifdef(`PNETCDF',`dnl
}
ELSE_NOK
}
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
- ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -236,13 +262,13 @@ TestFunc(var)_$1(VarArgs)
/* check if can detect a bad file ID */
err = GetVar($1)(BAD_ID, 0, value);
IF (err != NC_EBADID)
- error("expecting NC_EBADID but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADID, err)
ELSE_NOK
/* check if can detect a bad variable ID */
err = GetVar($1)(ncid, BAD_VARID, value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
for (i = 0; i < numVars; i++) {
@@ -275,10 +301,8 @@ TestFunc(var)_$1(VarArgs)
if (allInIntRange) {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -360,12 +384,12 @@ TestFunc(vara)_$1(VarArgs)
err = GetVara($1)(BAD_ID, 0, NULL, NULL, value);
IF (err != NC_EBADID)
- error("expecting NC_EBADID but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADID, err)
ELSE_NOK
err = GetVara($1)(ncid, BAD_VARID, NULL, NULL, value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
for (i = 0; i < numVars; i++) {
@@ -400,7 +424,9 @@ ifdef(`PNETCDF',`dnl
CheckRange($1, expect[0])) {
IF (err != NC_NOERR) EXPECT_ERR(NC_NOERR, err)
}
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
else IF (err != NC_ERANGE) EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
}
else IF (err != NC_EINVALCOORDS) {
EXPECT_ERR(NC_EINVALCOORDS, err)
@@ -411,7 +437,7 @@ ifdef(`PNETCDF',`dnl
err = GetVara($1)(ncid, i, start, NULL, value);
if (!canConvert) {
IF (err != NC_ECHAR)
- error("expecting NC_ECHAR, but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ECHAR, err)
ELSE_NOK
}
else if (var_rank[i] == 0) {
@@ -485,7 +511,9 @@ ifdef(`PNETCDF',`dnl
CheckRange($1, expect[0])) {
IF (err != NC_NOERR) EXPECT_ERR(NC_NOERR, err)
}
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
else IF (err != NC_ERANGE) EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
} else {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
@@ -533,10 +561,8 @@ ifdef(`PNETCDF',`dnl
if (allInIntRange) {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -622,12 +648,12 @@ TestFunc(vars)_$1(VarArgs)
err = GetVars($1)(BAD_ID, 0, NULL, NULL, NULL, value);
IF (err != NC_EBADID)
- error("expecting NC_EBADID but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADID, err)
ELSE_NOK
err = GetVars($1)(ncid, BAD_VARID, NULL, NULL, NULL, value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
for (i = 0; i < numVars; i++) {
@@ -674,7 +700,7 @@ ifdef(`PNETCDF',`dnl
err = GetVars($1)(ncid, i, start, NULL, NULL, value);
if (!canConvert) {
IF (err != NC_ECHAR)
- error("expecting NC_ECHAR, but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ECHAR, err)
ELSE_NOK
}
else if (var_rank[i] == 0) {
@@ -742,11 +768,13 @@ ifdef(`PNETCDF',`dnl
IF (err != NC_EINVALCOORDS)
EXPECT_ERR(NC_EINVALCOORDS, err)
start[j] = 0;
+ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)')
stride[j] = 0;
err = GetVars($1)(ncid, i, start, edge, stride, value);
IF (err != NC_ESTRIDE)
EXPECT_ERR(NC_ESTRIDE, err)
stride[j] = 1;
+ifdef(`PNETCDF',,``#'endif')
}
err = GetVars($1)(ncid, i, start, edge, stride, value);
@@ -759,7 +787,9 @@ ifdef(`PNETCDF',`dnl
CheckRange($1, expect[0])) {
IF (err != NC_NOERR) EXPECT_ERR(NC_NOERR, err)
}
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
else IF (err != NC_ERANGE) EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
} else {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
@@ -827,10 +857,8 @@ ifdef(`PNETCDF',`dnl
if (allInIntRange) {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -918,12 +946,12 @@ TestFunc(varm)_$1(VarArgs)
err = GetVarm($1)(BAD_ID, 0, NULL, NULL, NULL, NULL, value);
IF (err != NC_EBADID)
- error("expecting NC_EBADID but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADID, err)
ELSE_NOK
err = GetVarm($1)(ncid, BAD_VARID, NULL, NULL, NULL, NULL, value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
for (i = 0; i < numVars; i++) {
@@ -950,7 +978,7 @@ ifdef(`PNETCDF',`dnl
err = GetVarm($1)(ncid, i, NULL, NULL, NULL, NULL, value);
if (!canConvert) {
IF (err != NC_ECHAR)
- error("expecting NC_ECHAR, but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ECHAR, err)
ELSE_NOK
}
else if (var_rank[i] == 0) {
@@ -971,7 +999,7 @@ ifdef(`PNETCDF',`dnl
err = GetVarm($1)(ncid, i, start, NULL, NULL, NULL, value);
if (!canConvert) {
IF (err != NC_ECHAR)
- error("expecting NC_ECHAR, but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ECHAR, err)
ELSE_NOK
}
else if (var_rank[i] == 0) {
@@ -1038,11 +1066,13 @@ ifdef(`PNETCDF',`dnl
IF (err != NC_EINVALCOORDS)
EXPECT_ERR(NC_EINVALCOORDS, err)
start[j] = 0;
+ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=7)')
stride[j] = 0;
err = GetVarm($1)(ncid, i, start, edge, stride, imap, value);
IF (err != NC_ESTRIDE)
EXPECT_ERR(NC_ESTRIDE, err)
stride[j] = 1;
+ifdef(`PNETCDF',,``#'endif')
}
err = GetVarm($1)(ncid, i, start, edge, stride, imap, value);
@@ -1055,7 +1085,9 @@ ifdef(`PNETCDF',`dnl
CheckRange($1, expect[0])) {
IF (err != NC_NOERR) EXPECT_ERR(NC_NOERR, err)
}
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
else IF (err != NC_ERANGE) EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
} else {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
@@ -1129,10 +1161,8 @@ ifdef(`PNETCDF',`dnl
if (allInIntRange) {
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -1198,7 +1228,7 @@ int
TestFunc(att)_$1(AttVarArgs)
{
int i, j, err, ncid, cdf_format;
- IntType k;
+ IntType k, ndx[1];
int allInExtRange;
int allInIntRange;
int canConvert; /* Both text or both numeric */
@@ -1214,12 +1244,12 @@ TestFunc(att)_$1(AttVarArgs)
err = GetAtt($1)(BAD_ID, 0, NULL, value);
IF (err != NC_EBADID)
- error("expecting NC_EBADID but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADID, err)
ELSE_NOK
err = GetAtt($1)(ncid, BAD_VARID, NULL, value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
for (i = -1; i < numVars; i++) {
@@ -1228,22 +1258,26 @@ TestFunc(att)_$1(AttVarArgs)
err = GetAtt($1)(ncid, BAD_VARID, ATT_NAME(i,j), value);
IF (err != NC_ENOTVAR)
- error("expecting NC_ENOTVAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTVAR, err)
ELSE_NOK
+ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')
/* check if can detect a bad name */
err = GetAtt($1)(ncid, i, NULL, NULL);
IF (err != NC_EBADNAME)
- error("expecting NC_EBADNAME but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_EBADNAME, err)
ELSE_NOK
+ifdef(`PNETCDF',,``#'endif')
err = GetAtt($1)(ncid, i, "noSuch", value);
IF (err != NC_ENOTATT)
- error("expecting NC_ENOTATT but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ENOTATT, err)
+ ELSE_NOK
allInExtRange = allInIntRange = 1;
for (k = 0; k < ATT_LEN(i,j); k++) {
- expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, &k, NCT_ITYPE($1));
+ ndx[0] = k;
+ expect[k] = hash4(cdf_format, ATT_TYPE(i,j), -1, ndx, NCT_ITYPE($1));
if (inRange3(cdf_format, expect[k],ATT_TYPE(i,j),NCT_ITYPE($1))) {
/* netCDF specification make a special case for type
* conversion between uchar and scahr: do not check for
@@ -1262,14 +1296,16 @@ TestFunc(att)_$1(AttVarArgs)
if (allInExtRange) {
if (allInIntRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
+ EXPECT_ERR(NC_NOERR, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>7)')')
} else {
IF (err != NC_ERANGE)
- error("expecting NC_ERANGE but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ERANGE, err)
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')
}
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
- error("expecting NC_NOERR or NC_ERANGE but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
}
for (k = 0; k < ATT_LEN(i,j); k++) {
if (CheckNumRange($1, expect[k], ATT_TYPE(i,j))) {
@@ -1303,7 +1339,7 @@ TestFunc(att)_$1(AttVarArgs)
}
} else {
IF (err != NC_ECHAR)
- error("wrong type: expecting NC_ECHAR but got %s", nc_err_code_name(err));
+ EXPECT_ERR(NC_ECHAR, err)
}
}
}
diff --git a/test/nc_test/test_put.m4 b/test/nc_test/test_put.m4
index 982e79b..d586b91 100644
--- a/test/nc_test/test_put.m4
+++ b/test/nc_test/test_put.m4
@@ -10,7 +10,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_put.m4 2622 2016-11-15 17:40:08Z wkliao $ */
+/* $Id: test_put.m4 2672 2016-12-03 19:23:53Z wkliao $ */
dnl
dnl The command-line m4 macro "PNETCDF" is to differentiate PnetCDF and netCDF
@@ -21,6 +21,17 @@ dnl
#include "tests.h"
+ifdef(`PNETCDF',,`dnl
+#ifdef USE_PNETCDF
+#include <pnetcdf.h>
+#ifndef PNETCDF_VERSION_MAJOR
+#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
+#endif
+#ifndef PNETCDF_VERSION_MINOR
+#error("PNETCDF_VERSION_MAJOR is not defined in pnetcdf.h")
+#endif
+#endif')
+
define(`EXPECT_ERR',`error("expecting $1 but got %s",nc_err_code_name($2));')dnl
define(`IntType', `ifdef(`PNETCDF',`MPI_Offset',`size_t')')dnl
@@ -44,6 +55,22 @@ define(`PutAtt', `ifdef(`PNETCDF',`ncmpi_put_att_$1',`nc_put_att_$1')')dnl
define(`GetVar1',`ifdef(`PNETCDF',`ncmpi_get_var1_$1_all',`nc_get_var1_$1')')dnl
define(`DefVars',`ifdef(`PNETCDF',`def_vars($1,$2)',`def_vars($1)')')dnl
+define(`PNETCDF_CHECK_ERANGE',`dnl
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,`
+`#'if !defined(USE_PNETCDF) || (PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR>=8)')',
+ `$1',`schar',`ifdef(`PNETCDF',,`
+`#'if defined(USE_PNETCDF) && PNETCDF_VERSION_MAJOR==1 && PNETCDF_VERSION_MINOR<7
+ else if (cdf_format < NC_FORMAT_CDF5) {
+`#'else')')
+ else {
+ifelse(`$1',`schar',`ifdef(`PNETCDF',,``#'endif')')
+ IF (err != NC_ERANGE)
+ EXPECT_ERR(NC_ERANGE, err)
+ ELSE_NOK
+ }
+ifelse(`$1',`uchar',`ifdef(`PNETCDF',,``#'endif')')'
+)dnl
+
undefine(`index')dnl
dnl dnl dnl
dnl
@@ -85,11 +112,11 @@ define(`HASH',dnl
* ensure hash value within range for internal TYPE
*/
$1
-hash_$1(const int cdf_format,
- const nc_type type,
- const int rank,
- const IntType *index,
- const nct_itype itype)
+hash_$1(const int cdf_format,
+ const nc_type type,
+ const int rank,
+ const IntType *index,
+ const nct_itype itype)
{
double value;
@@ -240,7 +267,7 @@ check_atts_$1(int ncid, int numGatts, int numVars)
int i, j, cdf_format, err;
int canConvert; /* Both text or both numeric */
int nok = 0; /* count of valid comparisons */
- IntType k, length;
+ IntType k, length, ndx[1];
nc_type datatype;
IntType nInExtRange; /* number values within external range */
IntType nInIntRange; /* number values within internal range */
@@ -266,7 +293,8 @@ check_atts_$1(int ncid, int numGatts, int numVars)
assert(length <= MAX_NELS);
nInIntRange = nInExtRange = 0;
for (k = 0; k < length; k++) {
- expect[k] = hash4(cdf_format, datatype, -1, &k, NCT_ITYPE($1));
+ ndx[0] = k;
+ expect[k] = hash4(cdf_format, datatype, -1, ndx, NCT_ITYPE($1));
if (inRange3(cdf_format, expect[k], datatype, NCT_ITYPE($1))) {
++nInExtRange;
if (CheckRange($1, expect[k]))
@@ -276,7 +304,7 @@ check_atts_$1(int ncid, int numGatts, int numVars)
err = APIFunc(get_att_$1)(ncid, i, ATT_NAME(i,j), value);
if (nInExtRange == length && nInIntRange == length) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
+ EXPECT_ERR(NC_NOERR, err)
} else {
IF (err != NC_NOERR && err != NC_ERANGE)
EXPECT_ERR(NC_NOERR or NC_ERANGE, err)
@@ -428,17 +456,10 @@ ifdef(`PNETCDF',`dnl
if (canConvert) {
if (CheckRange3($1, value[0], var_type[i])) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
- ELSE_NOK
- } else {
- IF (err != NC_ERANGE) {
- EXPECT_ERR(NC_ERANGE, err)
- error("\n\t\tfor type %s value %.17e %ld",
- s_nc_type(var_type[i]),
- (double)value[0], (long)value[0]);
- }
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_ECHAR)
EXPECT_ERR(NC_ECHAR, err)
@@ -545,13 +566,10 @@ TestFunc(var)_$1(VarArgs)
if (canConvert) {
if (allInExtRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
- ELSE_NOK
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else { /* should flag wrong type even if nothing to write */
IF (err != NC_ECHAR)
EXPECT_ERR(NC_ECHAR, err)
@@ -590,7 +608,7 @@ TestFunc(var)_$1(VarArgs)
if (canConvert) {
if (allInExtRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
} else {
IF (err != NC_ERANGE)
@@ -815,11 +833,8 @@ ifdef(`PNETCDF',`dnl
IF (err != NC_NOERR)
EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
- ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_ECHAR)
EXPECT_ERR(NC_ECHAR, err)
@@ -1065,13 +1080,10 @@ ifdef(`PNETCDF',`dnl
if (canConvert) {
if (allInExtRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
- ELSE_NOK
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_ECHAR)
EXPECT_ERR(NC_ECHAR, err)
@@ -1326,13 +1338,10 @@ ifdef(`PNETCDF',`dnl
if (canConvert) {
if (allInExtRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
- ELSE_NOK
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
} else {
IF (err != NC_ECHAR)
EXPECT_ERR(NC_ECHAR, err)
@@ -1373,7 +1382,7 @@ int
TestFunc(att)_text(AttVarArgs)
{
int i, j, err, ncid, nok=0;
- IntType k;
+ IntType k, ndx[1];
text value[MAX_NELS];
err = FileCreate(scratch, NC_NOCLOBBER);
@@ -1416,12 +1425,13 @@ TestFunc(att)_text(AttVarArgs)
ELSE_NOK
for (k = 0; k < ATT_LEN(i,j); k++) {
- double dtmp = hash(ATT_TYPE(i,j), -1, &k);
+ ndx[0] = k;
+ double dtmp = hash(ATT_TYPE(i,j), -1, ndx);
value[k] = (text)dtmp;
}
err = PutAtt(text)(ncid, i, ATT_NAME(i,j), ATT_LEN(i,j), value);
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
}
@@ -1448,7 +1458,7 @@ TestFunc(att)_$1(AttVarArgs)
{
int i, j, err, ncid, cdf_format, nok=0;
int allInExtRange; /* all values within external range? */
- IntType k;
+ IntType k, ndx[1];
$1 value[MAX_NELS];
err = FileCreate(scratch, NC_NOCLOBBER);
@@ -1498,20 +1508,18 @@ TestFunc(att)_$1(AttVarArgs)
ELSE_NOK
for (allInExtRange = 1, k = 0; k < ATT_LEN(i,j); k++) {
- value[k] = hash_$1(cdf_format,ATT_TYPE(i,j), -1, &k, NCT_ITYPE($1));
+ ndx[0] = k;
+ value[k] = hash_$1(cdf_format,ATT_TYPE(i,j), -1, ndx, NCT_ITYPE($1));
IfCheckTextChar($1, ATT_TYPE(i,j))
allInExtRange &= inRange3(cdf_format, (double)value[k], ATT_TYPE(i,j), NCT_ITYPE($1));
}
err = PutAtt($1)(ncid, i, ATT_NAME(i,j), ATT_TYPE(i,j), ATT_LEN(i,j), value);
if (allInExtRange) {
IF (err != NC_NOERR)
- error("%s", APIFunc(strerror)(err));
- ELSE_NOK
- } else {
- IF (err != NC_ERANGE)
- EXPECT_ERR(NC_ERANGE, err)
+ EXPECT_ERR(NC_NOERR, err)
ELSE_NOK
}
+ PNETCDF_CHECK_ERANGE($1)
}
}
}
diff --git a/test/nc_test/test_read.m4 b/test/nc_test/test_read.m4
index 15c75ec..ef517e8 100644
--- a/test/nc_test/test_read.m4
+++ b/test/nc_test/test_read.m4
@@ -10,7 +10,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_read.m4 2616 2016-11-14 09:19:14Z wkliao $ */
+/* $Id: test_read.m4 2672 2016-12-03 19:23:53Z wkliao $ */
dnl
dnl The command-line m4 macro "PNETCDF" is to differentiate PnetCDF and netCDF
@@ -20,9 +20,11 @@ dnl types.
dnl
#include <sys/types.h> /* open() */
-#include <sys/stat.h> /* open() */
-#include <fcntl.h> /* open() */
-#include <unistd.h> /* unlink(), write() */
+#include <sys/stat.h> /* open() */
+#include <fcntl.h> /* open() */
+#include <unistd.h> /* unlink(), write() */
+#include <errno.h> /* errno, strerror() */
+
#include "tests.h"
define(`EXPECT_ERR',`error("expecting $1 but got %s",nc_err_code_name($2));')dnl
@@ -168,9 +170,14 @@ ifdef(`PNETCDF',
ifdef(`PNETCDF', ``#'if 1', ``#'if 0')
/* create a not-nc file */
fd = open(NOT_NC_FILE, O_CREAT|O_WRONLY, 0600);
- w_len = write(fd, "0123456789abcdefghijklmnopqrstuvwxyz", 36);
- assert(w_len >= 0);
- close(fd);
+ IF (fd == -1) {
+ error("Error: creating a non-CDF file (%s)", strerror(errno));
+ }
+ else {
+ w_len = write(fd, "0123456789abcdefghijklmnopqrstuvwxyz", 36);
+ assert(w_len >= 0);
+ close(fd);
+ }
/* Open a file that is not a netCDF file. */
err = FileOpen(NOT_NC_FILE, NC_NOWRITE, &ncid); /* should fail */
@@ -1728,7 +1735,7 @@ TestFunc(get_att)(AttVarArgs)
int ncid;
int i;
int j;
- IntType k;
+ IntType k, ndx[1];
int err;
double buf[MAX_NELS]; /* (void *) buffer */
char *p; /* (void *) pointer */
@@ -1760,7 +1767,8 @@ TestFunc(get_att)(AttVarArgs)
} else {
nok++;
for (k = 0; k < ATT_LEN(i,j); k++) {
- expect = hash(ATT_TYPE(i,j), -1, &k);
+ ndx[0] = k;
+ expect = hash(ATT_TYPE(i,j), -1, ndx);
p = (char *) buf;
p += k * (IntType)nctypelen(ATT_TYPE(i,j));
err = nc2dbl( ATT_TYPE(i,j), p, &got );
diff --git a/test/nc_test/test_write.m4 b/test/nc_test/test_write.m4
index 76f0c6e..c7d31ca 100644
--- a/test/nc_test/test_write.m4
+++ b/test/nc_test/test_write.m4
@@ -10,7 +10,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_write.m4 2621 2016-11-15 17:35:22Z wkliao $ */
+/* $Id: test_write.m4 2687 2016-12-08 18:32:13Z wkliao $ */
dnl
dnl The command-line m4 macro "PNETCDF" is to differentiate PnetCDF and netCDF
@@ -179,14 +179,16 @@ TestFunc(redef)(AttVarArgs)
error("close: %s", APIFunc(strerror)(err));
/* tests using scratch file */
- err = FileCreate(scratch, NC_NOCLOBBER, &ncid);
+ifdef(`PNETCDF',`dnl
+ err = FileCreate(scratch, NC_NOCLOBBER, &ncid);',`dnl
+ err = file__create(scratch, NC_NOCLOBBER, 0, &sizehint, &ncid);')
IF (err != NC_NOERR) {
error("create: %s", APIFunc(strerror)(err));
return nok;
}
+ifdef(`PNETCDF',,`dnl
/* limit for ncio implementations which have infinite chunksize */
- if(sizehint > 32768)
- sizehint = 16384;
+ if(sizehint > 32768) sizehint = 16384;')
def_dims(ncid);
Def_Vars(ncid, numVars);
Put_Atts(ncid, numGatts, numVars);
@@ -1648,7 +1650,7 @@ TestFunc(put_att)(AttVarArgs)
int varid;
int i;
int j;
- IntType k;
+ IntType k, ndx[1];
int err;
double buf[MAX_NELS]; /* (void *) buffer */
char *p; /* (void *) pointer */
@@ -1689,7 +1691,8 @@ TestFunc(put_att)(AttVarArgs)
ELSE_NOK
p = (char *) buf;
for (k=0; k<length; k++) {
- value = hash(datatype, -1, &k);
+ ndx[0] = k;
+ value = hash(datatype, -1, ndx);
if (!inRange(value, datatype))
value = 0;
err = dbl2nc(value, datatype, p);
@@ -1886,7 +1889,7 @@ TestFunc(rename_att)(AttVarArgs)
int err;
int i;
int j;
- IntType k;
+ IntType k, ndx[1];
int attnum;
char *attname;
char name[NC_MAX_NAME];
@@ -1973,7 +1976,8 @@ TestFunc(rename_att)(AttVarArgs)
IF (err != NC_NOERR)
error("get_att_text: %s", APIFunc(strerror)(err));
for (k = 0; k < attlength; k++) {
- expect = hash(datatype, -1, &k);
+ ndx[0] = k;
+ expect = hash(datatype, -1, ndx);
IF (text[k] != (char)expect)
error("get_att_text: unexpected value");
}
@@ -1982,7 +1986,8 @@ TestFunc(rename_att)(AttVarArgs)
IF (err != NC_NOERR)
error("get_att_double: %s", APIFunc(strerror)(err));
for (k = 0; k < attlength; k++) {
- expect = hash(datatype, -1, &k);
+ ndx[0] = k;
+ expect = hash(datatype, -1, ndx);
if (inRange(expect, datatype)) {
IF (!equal(value[k],expect,datatype,NCT_DOUBLE))
error("get_att_double: unexpected value");
@@ -2380,18 +2385,17 @@ APIFunc(get_file_version)(char *path, int *version)
if (fd == -1) return errno;
read_len = read(fd, magic, MAGIC_NUM_LEN);
- if (read_len == -1) {
- close(fd);
+ if (-1 == close(fd)) return errno;
+
+ if (read_len == -1)
return errno;
- }
+
if (read_len != MAGIC_NUM_LEN) {
printf("Error: reading NC magic string unexpected short read\n");
- close(fd);
return 0;
}
- if (strncmp(magic, "CDF", MAGIC_NUM_LEN-1)==0)
- {
+ if (strncmp(magic, "CDF", MAGIC_NUM_LEN-1)==0) {
if (magic[MAGIC_NUM_LEN-1] == NC_FORMAT_CLASSIC ||
magic[MAGIC_NUM_LEN-1] == NC_FORMAT_64BIT_OFFSET ||
magic[MAGIC_NUM_LEN-1] == NC_FORMAT_CDF5)
@@ -2457,11 +2461,13 @@ TestFunc(set_default_format)(void)
if (err != NC_NOERR)
error("bad file version = %d", err);
if (version != i) {
+#if 0
if (i == 4) {
if (version == 3) continue;
printf("expect version 3 but got %d (file=%s)",version,scratch);
continue;
}
+#endif
printf("expect version %d but got %d (file=%s)",i,version,scratch);
error("bad file version = %d", version);
}
diff --git a/test/nc_test/tests.h.m4 b/test/nc_test/tests.h.m4
index 75a1430..8f6a85f 100644
--- a/test/nc_test/tests.h.m4
+++ b/test/nc_test/tests.h.m4
@@ -10,7 +10,7 @@ dnl
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tests.h.m4 2610 2016-11-11 04:34:32Z wkliao $ */
+/* $Id: tests.h.m4 2649 2016-11-23 17:46:44Z wkliao $ */
define(`IntType', `ifdef(`PNETCDF',`MPI_Offset',`size_t')')dnl
define(`TestFunc',`ifdef(`PNETCDF',`test_ncmpi_put_$1',`test_nc_put_$1')')dnl
@@ -30,7 +30,7 @@ define(`APIFunc',` ifdef(`PNETCDF',`ncmpi_$1',`nc_$1')')dnl
#include <testutils.h>
#include "error.h"
-#include "ncconfig.h" /* output of 'configure' */
+#include <ncconfig.h> /* output of 'configure' */
#if defined(_CRAY) && !defined(_CRAYIEEE)
#define CRAYFLOAT 1 /* CRAY Floating point */
@@ -451,10 +451,7 @@ extern int
dbl2nc(const double d, const nc_type datatype, void *p);
extern double
-hash(const nc_type type, const int rank, const IntType *index );
-
-extern long long
-hashx_llong(const int rank, const IntType *index);
+hash(const nc_type type, const int rank, const IntType *index);
extern double
hash4(const int cdf_format, const nc_type type, const int rank, const IntType *index, const nct_itype itype);
diff --git a/test/nc_test/tst_atts.c b/test/nc_test/tst_atts.c
index 25ae1fd..d687fd5 100644
--- a/test/nc_test/tst_atts.c
+++ b/test/nc_test/tst_atts.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_atts.c 2270 2015-12-23 19:14:45Z wkliao $ */
+/* $Id: tst_atts.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_atts.c of the netCDF package */
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <limits.h> /* INT_MIN */
#include <pnetcdf.h>
@@ -2204,13 +2205,14 @@ int main(int argc, char *argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_atts ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_atts ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
verbose = 0;
diff --git a/test/nc_test/tst_atts3.c b/test/nc_test/tst_atts3.c
index b9367d6..ddaf7c6 100644
--- a/test/nc_test/tst_atts3.c
+++ b/test/nc_test/tst_atts3.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_atts3.c 2557 2016-10-15 22:21:06Z wkliao $ */
+/* $Id: tst_atts3.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_atts3.c of the netCDF package */
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <signal.h>
@@ -132,7 +133,7 @@ tst_att_ordering(char *filename, int cmode)
static int
tst_atts3(char *filename, int cmode)
{
- char filename2[128];
+ char filename2[256];
int err, nerrs=0;
signed char schar_in[ATT_LEN], schar_out[ATT_LEN] = {NC_MIN_BYTE, 1, NC_MAX_BYTE};
unsigned char uchar_in[ATT_LEN];
@@ -225,9 +226,11 @@ tst_atts3(char *filename, int cmode)
err=ncmpi_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, &att_type, &att_len); ERR
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERRV
if (!(speech_in = malloc(att_len + 1))) ERRV
- err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in); ERR
- if (strcmp(speech, speech_in)) ERRV
- free(speech_in);
+ else {
+ err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in); ERR
+ if (strcmp(speech, speech_in)) ERRV
+ free(speech_in);
+ }
/* Check numeric values. */
err=ncmpi_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in); ERR
for (i = 0; i < ATT_LEN; i++)
@@ -530,10 +533,12 @@ tst_atts3(char *filename, int cmode)
err=ncmpi_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME2, &att_type, &att_len); ERR
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERRV
if (!(speech_in = malloc(att_len + 1))) ERRV
- err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in); ERR
- if (strcmp(speech, speech_in)) ERRV
- free(speech_in);
- if ((err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) != NC_ENOTATT) ERR
+ else {
+ err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME2, speech_in); ERR
+ if (strcmp(speech, speech_in)) ERRV
+ if ((err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in)) != NC_ENOTATT) ERR
+ free(speech_in);
+ }
err=ncmpi_close(ncid); ERR
/* Now delete the att. */
@@ -725,9 +730,11 @@ tst_atts3(char *filename, int cmode)
err=ncmpi_inq_att(ncid, NC_GLOBAL, ATT_TEXT_NAME, &att_type, &att_len); ERR
if (att_type != NC_CHAR || att_len != strlen(speech) + 1) ERRV
if (!(speech_in = malloc(att_len + 1))) ERRV
- err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in); ERR
- if (strcmp(speech, speech_in)) ERRV
- free(speech_in);
+ else {
+ err=ncmpi_get_att_text(ncid, NC_GLOBAL, ATT_TEXT_NAME, speech_in); ERR
+ if (strcmp(speech, speech_in)) ERRV
+ free(speech_in);
+ }
/* Check numeric values. */
err=ncmpi_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in); ERR
for (i = 0; i < ATT_LEN; i++)
@@ -752,7 +759,7 @@ tst_atts3(char *filename, int cmode)
int main(int argc, char *argv[])
{
- char filename[128];
+ char filename[256];
int cmode, rank, nprocs, err, nerrs=0;
MPI_Init(&argc, &argv);
@@ -764,13 +771,14 @@ int main(int argc, char *argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
- MPI_Bcast(filename, 128, MPI_CHAR, 0, MPI_COMM_WORLD);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+ MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_atts3 ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_atts3 ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
verbose = 0;
diff --git a/test/nc_test/tst_misc.c b/test/nc_test/tst_misc.c
index 120bde6..2d7c1cc 100644
--- a/test/nc_test/tst_misc.c
+++ b/test/nc_test/tst_misc.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_misc.c 2476 2016-09-06 01:05:33Z wkliao $ */
+/* $Id: tst_misc.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_misc.c of the netCDF package */
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -26,7 +27,7 @@
int
main(int argc, char **argv)
{
- char filename[128];
+ char *cmd_str, filename[256];
int rank, nprocs, err, nerrs=0;
MPI_Init(&argc, &argv);
@@ -38,13 +39,14 @@ main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
if (rank > 0) goto fn_exit;
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF t_misc ", argv[0]);
+ cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF t_misc ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
/*
printf("\n*** Testing some extra stuff.\n");
printf("*** Trying to open non-netCDF files of tiny length...");
@@ -64,8 +66,10 @@ main(int argc, char **argv)
{
/* Create a small file which is not a netCDF file. */
if (!(file = fopen(filename, "w+"))) nerrs++;
- if (fwrite(dummy_data, 1, i, file) != i) nerrs++;
- if (fclose(file)) nerrs++;
+ else {
+ if (fwrite(dummy_data, 1, i, file) != i) nerrs++;
+ if (fclose(file)) nerrs++;
+ }
/* Make sure that netCDF rejects this file politely. */
openstat = ncmpi_open(MPI_COMM_SELF, filename, NC_NOWRITE, MPI_INFO_NULL, &ncid);
diff --git a/test/nc_test/tst_names.c b/test/nc_test/tst_names.c
index 4ce6b31..63e4462 100644
--- a/test/nc_test/tst_names.c
+++ b/test/nc_test/tst_names.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_names.c 2133 2015-09-26 19:16:01Z wkliao $ */
+/* $Id: tst_names.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_names.c of the netCDF package */
@@ -16,11 +16,15 @@
*/
#include <stdlib.h>
#include <stdio.h>
+#include <libgen.h> /* basename() */
#include <string.h>
#include <pnetcdf.h>
#include <testutils.h>
+#define ERROR {printf("Error at line %d: %s\n",__LINE__,ncmpi_strerror(res)); nerrs++;}
+#define ERRORI {printf("Error at line %d (loop=%d): %s\n",__LINE__,i,ncmpi_strerror(res)); nerrs++;}
+
/* The data file we will create. */
#define NDIMS 1
#define DIMLEN 1
@@ -211,14 +215,13 @@ main(int argc, char **argv)
char attstr_in[MAX_ATTSTRING_LEN];
int dimids[NUM_GOOD];
int varids[NUM_GOOD];
-#if 0
- int attnums[NUM_GOOD];
-#endif
- char *format_names[] = { "CDF-2", "CDF-5" };
int cmode[2] = {NC_64BIT_OFFSET, NC_64BIT_DATA};
+#ifdef DEBUG
+ char *format_names[] = { "CDF-2", "CDF-5" };
+#endif
- char filename[128];
- int rank, nprocs, err, nerrs=0, verbose=0;
+ char filename[256];
+ int rank, nprocs, err, nerrs=0;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@@ -229,20 +232,22 @@ main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_names ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_names ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
-#define ERROR {printf("Error at line %d: %s\n",__LINE__,ncmpi_strerror(res)); nerrs++;}
-#define ERRORI {printf("Error at line %d (loop=%d): %s\n",__LINE__,i,ncmpi_strerror(res)); nerrs++;}
-
- if (verbose) printf("\n*** testing names with file %s...\n", filename);
+#ifdef DEBUG
+ printf("\n*** testing names with file %s...\n", filename);
+#endif
for (j = 0; j < 2; j++)
{
- if (verbose) printf("*** switching to netCDF %s format...", format_names[j]);
+#ifdef DEBUG
+ printf("*** switching to netCDF %s format...", format_names[j]);
+#endif
if((res = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER|cmode[j], MPI_INFO_NULL, &ncid)))
ERROR
@@ -262,9 +267,6 @@ main(int argc, char **argv)
ERRORI
if ((res = ncmpi_put_att_double(ncid, NC_GLOBAL, valid[i], NC_DOUBLE, NATTVALS, attvals)))
ERRORI
-#if 0
- attnums[i] = i;
-#endif
}
/* Try defining dimensions, variables, and attributes with various
diff --git a/test/nc_test/tst_nofill.c b/test/nc_test/tst_nofill.c
index 1115df3..9e25447 100644
--- a/test/nc_test/tst_nofill.c
+++ b/test/nc_test/tst_nofill.c
@@ -9,11 +9,12 @@
when invoked with the blksize argument between 2091953 and 2150032,
inclusive, and succeeds for other blksizes.
- $Id: tst_nofill.c 2219 2015-12-11 22:30:03Z wkliao $
+ $Id: tst_nofill.c 2744 2016-12-28 16:25:22Z wkliao $
*/
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <limits.h>
#include <stdlib.h>
#include <errno.h>
@@ -360,13 +361,14 @@ main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for fill/nofill modes ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for fill/nofill modes ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
sprintf(fill_filename, "%s.fill", filename);
sprintf(nofill_filename, "%s.nofill", filename);
diff --git a/test/nc_test/tst_norm.c b/test/nc_test/tst_norm.c
index 57a5261..3183fff 100644
--- a/test/nc_test/tst_norm.c
+++ b/test/nc_test/tst_norm.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_norm.c 2219 2015-12-11 22:30:03Z wkliao $ */
+/* $Id: tst_norm.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_norm.c of the netCDF package */
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -168,7 +169,7 @@ int
main(int argc, char **argv)
{
char filename[256];
- int rank, nprocs, cmode, err, nerrs=0, verbose=0;
+ int rank, nprocs, cmode, err, nerrs=0;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@@ -179,15 +180,16 @@ main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_norm ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_norm ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
- if (verbose) printf("\n*** testing UTF-8 normalization...");
+ /*---- testing UTF-8 normalization ----*/
/* test CDF-2 format */
cmode = NC_CLOBBER | NC_64BIT_OFFSET;
diff --git a/test/nc_test/tst_small.c b/test/nc_test/tst_small.c
index 10fd706..9899e2b 100644
--- a/test/nc_test/tst_small.c
+++ b/test/nc_test/tst_small.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: tst_small.c 2205 2015-11-28 20:41:50Z wkliao $ */
+/* $Id: tst_small.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* This program is based on the test program tst_small.c of the netCDF package */
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -46,6 +47,7 @@ test_small_atts(const char *testfile, int cmode)
{
/* Create null-terminated text string of correct length. */
strncpy(att, source, t);
+ att[t] = '\0';
/* Create a file with one attribute. */
err = ncmpi_create(MPI_COMM_WORLD, testfile,cmode, MPI_INFO_NULL, &ncid); ERR
@@ -411,7 +413,7 @@ test_one_with_att(const char *testfile, int cmode)
int main(int argc, char *argv[])
{
char filename[256];
- int i, rank, nprocs, err, nerrs=0, verbose=0;
+ int i, rank, nprocs, err, nerrs=0;
int cmode[NUM_FORMATS]={0, NC_64BIT_OFFSET, NC_64BIT_DATA};
MPI_Init(&argc, &argv);
@@ -423,39 +425,56 @@ int main(int argc, char *argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_small ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for emulating netCDF tst_small ", basename(argv[0]));
if (rank == 0) printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
for (i=0; i<NUM_FORMATS; i++) {
- if (verbose) printf("*** testing simple small file with a global attribute...");
+#ifdef DEBUG
+ printf("*** testing simple small file with a global attribute...");
+#endif
nerrs += test_small_atts(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing simple small file with fixed dimensions...");
+#ifdef DEBUG
+ printf("*** testing simple small file with fixed dimensions...");
+#endif
nerrs += test_small_fixed(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing simple small file with an unlimited dimension...");
+#ifdef DEBUG
+ printf("*** testing simple small file with an unlimited dimension...");
+#endif
nerrs += test_small_unlim(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing small file with one variable...");
+#ifdef DEBUG
+ printf("*** testing small file with one variable...");
+#endif
nerrs += test_small_one(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing small file with one variable and one att...");
+#ifdef DEBUG
+ printf("*** testing small file with one variable and one att...");
+#endif
nerrs += test_one_with_att(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing small file with one record variable, which grows...");
+#ifdef DEBUG
+ printf("*** testing small file with one record variable, which grows...");
+#endif
nerrs += test_one_growing(filename, cmode[i]|NC_CLOBBER);
- if (verbose) printf("*** testing small file with one growing record "
+#ifdef DEBUG
+ printf("*** testing small file with one growing record "
"variable, with attributes added...");
+#endif
nerrs += test_one_growing_with_att(filename, cmode[i]|NC_CLOBBER);
+#ifdef DEBUG
if (verbose) printf("*** testing small file with two growing record "
"variables, with attributes added...");
+#endif
nerrs += test_two_growing_with_att(filename, cmode[i]|NC_CLOBBER);
}
diff --git a/test/nc_test/util.c b/test/nc_test/util.c
index 1c21c88..5837f50 100644
--- a/test/nc_test/util.c
+++ b/test/nc_test/util.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: util.c 2610 2016-11-11 04:34:32Z wkliao $
+ * $Id: util.c 2672 2016-12-03 19:23:53Z wkliao $
*/
#include <math.h> /* floor() */
@@ -421,16 +421,17 @@ int dbl2nc ( const double d, const nc_type xtype, void *p)
/* Generate data values as function of type, rank (-1 for attribute), index */
double
-hash( const nc_type xtype, const int rank, const MPI_Offset *index )
+hash(const nc_type xtype,
+ const int rank,
+ const MPI_Offset *index)
{
double base;
double result = 0.0;
- int d; /* index of dimension */
/* If vector then elements 0 & 1 are min & max. Elements 2 & 3 are */
/* just < min & > max (except for NC_CHAR & NC_DOUBLE) */
- if (abs(rank) == 1 && index[0] <= 3) {
- switch (index[0]) {
+ if (abs(rank) == 1 && *index <= 3) {
+ switch (*index) {
case 0:
switch (xtype) { /* test if can get/put MIN value */
case NC_CHAR: return X_CHAR_MIN;
@@ -515,13 +516,16 @@ hash( const nc_type xtype, const int rank, const MPI_Offset *index )
base = 0;
assert(0);
}
- if (rank < 0) /* attribute */
+ if (rank < 0) { /* attribute */
result = base * 7;
- else
+ result = base * (result + *index);
+ }
+ else {
+ int d; /* index of dimension */
result = base * (rank + 1);
-
- for (d=0; d<abs(rank); d++)
- result = base * (result + index[d]);
+ for (d=0; d<rank; d++, index++)
+ result = base * (result + *index);
+ }
}
return result;
}
@@ -668,6 +672,7 @@ init_gvars(int numGatts, int numTypes, int numVars)
var_type[vn] = char2type(type_letter[xtype]);
var_rank[vn] = rank;
var_natts[vn] = rank == 0 ? vn % (MAX_NATTS + 1) : 0;
+ /* set atteributes only for scalar variables */
/* ac block */
for (ac=0; ac<var_natts[vn]; ac++, an++) {
@@ -734,7 +739,7 @@ void
put_atts(int ncid, int numGatts, int numVars)
{
int i, j, allInRange, err;
- MPI_Offset k;
+ MPI_Offset k, ndx[1];
char catt[MAX_NELS];
double att[MAX_NELS];
@@ -742,7 +747,8 @@ put_atts(int ncid, int numGatts, int numVars)
for (j=0; j<NATTS(i); j++) {
if (ATT_TYPE(i,j) == NC_CHAR) {
for (k=0; k<ATT_LEN(i,j); k++) {
- catt[k] = hash(ATT_TYPE(i,j), -1, &k);
+ ndx[0] = k;
+ catt[k] = hash(ATT_TYPE(i,j), -1, ndx);
}
err = ncmpi_put_att_text(ncid, i, ATT_NAME(i,j),
ATT_LEN(i,j), catt);
@@ -750,7 +756,8 @@ put_atts(int ncid, int numGatts, int numVars)
error("ncmpi_put_att_text: %s", ncmpi_strerror(err));
} else {
for (allInRange=1, k=0; k<ATT_LEN(i,j); k++) {
- att[k] = hash(ATT_TYPE(i,j), -1, &k);
+ ndx[0] = k;
+ att[k] = hash(ATT_TYPE(i,j), -1, ndx);
allInRange = allInRange && inRange(att[k], ATT_TYPE(i,j));
}
err = ncmpi_put_att_double(ncid, i, ATT_NAME(i,j),
@@ -950,7 +957,7 @@ check_atts(int ncid, int numGatts, int numVars)
char name[NC_MAX_NAME], text[MAX_NELS];
int i, j, err; /* status */
nc_type xtype;
- MPI_Offset k, length;
+ MPI_Offset k, length, ndx[1];
double expect, value[MAX_NELS];
int nok = 0; /* count of valid comparisons */
@@ -973,7 +980,8 @@ check_atts(int ncid, int numGatts, int numVars)
IF (err != NC_NOERR)
error("ncmpi_get_att_text: %s", ncmpi_strerror(err));
for (k = 0; k < ATT_LEN(i,j); k++) {
- expect = hash(xtype, -1, &k);
+ ndx[0] = k;
+ expect = hash(xtype, -1, ndx);
if (text[k] != (char)expect) {
error("ncmpi_get_att_text: unexpected value");
} else {
@@ -983,7 +991,8 @@ check_atts(int ncid, int numGatts, int numVars)
} else {
err = ncmpi_get_att_double(ncid, i, name, value);
for (k = 0; k < ATT_LEN(i,j); k++) {
- expect = hash(xtype, -1, &k);
+ ndx[0] = k;
+ expect = hash(xtype, -1, ndx);
if (inRange(expect,ATT_TYPE(i,j))) {
IF (err != NC_NOERR)
error("ncmpi_get_att_double: %s", ncmpi_strerror(err));
diff --git a/test/nf90_test/test_get.m4 b/test/nf90_test/test_get.m4
index fe45f39..f602258 100644
--- a/test/nf90_test/test_get.m4
+++ b/test/nf90_test/test_get.m4
@@ -10,14 +10,24 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_get.m4 2619 2016-11-14 22:50:46Z wkliao $
+! $Id: test_get.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
dnl This is m4 source.
dnl Process using m4 to produce FORTRAN language file.
-changequote([,])
+changequote([,])dnl
+
+define([TestFunc],[ifdef([PNETCDF],[test_nf90mpi_get_$1],[test_nf90_get_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nf90mpi_$1],[nf90_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nf90mpi_strerror($1)],[nf90_strerror($1)])])dnl
+
+define([FileOpen],[ifdef([PNETCDF],[nf90mpi_open(comm,$1,$2,info,ncid)],[nf90_open($1,$2,ncid)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nf90mpi_close($1)],[nf90_close($1)])])dnl
+
+define([GetVar],[ifdef([PNETCDF],[nf90mpi_get_var_all($*)],[nf90_get_var($*)])])dnl
+define([GetAtt],[ifdef([PNETCDF],[nf90mpi_get_att($*)],[nf90_get_att($*)])])dnl
undefine([index])dnl
@@ -107,7 +117,7 @@ ifelse($1, double, doubleprecision $2($3))[]dnl
dnl TEST_NFMPI_GET_VAR1(TYPE)
dnl
define([TEST_NFMPI_GET_VAR1],[dnl
- subroutine test_nf90mpi_get_var1_$1()
+ subroutine TestFunc(var1_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -128,25 +138,24 @@ define([TEST_NFMPI_GET_VAR1],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
- err = nf90mpi_begin_indep_data(ncid)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nf90mpi_get_var(BAD_ID, i, value(1:1), index)
+ err = GetVar(BAD_ID, i, value(1:1), index)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var(ncid, BAD_VARID, value(1:1), index)
+ err = GetVar(ncid, BAD_VARID, value(1:1), index)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
index(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var(ncid, i, value(1:1), index)
+ err = GetVar(ncid, i, value(1:1), index)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -162,14 +171,14 @@ define([TEST_NFMPI_GET_VAR1],[dnl
call error('error in index2indexes 1')
expect = hash4( var_type(i), var_rank(i), index, &
NFT_ITYPE($1) )
- err = nf90mpi_get_var(ncid, i, value(1:1), index)
+ err = GetVar(ncid, i, value(1:1), index)
if (canConvert) then
if (inRange3(expect,var_type(i), &
NFT_ITYPE($1))) then
if (in_internal_range(NFT_ITYPE($1), &
expect)) then
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_get_var: ', err)
+ call errore('GetVar: ', err)
else
val = ARITH_VAR1($1, value)
if (.not. equal(val, expect, &
@@ -194,10 +203,9 @@ define([TEST_NFMPI_GET_VAR1],[dnl
end if
4 continue
1 continue
- err = nf90mpi_end_indep_data(ncid)
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -205,7 +213,7 @@ define([TEST_NFMPI_GET_VAR1],[dnl
dnl TEST_NFMPI_GET_VAR(TYPE)
dnl
define([TEST_NFMPI_GET_VAR],[dnl
- subroutine test_nf90mpi_get_var_$1()
+ subroutine TestFunc(var_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -229,17 +237,16 @@ define([TEST_NFMPI_GET_VAR],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nf90mpi_get_var_all(BAD_ID, i, value)
+ err = GetVar(BAD_ID, i, value)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value)
+ err = GetVar(ncid, BAD_VARID, value)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
nels = 1
@@ -262,12 +269,12 @@ define([TEST_NFMPI_GET_VAR],[dnl
allInExtRange = .false.
end if
4 continue
- err = nf90mpi_get_var_all(ncid, i, VALUE3($1, value), count=var_shape(:,i))
+ err = GetVar(ncid, i, VALUE3($1, value), count=var_shape(:,i))
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_get_var_all: ', err)
+ call errore('GetVar: ', err)
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -294,9 +301,9 @@ define([TEST_NFMPI_GET_VAR],[dnl
call errore('wrong type: ', err)
end if
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -305,7 +312,7 @@ define([TEST_NFMPI_GET_VAR],[dnl
dnl TEST_NFMPI_GET_VARA(TYPE)
dnl
define([TEST_NFMPI_GET_VARA],[dnl
- subroutine test_nf90mpi_get_vara_$1()
+ subroutine TestFunc(vara_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -336,9 +343,9 @@ define([TEST_NFMPI_GET_VARA],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -348,20 +355,20 @@ define([TEST_NFMPI_GET_VARA],[dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge)
+ err = GetVar(BAD_ID, i, value, start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, edge)
+ err = GetVar(ncid, BAD_VARID, value, start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (canConvert .and. err .ne. NF90_EINVALCOORDS) &
call errore('bad index: ', err)
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (canConvert .and. err .ne. NF90_EEDGE) &
call errore('bad edge: ', err)
edge(j) = 1
@@ -373,30 +380,30 @@ define([TEST_NFMPI_GET_VARA],[dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge)
+ err = GetVar(BAD_ID, i, value, start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, edge)
+ err = GetVar(ncid, BAD_VARID, value, start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -406,10 +413,10 @@ define([TEST_NFMPI_GET_VARA],[dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -457,12 +464,12 @@ define([TEST_NFMPI_GET_VARA],[dnl
allInExtRange = .false.
end if
10 continue
- err = nf90mpi_get_var_all(ncid, i, value, start, edge)
+ err = GetVar(ncid, i, value, start, edge)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_get_var:', err)
+ call errore('GetVar:', err)
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -497,9 +504,9 @@ define([TEST_NFMPI_GET_VARA],[dnl
end if
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errorc('nf90mpi_close: ', nf90mpi_strerror(err))
+ call errorc('APIFunc(close): ', ErrFunc(err))
call print_nok(nok)
end
])dnl
@@ -509,7 +516,7 @@ dnl TEST_NFMPI_GET_VARS(TYPE)
dnl
define([TEST_NFMPI_GET_VARS],dnl
[dnl
- subroutine test_nf90mpi_get_vars_$1()
+ subroutine TestFunc(vars_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -546,9 +553,9 @@ define([TEST_NFMPI_GET_VARS],dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -559,15 +566,15 @@ define([TEST_NFMPI_GET_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge, stride)
+ err = GetVar(BAD_ID, i, value, start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, edge, stride)
+ err = GetVar(ncid, BAD_VARID, value, start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -577,7 +584,7 @@ define([TEST_NFMPI_GET_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -587,7 +594,7 @@ define([TEST_NFMPI_GET_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -604,30 +611,30 @@ define([TEST_NFMPI_GET_VARS],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge, stride)
+ err = GetVar(BAD_ID, i, value, start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, edge, stride)
+ err = GetVar(ncid, BAD_VARID, value, start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -637,10 +644,10 @@ define([TEST_NFMPI_GET_VARS],dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride)
+ err = GetVar(ncid, i, value, start, edge, stride)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -719,13 +726,13 @@ define([TEST_NFMPI_GET_VARS],dnl
allInExtRange = .false.
end if
12 continue
- err = nf90mpi_get_var_all(ncid, i, value, index, &
+ err = GetVar(ncid, i, value, index, &
count, stride)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -769,9 +776,9 @@ define([TEST_NFMPI_GET_VARS],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -781,7 +788,7 @@ dnl TEST_NFMPI_GET_VARM(TYPE)
dnl
define([TEST_NFMPI_GET_VARM],dnl
[dnl
- subroutine test_nf90mpi_get_varm_$1()
+ subroutine TestFunc(varm_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -819,10 +826,9 @@ define([TEST_NFMPI_GET_VARM],dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -834,17 +840,17 @@ define([TEST_NFMPI_GET_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge, &
+ err = GetVar(BAD_ID, i, value, start, edge, &
stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, &
+ err = GetVar(ncid, BAD_VARID, value, start, &
edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, &
+ err = GetVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -855,7 +861,7 @@ define([TEST_NFMPI_GET_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, &
+ err = GetVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -866,7 +872,7 @@ define([TEST_NFMPI_GET_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_get_var_all(ncid, i, value, start, &
+ err = GetVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -884,30 +890,30 @@ define([TEST_NFMPI_GET_VARM],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_get_var_all(BAD_ID, i, value, start, edge, stride, imap)
+ err = GetVar(BAD_ID, i, value, start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_var_all(ncid, BAD_VARID, value, start, edge, stride, imap)
+ err = GetVar(ncid, BAD_VARID, value, start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride, imap)
+ err = GetVar(ncid, i, value, start, edge, stride, imap)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride, imap)
+ err = GetVar(ncid, i, value, start, edge, stride, imap)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -917,10 +923,10 @@ define([TEST_NFMPI_GET_VARM],dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_get_var_all(ncid, i, value, start, edge, stride, imap)
+ err = GetVar(ncid, i, value, start, edge, stride, imap)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1006,13 +1012,13 @@ define([TEST_NFMPI_GET_VARM],dnl
allInExtRange = .false.
end if
13 continue
- err = nf90mpi_get_var_all(ncid,i,value,index,count, &
+ err = GetVar(ncid,i,value,index,count, &
stride,imap)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -1056,9 +1062,9 @@ define([TEST_NFMPI_GET_VARM],dnl
10 continue
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -1068,7 +1074,7 @@ dnl TEST_NFMPI_GET_ATT(TYPE)
dnl
define([TEST_NFMPI_GET_ATT],dnl
[dnl
- subroutine test_nf90mpi_get_att_$1()
+ subroutine TestFunc(att_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -1093,22 +1099,21 @@ define([TEST_NFMPI_GET_ATT],dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 0, numVars
do 2, j = 1, NATTS(i)
canConvert = (ATT_TYPE(j,i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nf90mpi_get_att(BAD_ID, i, ATT_NAME(j,i), value)
+ err = GetAtt(BAD_ID, i, ATT_NAME(j,i), value)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_get_att(ncid, BAD_VARID, ATT_NAME(j,i), value)
+ err = GetAtt(ncid, BAD_VARID, ATT_NAME(j,i), value)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
- err = nf90mpi_get_att(ncid, i, 'noSuch', value)
+ err = GetAtt(ncid, i, 'noSuch', value)
if (err .ne. NF90_ENOTATT) &
call errore('Bad attribute name: ', err)
allInIntRange = .true.
@@ -1126,12 +1131,12 @@ define([TEST_NFMPI_GET_ATT],dnl
allInExtRange = .false.
end if
3 continue
- err = nf90mpi_get_att(ncid, i, ATT_NAME(j,i), value)
+ err = GetAtt(ncid, i, ATT_NAME(j,i), value)
if (canConvert .or. ATT_LEN(j,i) .eq. 0) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_get_att ', &
+ call errore('GetAtt ', &
err)
else
if (err .ne. NF90_ERANGE) &
@@ -1174,9 +1179,9 @@ define([TEST_NFMPI_GET_ATT],dnl
2 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
diff --git a/test/nf90_test/test_iget.m4 b/test/nf90_test/test_iget.m4
index d73f9d1..3c3d6d8 100644
--- a/test/nf90_test/test_iget.m4
+++ b/test/nf90_test/test_iget.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_iget.m4 2619 2016-11-14 22:50:46Z wkliao $
+! $Id: test_iget.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
@@ -19,6 +19,13 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,])
+define([TestFunc],[ifdef([PNETCDF],[test_nf90mpi_iget_$1],[test_nf90_iget_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nf90mpi_$1],[nf90_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nf90mpi_strerror($1)],[nf90_strerror($1)])])dnl
+define([FileOpen],[ifdef([PNETCDF],[nf90mpi_open(comm,$1,$2,info,ncid)],[nf90_open($1,$2,ncid)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nf90mpi_close($1)],[nf90_close($1)])])dnl
+define([GetVar],[ifdef([PNETCDF],[nf90mpi_iget_var($*)],[nf90_iget_var($*)])])dnl
+
undefine([index])dnl
dnl Macros
@@ -79,7 +86,7 @@ ifelse($1, double, doubleprecision $2)[]dnl
dnl TEST_NFMPI_IGET_VAR1(TYPE)
dnl
define([TEST_NFMPI_IGET_VAR1],[dnl
- subroutine test_nf90mpi_iget_var1_$1()
+ subroutine TestFunc(var1_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -101,25 +108,24 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nf90mpi_iget_var(BAD_ID,i,value, reqid(1),index)
+ err = GetVar(BAD_ID,i,value, reqid(1),index)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid,BAD_VARID, value, reqid(1), index)
+ err = GetVar(ncid,BAD_VARID, value, reqid(1), index)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
index(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid,i,value, reqid(1),index)
+ err = GetVar(ncid,i,value, reqid(1),index)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -136,16 +142,16 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
call error('error in index2indexes 1')
expect = hash4( var_type(i), var_rank(i), index, &
NFT_ITYPE($1) )
- err = nf90mpi_iget_var(ncid,i,value, reqid(1),index)
+ err = GetVar(ncid,i,value, reqid(1),index)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (inRange3(expect,var_type(i), &
NFT_ITYPE($1))) then
if (in_internal_range(NFT_ITYPE($1), &
expect)) then
if (st(1) .ne. 0) then
- call errore('nf90mpi_iget_var: ',st(1))
+ call errore('GetVar: ',st(1))
else
val = ARITH_VAR1($1, value)
if (.not. equal(val, expect, &
@@ -170,9 +176,9 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
end if
4 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('FileClose: ', err)
call print_nok(nok)
end
])
@@ -180,7 +186,7 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
dnl TEST_NFMPI_IGET_VAR(TYPE)
dnl
define([TEST_NFMPI_IGET_VAR],[dnl
- subroutine test_nf90mpi_iget_var_$1()
+ subroutine TestFunc(var_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -205,17 +211,16 @@ define([TEST_NFMPI_IGET_VAR],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1))
+ err = GetVar(BAD_ID, i, value,reqid(1))
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1))
+ err = GetVar(ncid, BAD_VARID, value,reqid(1))
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
nels = 1
@@ -238,14 +243,14 @@ define([TEST_NFMPI_IGET_VAR],[dnl
allInExtRange = .false.
end if
4 continue
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), count=var_shape(:,i))
+ err = GetVar(ncid, i, value,reqid(1), count=var_shape(:,i))
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0) &
- call errore('nf90mpi_iget_var: ', st(1))
+ call errore('GetVar: ', st(1))
else
if (st(1) .ne. NF90_ERANGE) &
call errore('Range error: ', st(1))
@@ -274,9 +279,9 @@ define([TEST_NFMPI_IGET_VAR],[dnl
call errore('wrong type: ', err)
end if
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('FileClose: ', err)
call print_nok(nok)
end
])
@@ -285,7 +290,7 @@ define([TEST_NFMPI_IGET_VAR],[dnl
dnl TEST_NFMPI_IGET_VARA(TYPE)
dnl
define([TEST_NFMPI_IGET_VARA],[dnl
- subroutine test_nf90mpi_iget_vara_$1()
+ subroutine TestFunc(vara_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -317,9 +322,9 @@ define([TEST_NFMPI_IGET_VARA],[dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -329,15 +334,15 @@ define([TEST_NFMPI_IGET_VARA],[dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -347,7 +352,7 @@ define([TEST_NFMPI_IGET_VARA],[dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -364,30 +369,30 @@ define([TEST_NFMPI_IGET_VARA],[dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -397,10 +402,10 @@ define([TEST_NFMPI_IGET_VARA],[dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -450,14 +455,14 @@ define([TEST_NFMPI_IGET_VARA],[dnl
allInExtRange = .false.
end if
10 continue
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge)
+ err = GetVar(ncid, i, value,reqid(1), start, edge)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0) &
- call errore('nf90mpi_iget_var:',st(1))
+ call errore('GetVar:',st(1))
else
if (st(1) .ne. NF90_ERANGE) &
call errore('Range error: ', st(1))
@@ -496,9 +501,9 @@ define([TEST_NFMPI_IGET_VARA],[dnl
end if
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errorc('nf90mpi_close: ', nf90mpi_strerror(err))
+ call errorc('FileClose: ', ErrFunc(err))
call print_nok(nok)
end
])dnl
@@ -508,7 +513,7 @@ dnl TEST_NFMPI_IGET_VARS(TYPE)
dnl
define([TEST_NFMPI_IGET_VARS],dnl
[dnl
- subroutine test_nf90mpi_iget_vars_$1()
+ subroutine TestFunc(vars_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -546,9 +551,9 @@ define([TEST_NFMPI_IGET_VARS],dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -559,15 +564,15 @@ define([TEST_NFMPI_IGET_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge, stride)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -577,7 +582,7 @@ define([TEST_NFMPI_IGET_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -587,7 +592,7 @@ define([TEST_NFMPI_IGET_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -604,30 +609,30 @@ define([TEST_NFMPI_IGET_VARS],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge, stride)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -637,10 +642,10 @@ define([TEST_NFMPI_IGET_VARS],dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -720,14 +725,14 @@ define([TEST_NFMPI_IGET_VARS],dnl
allInExtRange = .false.
end if
12 continue
- err = nf90mpi_iget_var(ncid, i,value,reqid(1), index, count,stride)
+ err = GetVar(ncid, i,value,reqid(1), index, count,stride)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (st(1) .ne. NF90_ERANGE) &
call errore('Range error: ', st(1))
@@ -766,9 +771,9 @@ define([TEST_NFMPI_IGET_VARS],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('FileClose: ', err)
call print_nok(nok)
end
])dnl
@@ -778,7 +783,7 @@ dnl TEST_NFMPI_IGET_VARM(TYPE)
dnl
define([TEST_NFMPI_IGET_VARM],dnl
[dnl
- subroutine test_nf90mpi_iget_varm_$1()
+ subroutine TestFunc(varm_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -817,10 +822,9 @@ define([TEST_NFMPI_IGET_VARM],dnl
nok = 0
- err = nf90mpi_open(comm, testfile, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(testfile, NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -832,15 +836,15 @@ define([TEST_NFMPI_IGET_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -850,7 +854,7 @@ define([TEST_NFMPI_IGET_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -860,7 +864,7 @@ define([TEST_NFMPI_IGET_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_iget_var(ncid, i, value, reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value, reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -877,30 +881,30 @@ define([TEST_NFMPI_IGET_VARM],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iget_var(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iget_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.NOT. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -910,10 +914,10 @@ define([TEST_NFMPI_IGET_VARM],dnl
endif
start(j) = 1
5 continue
- err = nf90mpi_iget_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = GetVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1000,14 +1004,14 @@ define([TEST_NFMPI_IGET_VARM],dnl
allInExtRange = .false.
end if
13 continue
- err = nf90mpi_iget_var(ncid,i, value, reqid(1), index, count, stride, imap)
+ err = GetVar(ncid,i, value, reqid(1), index, count, stride, imap)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (st(1) .ne. NF90_ERANGE) &
call errore('Range error: ', st(1))
@@ -1046,9 +1050,9 @@ define([TEST_NFMPI_IGET_VARM],dnl
10 continue
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('FileClose: ', err)
call print_nok(nok)
end
])dnl
diff --git a/test/nf90_test/test_iput.m4 b/test/nf90_test/test_iput.m4
index fa1a8fe..9073f09 100644
--- a/test/nf90_test/test_iput.m4
+++ b/test/nf90_test/test_iput.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_iput.m4 2619 2016-11-14 22:50:46Z wkliao $
+! $Id: test_iput.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
@@ -19,6 +19,14 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,]) dnl
+define([TestFunc],[ifdef([PNETCDF],[test_nf90mpi_iput_$1],[test_nf90_iput_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nf90mpi_$1],[nf90_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nf90mpi_strerror($1)],[nf90_strerror($1)])])dnl
+define([FileCreate],[ifdef([PNETCDF],[nf90mpi_create(comm,$1,$2,info,ncid)],[nf90_create($1,$2,ncid)])])dnl
+define([FileDelete],[ifdef([PNETCDF],[nf90mpi_delete($1,$2)],[nf90_delete($1)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nf90mpi_close($1)],[nf90_close($1)])])dnl
+define([iPutVar],[ifdef([PNETCDF],[nf90mpi_iput_var($*)], [nf90_iput_var($*)])])dnl
+
undefine([index])dnl
dnl Macros
@@ -135,7 +143,7 @@ dnl TEST_NFMPI_IPUT_VAR1(TYPE)
dnl
define([TEST_NFMPI_IPUT_VAR1],dnl
[dnl
- subroutine test_nf90mpi_iput_var1_$1()
+ subroutine TestFunc(var1_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -156,32 +164,32 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
value = MAKE_TYPE($1, 5)!/* any value would do - only for error cases */
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nf90mpi_iput_var(BAD_ID, i, value(1:1), reqid(1), index)
+ err = iPutVar(BAD_ID, i, value(1:1), reqid(1), index)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value(1:1),reqid(1), index)
+ err = iPutVar(ncid, BAD_VARID, value(1:1),reqid(1), index)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
index(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value(1:1),reqid(1), index)
+ err = iPutVar(ncid, i, value(1:1),reqid(1), index)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -197,14 +205,14 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
call error('error in index2indexes 1')
val = hash_$1(var_type(i),var_rank(i), index, NFT_ITYPE($1))
MAKE_TYPE2($1, value, val)
- err = nf90mpi_iput_var(ncid, i, value(1:1), reqid(1), index)
+ err = iPutVar(ncid, i, value(1:1), reqid(1), index)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
val = ARITH_VAR1($1, value)
if (inRange3(val, var_type(i), NFT_ITYPE($1))) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -215,13 +223,13 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
end if
4 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -233,7 +241,7 @@ dnl TEST_NFMPI_IPUT_VAR(TYPE)
dnl
define([TEST_NFMPI_IPUT_VAR],dnl
[dnl
- subroutine test_nf90mpi_iput_var_$1()
+ subroutine TestFunc(var_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -255,23 +263,23 @@ define([TEST_NFMPI_IPUT_VAR],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nf90mpi_iput_var(BAD_ID, i, value, reqid(1))
+ err = iPutVar(BAD_ID, i, value, reqid(1))
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value, reqid(1))
+ err = iPutVar(ncid, BAD_VARID, value, reqid(1))
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
nels = 1
@@ -290,15 +298,15 @@ define([TEST_NFMPI_IPUT_VAR],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
4 continue
- err = nf90mpi_iput_var(ncid, i, value, reqid(1), count=var_shape(:,i))
+ err = iPutVar(ncid, i, value, reqid(1), count=var_shape(:,i))
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid, 1, reqid, st)
+ err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
! NF90_ERANGE is not a fatal error
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE .and. &
var_dimid(var_rank(i),i) .ne. RECDIM) &
@@ -316,15 +324,15 @@ define([TEST_NFMPI_IPUT_VAR],dnl
! Write record number NRECS to force writing of preceding records.
! Assumes variable cr is char vector with UNLIMITED dimension.
- err = nf90mpi_inq_varid(ncid, "cr", vid)
+ err = APIFunc(inq_varid)(ncid, "cr", vid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_inq_varid: ', err)
+ call errore('APIFunc(inq_varid): ', err)
index(1) = NRECS
- err = nf90mpi_iput_var(ncid, vid, 'x',reqid(1), index)
+ err = iPutVar(ncid, vid, 'x',reqid(1), index)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_iput_var: ', err)
+ call errore('iPutVar: ', err)
else
- err_w = nf90mpi_wait_all(ncid, 1, reqid, st)
+ err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
endif
do 5 i = 1, numVars
@@ -354,14 +362,14 @@ define([TEST_NFMPI_IPUT_VAR],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
7 continue
- err = nf90mpi_iput_var(ncid, i, value, reqid(1), count=var_shape(:,i))
+ err = iPutVar(ncid, i, value, reqid(1), count=var_shape(:,i))
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid, 1, reqid, st)
+ err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
! NF90_ERANGE is not a fatal error
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -372,13 +380,13 @@ define([TEST_NFMPI_IPUT_VAR],dnl
endif
endif
5 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -390,7 +398,7 @@ dnl TEST_NFMPI_IPUT_VARA(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARA],dnl
[dnl
- subroutine test_nf90mpi_iput_vara_$1()
+ subroutine TestFunc(vara_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -418,16 +426,16 @@ define([TEST_NFMPI_IPUT_VARA],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -440,17 +448,16 @@ define([TEST_NFMPI_IPUT_VARA],dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, &
- value,reqid(1), start, edge)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -460,7 +467,7 @@ define([TEST_NFMPI_IPUT_VARA],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -475,30 +482,30 @@ define([TEST_NFMPI_IPUT_VARA],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value,reqid(1), start, edge)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -509,12 +516,12 @@ define([TEST_NFMPI_IPUT_VARA],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_iput_var(ncid, i, value, reqid(1), start, edge)
+ err = iPutVar(ncid, i, value, reqid(1), start, edge)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -558,14 +565,14 @@ define([TEST_NFMPI_IPUT_VARA],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
10 continue
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
! NF90_ERANGE is not a fatal error
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -577,13 +584,13 @@ define([TEST_NFMPI_IPUT_VARA],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -595,7 +602,7 @@ dnl TEST_NFMPI_IPUT_VARS(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARS],dnl
[dnl
- subroutine test_nf90mpi_iput_vars_$1()
+ subroutine TestFunc(vars_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -629,16 +636,16 @@ define([TEST_NFMPI_IPUT_VARS],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -652,16 +659,16 @@ define([TEST_NFMPI_IPUT_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -671,7 +678,7 @@ define([TEST_NFMPI_IPUT_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -681,7 +688,7 @@ define([TEST_NFMPI_IPUT_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -696,30 +703,30 @@ define([TEST_NFMPI_IPUT_VARS],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -730,12 +737,12 @@ define([TEST_NFMPI_IPUT_VARS],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_iput_var(ncid, i, value, reqid(1), start, edge, stride)
+ err = iPutVar(ncid, i, value, reqid(1), start, edge, stride)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -808,13 +815,13 @@ define([TEST_NFMPI_IPUT_VARS],dnl
inRange3(val, var_type(i), &
NFT_ITYPE($1))
12 continue
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), index, count, stride)
+ err = iPutVar(ncid, i, value,reqid(1), index, count, stride)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -827,13 +834,13 @@ define([TEST_NFMPI_IPUT_VARS],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
@@ -847,7 +854,7 @@ dnl TEST_NFMPI_IPUT_VARM(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARM],dnl
[dnl
- subroutine test_nf90mpi_iput_varm_$1()
+ subroutine TestFunc(varm_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -882,16 +889,16 @@ define([TEST_NFMPI_IPUT_VARM],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -906,16 +913,16 @@ define([TEST_NFMPI_IPUT_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -925,7 +932,7 @@ define([TEST_NFMPI_IPUT_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -935,7 +942,7 @@ define([TEST_NFMPI_IPUT_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -950,30 +957,30 @@ define([TEST_NFMPI_IPUT_VARM],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_iput_var(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(BAD_ID, i, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_iput_var(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, BAD_VARID, value,reqid(1), start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_iput_var(ncid, i, value,reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value,reqid(1), start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('conversion: ', err)
@@ -984,12 +991,12 @@ define([TEST_NFMPI_IPUT_VARM],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_iput_var(ncid, i, value, reqid(1), start, edge, stride, imap)
+ err = iPutVar(ncid, i, value, reqid(1), start, edge, stride, imap)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1069,14 +1076,13 @@ define([TEST_NFMPI_IPUT_VARM],dnl
inRange3(val, var_type(i), &
NFT_ITYPE($1))
14 continue
- err = nf90mpi_iput_var(ncid,i,&
- value,reqid(1), index, count, stride, imap)
+ err = iPutVar(ncid,i,value,reqid(1), index, count, stride, imap)
if (err .eq. NF90_NOERR .or. err .eq. NF90_ERANGE) &
- err_w = nf90mpi_wait_all(ncid,1,reqid,st)
+ err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. 0) &
- call error(nf90mpi_strerror(st(1)))
+ call error(ErrFunc(st(1)))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -1089,13 +1095,13 @@ define([TEST_NFMPI_IPUT_VARM],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
diff --git a/test/nf90_test/test_put.m4 b/test/nf90_test/test_put.m4
index 74e59bb..0074c0d 100644
--- a/test/nf90_test/test_put.m4
+++ b/test/nf90_test/test_put.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_put.m4 2619 2016-11-14 22:50:46Z wkliao $
+! $Id: test_put.m4 2688 2016-12-08 19:57:37Z wkliao $
dnl divert(-1)
@@ -19,6 +19,20 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,]) dnl
+define([TestFunc],[ifdef([PNETCDF],[test_nf90mpi_put_$1],[test_nf90_put_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nf90mpi_$1],[nf90_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nf90mpi_strerror($1)],[nf90_strerror($1)])])dnl
+
+define([FileOpen],[ifdef([PNETCDF],[nf90mpi_open(comm,$1,$2,info,ncid)],[nf90_open($1,$2,ncid)])])dnl
+define([FileCreate],[ifdef([PNETCDF],[nf90mpi_create(comm,$1,$2,info,ncid)],[nf90_create($1,$2,ncid)])])dnl
+define([FileDelete],[ifdef([PNETCDF],[nf90mpi_delete($1,$2)],[nf90_delete($1)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nf90mpi_close($1)],[nf90_close($1)])])dnl
+
+define([PutVar],[ifdef([PNETCDF],[nf90mpi_put_var_all($*)], [nf90_put_var($*)])])dnl
+define([PutAtt],[ifdef([PNETCDF],[nf90mpi_put_att($*)],[nf90_put_att($*)])])dnl
+define([GetAtt],[ifdef([PNETCDF],[nf90mpi_get_att($*)],[nf90_get_att($*)])])dnl
+define([GetVar],[ifdef([PNETCDF],[nf90mpi_get_var_all($*)],[nf90_get_var($*)])])dnl
+
undefine([index])dnl
dnl Macros
@@ -216,19 +230,17 @@ define([CHECK_VARS],dnl
nok = 0
- err = nf90mpi_open(comm, filename, NF90_NOWRITE, info, &
- ncid)
+ err = FileOpen(filename,NF90_NOWRITE)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_open: ', err)
- err = nf90mpi_begin_indep_data(ncid)
+ call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
if (canConvert) then
- err = nf90mpi_inquire_variable(ncid, i, name, datatype, ndims, &
+ err = APIFunc(inquire_variable)(ncid, i, name, datatype, ndims, &
dimids, ngatts)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_inquire_variable: ', err)
+ call errore('APIFunc(inquire_variable): ', err)
if (name .ne. var_name(i)) &
call error('Unexpected var_name')
if (datatype .ne. var_type(i)) &
@@ -236,10 +248,10 @@ define([CHECK_VARS],dnl
if (ndims .ne. var_rank(i)) &
call error('Unexpected rank')
do 2, j = 1, ndims
- err = nf90mpi_inquire_dimension(ncid, dimids(j), name, &
+ err = APIFunc(inquire_dimension)(ncid, dimids(j), name, &
length)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_inquire_dimension: ', err)
+ call errore('APIFunc(inquire_dimension): ', err)
if (length .ne. var_shape(j,i)) &
call error('Unexpected shape')
2 continue
@@ -250,12 +262,12 @@ define([CHECK_VARS],dnl
call error('error in index2indexes()')
expect = hash4( var_type(i), var_rank(i), index, &
NFT_ITYPE($1))
- err = nf90mpi_get_var(ncid, i, value, index)
+ err = GetVar(ncid, i, value, index)
if (inRange3(expect,datatype,NFT_ITYPE($1))) then
if (in_internal_range(NFT_ITYPE($1), expect)) then
if (err .ne. NF90_NOERR) then
call errore &
- ('nf90mpi_get_var: ', err)
+ ('GetVar: ', err)
else
val = MAKE_ARITH_VAR1($1,value)
if (.not.equal( &
@@ -286,10 +298,9 @@ define([CHECK_VARS],dnl
3 continue
end if
1 continue
- err = nf90mpi_end_indep_data(ncid)
- err = nf90mpi_close (ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -335,14 +346,14 @@ define([CHECK_ATTS],dnl
canConvert = (ATT_TYPE(j,i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
if (canConvert) then
- err = nf90mpi_inquire_attribute(ncid, i, ATT_NAME(j,i), &
+ err = APIFunc(inquire_attribute)(ncid, i, ATT_NAME(j,i), &
datatype, length)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_inquire_attribute: ', err)
+ call errore('APIFunc(inquire_attribute): ', err)
if (datatype .ne. ATT_TYPE(j,i)) &
- call error('nf90mpi_inquire_attribute: unexpected type')
+ call error('APIFunc(inquire_attribute): unexpected type')
if (length .ne. ATT_LEN(j,i)) &
- call error('nf90mpi_inquire_attribute: unexpected length')
+ call error('APIFunc(inquire_attribute): unexpected length')
if (.not.(length .le. MAX_NELS)) &
stop 'assert(length .le. MAX_NELS)'
nInIntRange = 0
@@ -359,11 +370,11 @@ define([CHECK_ATTS],dnl
nInIntRange = nInIntRange + 1
end if
4 continue
- err = nf90mpi_get_att(ncid, i, ATT_NAME(j,i), value)
+ err = GetAtt(ncid, i, ATT_NAME(j,i), value)
if (nInExtRange .eq. length .and. &
nInIntRange .eq. length) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_NOERR .and. err .ne. NF90_ERANGE) &
call errore('OK or Range error: ', err)
@@ -407,7 +418,7 @@ dnl TEST_NFMPI_PUT_VAR1(TYPE)
dnl
define([TEST_NFMPI_PUT_VAR1],dnl
[dnl
- subroutine test_nf90mpi_put_var1_$1()
+ subroutine TestFunc(var1_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -427,33 +438,32 @@ define([TEST_NFMPI_PUT_VAR1],dnl
value = MAKE_TYPE($1, 5)!/* any value would do - only for error cases */
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
- err = nf90mpi_begin_indep_data(ncid)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nf90mpi_put_var(BAD_ID, i, value(1:1), index)
+ err = PutVar(BAD_ID, i, value(1:1), index)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var(ncid, BAD_VARID, value(1:1), index)
+ err = PutVar(ncid, BAD_VARID, value(1:1), index)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
index(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var(ncid, i, value(1:1), index)
+ err = PutVar(ncid, i, value(1:1), index)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -470,12 +480,12 @@ define([TEST_NFMPI_PUT_VAR1],dnl
val = hash_$1(var_type(i),var_rank(i), &
index, NFT_ITYPE($1))
MAKE_TYPE2($1, value, val)
- err = nf90mpi_put_var(ncid, i, value(1:1), index)
+ err = PutVar(ncid, i, value(1:1), index)
if (canConvert) then
val = ARITH_VAR1($1, value)
if (inRange3(val, var_type(i), NFT_ITYPE($1))) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_put_var: ', err)
+ call errore('PutVar: ', err)
else
if (err .ne. NF90_ERANGE) &
call errore('Range error: ', err)
@@ -486,14 +496,13 @@ define([TEST_NFMPI_PUT_VAR1],dnl
end if
4 continue
1 continue
- err = nf90mpi_end_indep_data(ncid)
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -505,7 +514,7 @@ dnl TEST_NFMPI_PUT_VAR(TYPE)
dnl
define([TEST_NFMPI_PUT_VAR],dnl
[dnl
- subroutine test_nf90mpi_put_var_$1()
+ subroutine TestFunc(var_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -526,25 +535,23 @@ define([TEST_NFMPI_PUT_VAR],dnl
doubleprecision val
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
- err = nf90mpi_begin_indep_data(ncid)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
(NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nf90mpi_put_var(BAD_ID, i, value)
+ err = PutVar(BAD_ID, i, value)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var(ncid, BAD_VARID, value)
+ err = PutVar(ncid, BAD_VARID, value)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
nels = 1
@@ -563,11 +570,11 @@ define([TEST_NFMPI_PUT_VAR],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
4 continue
- err = nf90mpi_put_var(ncid, i, VALUE3($1, value), count=var_shape(:,i))
+ err = PutVar(ncid, i, VALUE3($1, value), count=var_shape(:,i))
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_put_var: ', err)
+ call errore('PutVar: ', err)
else
if (err .ne. NF90_ERANGE .and. &
var_dimid(var_rank(i),i) .ne. RECDIM) &
@@ -578,7 +585,6 @@ define([TEST_NFMPI_PUT_VAR],dnl
call errore('wrong type: ', err)
endif
1 continue
- err = nf90mpi_end_indep_data(ncid)
! The preceeding has written nothing for record variables, now try
! again with more than 0 records.
@@ -586,14 +592,13 @@ define([TEST_NFMPI_PUT_VAR],dnl
! Write record number NRECS to force writing of preceding records.
! Assumes variable cr is char vector with UNLIMITED dimension.
- err = nf90mpi_inq_varid(ncid, "cr", vid)
+ err = APIFunc(inq_varid)(ncid, "cr", vid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_inq_varid: ', err)
+ call errore('APIFunc(inq_varid): ', err)
index(1) = NRECS
- err = nf90mpi_begin_indep_data(ncid)
- err = nf90mpi_put_var(ncid, vid, 'x', index)
+ err = PutVar(ncid, vid, 'x', index)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_put_var: ', err)
+ call errore('PutVar: ', err)
do 5 i = 1, numVars
! Only test record variables here
@@ -622,11 +627,11 @@ define([TEST_NFMPI_PUT_VAR],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
7 continue
- err = nf90mpi_put_var(ncid, i, value, count=var_shape(:,i))
+ err = PutVar(ncid, i, value, count=var_shape(:,i))
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_put_var: ', err)
+ call errore('PutVar: ', err)
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -637,14 +642,13 @@ define([TEST_NFMPI_PUT_VAR],dnl
endif
endif
5 continue
- err = nf90mpi_end_indep_data(ncid);
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -656,7 +660,7 @@ dnl TEST_NFMPI_PUT_VARA(TYPE)
dnl
define([TEST_NFMPI_PUT_VARA],dnl
[dnl
- subroutine test_nf90mpi_put_vara_$1()
+ subroutine TestFunc(vara_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -683,17 +687,16 @@ define([TEST_NFMPI_PUT_VARA],dnl
integer ud_shift
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -706,16 +709,16 @@ define([TEST_NFMPI_PUT_VARA],dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, edge)
+ err = PutVar(BAD_ID, i, value, start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, edge)
+ err = PutVar(ncid, BAD_VARID, value, start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -725,7 +728,7 @@ define([TEST_NFMPI_PUT_VARA],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -740,30 +743,30 @@ define([TEST_NFMPI_PUT_VARA],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, edge)
+ err = PutVar(BAD_ID, i, value, start, edge)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, edge)
+ err = PutVar(ncid, BAD_VARID, value, start, edge)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -774,10 +777,10 @@ define([TEST_NFMPI_PUT_VARA],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -821,11 +824,11 @@ define([TEST_NFMPI_PUT_VARA],dnl
allInExtRange = allInExtRange .and. &
inRange3(val, var_type(i), NFT_ITYPE($1))
10 continue
- err = nf90mpi_put_var_all(ncid, i, value, start, edge)
+ err = PutVar(ncid, i, value, start, edge)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -837,13 +840,13 @@ define([TEST_NFMPI_PUT_VARA],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed: ', &
scratch)
@@ -855,7 +858,7 @@ dnl TEST_NFMPI_PUT_VARS(TYPE)
dnl
define([TEST_NFMPI_PUT_VARS],dnl
[dnl
- subroutine test_nf90mpi_put_vars_$1()
+ subroutine TestFunc(vars_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -888,17 +891,16 @@ define([TEST_NFMPI_PUT_VARS],dnl
integer ud_shift
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -912,16 +914,16 @@ define([TEST_NFMPI_PUT_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, edge, stride)
+ err = PutVar(BAD_ID, i, value, start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, edge, stride)
+ err = PutVar(ncid, BAD_VARID, value, start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -931,7 +933,7 @@ define([TEST_NFMPI_PUT_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -941,7 +943,7 @@ define([TEST_NFMPI_PUT_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -956,30 +958,30 @@ define([TEST_NFMPI_PUT_VARS],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, edge, stride)
+ err = PutVar(BAD_ID, i, value, start, edge, stride)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, edge, stride)
+ err = PutVar(ncid, BAD_VARID, value, start, edge, stride)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -990,10 +992,10 @@ define([TEST_NFMPI_PUT_VARS],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride)
+ err = PutVar(ncid, i, value, start, edge, stride)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1066,12 +1068,12 @@ define([TEST_NFMPI_PUT_VARS],dnl
inRange3(val, var_type(i), &
NFT_ITYPE($1))
12 continue
- err = nf90mpi_put_var_all(ncid, i, value, index, &
+ err = PutVar(ncid, i, value, index, &
count, stride)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -1084,13 +1086,13 @@ define([TEST_NFMPI_PUT_VARS],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
@@ -1104,7 +1106,7 @@ dnl TEST_NFMPI_PUT_VARM(TYPE)
dnl
define([TEST_NFMPI_PUT_VARM],dnl
[dnl
- subroutine test_nf90mpi_put_varm_$1()
+ subroutine TestFunc(varm_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -1138,17 +1140,16 @@ define([TEST_NFMPI_PUT_VARM],dnl
integer ud_shift
flags = IOR(NF90_CLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nf90mpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_enddef: ', err)
+ call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF90_CHAR) .eqv. &
@@ -1163,18 +1164,18 @@ define([TEST_NFMPI_PUT_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, &
+ err = PutVar(BAD_ID, i, value, start, &
edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, &
+ err = PutVar(ncid, BAD_VARID, value, start, &
edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, &
+ err = PutVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -1185,7 +1186,7 @@ define([TEST_NFMPI_PUT_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, &
+ err = PutVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -1196,7 +1197,7 @@ define([TEST_NFMPI_PUT_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nf90mpi_put_var_all(ncid, i, value, start, &
+ err = PutVar(ncid, i, value, start, &
edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
@@ -1212,30 +1213,30 @@ define([TEST_NFMPI_PUT_VARM],dnl
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nf90mpi_put_var_all(BAD_ID, i, value, start, edge, stride, imap)
+ err = PutVar(BAD_ID, i, value, start, edge, stride, imap)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_var_all(ncid, BAD_VARID, value, start, edge, stride, imap)
+ err = PutVar(ncid, BAD_VARID, value, start, edge, stride, imap)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride, imap)
+ err = PutVar(ncid, i, value, start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
#else
if (err .ne. NF90_EINVALCOORDS) &
call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride, imap)
+ err = PutVar(ncid, i, value, start, edge, stride, imap)
if (.not. canConvert) then
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1246,10 +1247,10 @@ define([TEST_NFMPI_PUT_VARM],dnl
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nf90mpi_put_var_all(ncid, i, value, start, edge, stride, imap)
+ err = PutVar(ncid, i, value, start, edge, stride, imap)
if (canConvert) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ECHAR) &
call errore('wrong type: ', err)
@@ -1329,12 +1330,12 @@ define([TEST_NFMPI_PUT_VARM],dnl
inRange3(val, var_type(i), &
NFT_ITYPE($1))
14 continue
- err = nf90mpi_put_var_all(ncid,i,value,index,count, &
+ err = PutVar(ncid,i,value,index,count, &
stride,imap)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -1347,13 +1348,13 @@ define([TEST_NFMPI_PUT_VARM],dnl
8 continue
1 continue
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
@@ -1365,7 +1366,7 @@ dnl TEST_NFMPI_PUT_ATT(TYPE) numeric only
dnl
define([TEST_NFMPI_PUT_ATT],dnl
[dnl
- subroutine test_nf90mpi_put_att_$1()
+ subroutine TestFunc(att_$1)
use pnetcdf
implicit none
#include "tests.inc"
@@ -1386,25 +1387,26 @@ define([TEST_NFMPI_PUT_ATT],dnl
doubleprecision val
flags = IOR(NF90_NOCLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
+ value(:) = 0
+
do 1, i = 0, numVars
do 2, j = 1, NATTS(i)
if (.not.(ATT_TYPE(j,i) .eq. NF90_CHAR)) then
ATT_LEN_LL = ATT_LEN(j,i)
if (.not.((ATT_LEN_LL .le. MAX_NELS))) &
stop 'assert(ATT_LEN_LL .le. MAX_NELS)'
- err = nf90mpi_put_att(BAD_ID, i, ATT_NAME(j,i), value)
+ err = PutAtt(BAD_ID, i, ATT_NAME(j,i), value)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_att(ncid, BAD_VARID, ATT_NAME(j,i), value)
+ err = PutAtt(ncid, BAD_VARID, ATT_NAME(j,i), value)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
allInExtRange = .true.
@@ -1418,14 +1420,14 @@ define([TEST_NFMPI_PUT_ATT],dnl
inRange3(val, ATT_TYPE(j,i), &
NFT_ITYPE($1))
3 continue
- ! err = nf90mpi_put_att(ncid, i, ATT_NAME(j,i), value(1:ATT_LEN_LL))
+ ! err = PutAtt(ncid, i, ATT_NAME(j,i), value(1:ATT_LEN_LL))
! cannot use F90 API, as type casting is performed,
! as ATT_TYPE(j,i) may not be the same as value's type
err = nfmpi_put_att_$1(ncid, i, ATT_NAME(j,i), &
ATT_TYPE(j,i), ATT_LEN_LL, value)
if (allInExtRange) then
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_put_att: ', err)
+ call errore('PutAtt: ', err)
else
if (err .ne. NF90_ERANGE) &
call errore('range error: ', err)
@@ -1435,11 +1437,11 @@ define([TEST_NFMPI_PUT_ATT],dnl
1 continue
call check_atts_$1(ncid)
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
@@ -1544,7 +1546,7 @@ TEST_NFMPI_PUT_VARM(int8)
TEST_NFMPI_PUT_VARM(real)
TEST_NFMPI_PUT_VARM(double)
- subroutine test_nf90mpi_put_att_text()
+ subroutine TestFunc(att_text)
use pnetcdf
implicit none
#include "tests.inc"
@@ -1556,48 +1558,51 @@ TEST_NFMPI_PUT_VARM(double)
integer i
integer j
integer(kind=MPI_OFFSET_KIND) k
+ integer(kind=MPI_OFFSET_KIND) ndx(1)
integer err, flags
character(len=MAX_NELS) value
flags = IOR(NF90_NOCLOBBER, extra_flags)
- err = nf90mpi_create(comm, scratch, flags, info, &
- ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF90_NOERR) then
- call errore('nf90mpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
+ value(:) = CHAR(0)
+
do 1, i = 0, numVars
do 2, j = 1, NATTS(i)
if (ATT_TYPE(j,i) .eq. NF90_CHAR) then
if (.not.(ATT_LEN(j,i) .le. MAX_NELS)) &
stop 'assert(ATT_LEN(j,i) .le. MAX_NELS)'
- err = nf90mpi_put_att(BAD_ID, i, ATT_NAME(j,i), value)
+ err = PutAtt(BAD_ID, i, ATT_NAME(j,i), value)
if (err .ne. NF90_EBADID) &
call errore('bad ncid: ', err)
- err = nf90mpi_put_att(ncid, BAD_VARID, &
+ err = PutAtt(ncid, BAD_VARID, &
ATT_NAME(j,i), value)
if (err .ne. NF90_ENOTVAR) &
call errore('bad var id: ', err)
do 3, k = 1, ATT_LEN(j,i)
+ ndx(1) = k
value(k:k) = char(int(hash(ATT_TYPE(j,i), &
- -1, k)))
+ -1, ndx)))
3 continue
- err = nf90mpi_put_att(ncid, i, ATT_NAME(j,i), value(1:ATT_LEN(j,i)))
+ err = PutAtt(ncid, i, ATT_NAME(j,i), value(1:ATT_LEN(j,i)))
if (err .ne. NF90_NOERR) &
- call error(nf90mpi_strerror(err))
+ call error(ErrFunc(err))
end if
2 continue
1 continue
call check_atts_text(ncid)
- err = nf90mpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF90_NOERR) &
- call errore('nf90mpi_close: ', err)
+ call errore('APIFunc(close): ', err)
- err = nf90mpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF90_NOERR) &
call errorc('delete of scratch file failed:', &
scratch)
diff --git a/test/nf_test/Makefile.in b/test/nf_test/Makefile.in
index 98ecf73..8bd3b80 100644
--- a/test/nf_test/Makefile.in
+++ b/test/nf_test/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2614 2016-11-12 19:50:02Z wkliao $
+# $Id: Makefile.in 2650 2016-11-24 02:55:40Z wkliao $
#
# @configure_input@
@@ -17,16 +17,16 @@ LDFLAGS := $(LDFLAGS) -L../common
LIBS := $(LIBRARY) -ltestutils $(LIBS) @LCOV_LIB@
ifeq (@HAVE_F77_GNU_INT@, yes)
-M4FLAGS += -DHAVE_F77_GNU_INT
+M4FFLAGS += -DHAVE_F77_GNU_INT
endif
ifeq (@HAVE_F77_INT1@, yes)
-M4FLAGS += -DHAVE_F77_INT1
+M4FFLAGS += -DHAVE_F77_INT1
endif
ifeq (@HAVE_F77_INT2@, yes)
-M4FLAGS += -DHAVE_F77_INT2
+M4FFLAGS += -DHAVE_F77_INT2
endif
ifeq (@HAVE_F77_INT8@, yes)
-M4FLAGS += -DHAVE_F77_INT8
+M4FFLAGS += -DHAVE_F77_INT8
endif
ifeq (@RELAX_COORD_BOUND@, 1)
FPPFLAGS := $(FPPFLAGS) @FC_DEFINE at RELAX_COORD_BOUND
diff --git a/test/nf_test/test_get.m4 b/test/nf_test/test_get.m4
index 0e96a98..83d0544 100644
--- a/test/nf_test/test_get.m4
+++ b/test/nf_test/test_get.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_get.m4 2618 2016-11-14 22:47:18Z wkliao $
+! $Id: test_get.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
@@ -19,6 +19,21 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,])
+define([TestFunc],[ifdef([PNETCDF],[test_nfmpi_get_$1],[test_nf_get_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nfmpi_$1],[nf_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nfmpi_strerror($1)],[nf_strerror($1)])])dnl
+
+define([FileOpen],[ifdef([PNETCDF],[nfmpi_open(comm, $1, $2, info, ncid)],[nf_ope
+n($1, $2, ncid)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nfmpi_close($1)],[nf_close($1)])])dnl
+
+define([GetVar1],[ifdef([PNETCDF],[nfmpi_get_var1_$1_all],[nf_get_var1_$1])])dnl
+define([GetVar], [ifdef([PNETCDF],[nfmpi_get_var_$1_all], [nf_get_var_$1])])dnl
+define([GetVara],[ifdef([PNETCDF],[nfmpi_get_vara_$1_all],[nf_get_vara_$1])])dnl
+define([GetVars],[ifdef([PNETCDF],[nfmpi_get_vars_$1_all],[nf_get_vars_$1])])dnl
+define([GetVarm],[ifdef([PNETCDF],[nfmpi_get_varm_$1_all],[nf_get_varm_$1])])dnl
+define([GetAtt], [ifdef([PNETCDF],[nfmpi_get_att_$1],[nf_get_att_$1])])dnl
+
undefine([index])dnl
dnl Macros
@@ -79,7 +94,7 @@ ifelse($1, double, doubleprecision $2)[]dnl
dnl TEST_NFMPI_GET_VAR1(TYPE)
dnl
define([TEST_NFMPI_GET_VAR1],[dnl
- subroutine test_nfmpi_get_var1_$1()
+ subroutine TestFunc(var1_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -100,25 +115,25 @@ define([TEST_NFMPI_GET_VAR1],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nfmpi_get_var1_$1_all(BAD_ID, i, index, value)
+ err = GetVar1($1)(BAD_ID, i, index, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_var1_$1_all(ncid, BAD_VARID,
+ err = GetVar1($1)(ncid, BAD_VARID,
+ index, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
index(j) = var_shape(j,i) + 1
- err = nfmpi_get_var1_$1_all(ncid, i, index, value)
+ err = GetVar1($1)(ncid, i, index, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
+ call errore('conversion: ', err)
@@ -134,7 +149,7 @@ define([TEST_NFMPI_GET_VAR1],[dnl
if (err .ne. NF_NOERR)
+ call error('error in index2indexes 1')
expect = hash4(var_type(i), var_rank(i), index)
- err = nfmpi_get_var1_$1_all(ncid, i, index,
+ err = GetVar1($1)(ncid, i, index,
+ value)
if (.NOT. canConvert) then
if (err .ne. NF_ECHAR)
@@ -147,7 +162,7 @@ define([TEST_NFMPI_GET_VAR1],[dnl
+ expect)) then
if (err .ne. NF_NOERR) then
call errore(
- + 'nfmpi_get_var1_$1_all: ', err)
+ + 'GetVar1($1): ', err)
else
val = ARITH_VAR1($1, value)
if (.not. equal(val, expect, var_type(i),
@@ -170,10 +185,9 @@ define([TEST_NFMPI_GET_VAR1],[dnl
end if
4 continue
1 continue
- err = nfmpi_end_indep_data(ncid)
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -181,7 +195,7 @@ define([TEST_NFMPI_GET_VAR1],[dnl
dnl TEST_NFMPI_GET_VAR(TYPE)
dnl
define([TEST_NFMPI_GET_VAR],[dnl
- subroutine test_nfmpi_get_var_$1()
+ subroutine TestFunc(var_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -205,16 +219,16 @@ define([TEST_NFMPI_GET_VAR],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nfmpi_get_var_$1_all(BAD_ID, i, value)
+ err = GetVar($1)(BAD_ID, i, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_var_$1_all(ncid, BAD_VARID, value)
+ err = GetVar($1)(ncid, BAD_VARID, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
nels = 1
@@ -236,12 +250,12 @@ define([TEST_NFMPI_GET_VAR],[dnl
allInExtRange = .false.
end if
4 continue
- err = nfmpi_get_var_$1_all(ncid, i, value)
+ err = GetVar($1)(ncid, i, value)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF_NOERR)
- + call errore('nfmpi_get_var_$1_all: ',
+ + call errore('GetVar($1): ',
+ err)
else
if (err .ne. NF_ERANGE)
@@ -272,9 +286,9 @@ define([TEST_NFMPI_GET_VAR],[dnl
+ call errore('wrong type: ', err)
end if
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -283,7 +297,7 @@ define([TEST_NFMPI_GET_VAR],[dnl
dnl TEST_NFMPI_GET_VARA(TYPE)
dnl
define([TEST_NFMPI_GET_VARA],[dnl
- subroutine test_nfmpi_get_vara_$1()
+ subroutine TestFunc(vara_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -314,9 +328,9 @@ define([TEST_NFMPI_GET_VARA],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -326,23 +340,23 @@ define([TEST_NFMPI_GET_VARA],[dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nfmpi_get_vara_$1_all(BAD_ID, i, start,
+ err = GetVara($1)(BAD_ID, i, start,
+ edge, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_vara_$1_all(ncid, BAD_VARID, start,
+ err = GetVara($1)(ncid, BAD_VARID, start,
+ edge, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_vara_$1_all(ncid, i, start,
+ err = GetVara($1)(ncid, i, start,
+ edge, value)
if (canConvert .and. err .ne. NF_EINVALCOORDS)
+ call errore('bad index: ', err)
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_get_vara_$1_all(ncid, i, start,
+ err = GetVara($1)(ncid, i, start,
+ edge, value)
if (canConvert .and. err .ne. NF_EEDGE)
+ call errore('bad edge: ', err)
@@ -355,18 +369,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_get_vara_$1_all(BAD_ID, i,
+ err = GetVara($1)(BAD_ID, i,
+ start, edge, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_vara_$1_all(ncid, BAD_VARID,
+ err = GetVara($1)(ncid, BAD_VARID,
+ start, edge, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_vara_$1_all(ncid, i,
+ err = GetVara($1)(ncid, i,
+ start, edge, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -374,14 +388,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .NE. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .NE. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_get_vara_$1_all(ncid, i,
+ err = GetVara($1)(ncid, i,
+ start, edge, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -392,11 +406,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_get_vara_$1_all(ncid, i,
+ err = GetVara($1)(ncid, i,
+ start, edge, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -445,14 +459,14 @@ C bits of k determine whether to get lower or upper part of dim
allInExtRange = .false.
end if
10 continue
- err = nfmpi_get_vara_$1_all(ncid, i, start,
+ err = GetVara($1)(ncid, i, start,
+ edge, value)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF_NOERR)
+ call errore(
- + 'nfmpi_get_vara_$1_all:', err)
+ + 'GetVara($1):', err)
else
if (err .ne. NF_ERANGE)
+ call errore('Range error: ', err)
@@ -493,9 +507,9 @@ C bits of k determine whether to get lower or upper part of dim
end if
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errorc('nfmpi_close: ', nfmpi_strerror(err))
+ + call errorc('APIFunc(close): ', ErrFunc(err))
call print_nok(nok)
end
])dnl
@@ -505,7 +519,7 @@ dnl TEST_NFMPI_GET_VARS(TYPE)
dnl
define([TEST_NFMPI_GET_VARS],dnl
[dnl
- subroutine test_nfmpi_get_vars_$1()
+ subroutine TestFunc(vars_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -542,9 +556,9 @@ define([TEST_NFMPI_GET_VARS],dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -555,17 +569,17 @@ define([TEST_NFMPI_GET_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nfmpi_get_vars_$1_all(BAD_ID, i,
+ err = GetVars($1)(BAD_ID, i,
+ start, edge, stride, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_vars_$1_all(ncid, BAD_VARID,
+ err = GetVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -576,7 +590,7 @@ define([TEST_NFMPI_GET_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -587,7 +601,7 @@ define([TEST_NFMPI_GET_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride,value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -605,18 +619,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_get_vars_$1_all(BAD_ID, i,
+ err = GetVars($1)(BAD_ID, i,
+ start, edge, stride, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_vars_$1_all(ncid, BAD_VARID,
+ err = GetVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -624,14 +638,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .NE. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .NE. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -642,11 +656,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_get_vars_$1_all(ncid, i,
+ err = GetVars($1)(ncid, i,
+ start, edge, stride, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -726,14 +740,13 @@ C */
allInExtRange = .false.
end if
12 continue
- err = nfmpi_get_vars_$1_all(ncid, i, index,
- + count, stride,
- + value)
+ err = GetVars($1)(ncid, i, index,
+ + count, stride, value)
if (canConvert) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('Range error: ', err)
@@ -777,9 +790,9 @@ C */
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -789,7 +802,7 @@ dnl TEST_NFMPI_GET_VARM(TYPE)
dnl
define([TEST_NFMPI_GET_VARM],dnl
[dnl
- subroutine test_nfmpi_get_varm_$1()
+ subroutine TestFunc(varm_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -827,9 +840,9 @@ define([TEST_NFMPI_GET_VARM],dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -841,19 +854,19 @@ define([TEST_NFMPI_GET_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nfmpi_get_varm_$1_all(BAD_ID, i, start, edge,
+ err = GetVarm($1)(BAD_ID, i, start, edge,
+ stride, imap,
+ value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_varm_$1_all(ncid, BAD_VARID, start,
+ err = GetVarm($1)(ncid, BAD_VARID, start,
+ edge, stride,
+ imap, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_varm_$1_all(ncid, i, start,
+ err = GetVarm($1)(ncid, i, start,
+ edge, stride,
+ imap, value)
if (.not. canConvert) then
@@ -865,7 +878,7 @@ define([TEST_NFMPI_GET_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_get_varm_$1_all(ncid, i, start,
+ err = GetVarm($1)(ncid, i, start,
+ edge, stride,
+ imap, value)
if (.not. canConvert) then
@@ -877,7 +890,7 @@ define([TEST_NFMPI_GET_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_get_varm_$1_all(ncid, i, start,
+ err = GetVarm($1)(ncid, i, start,
+ edge, stride,
+ imap, value)
if (.not. canConvert) then
@@ -896,18 +909,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_get_varm_$1_all(BAD_ID, i,
+ err = GetVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_varm_$1_all(ncid, BAD_VARID,
+ err = GetVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_get_varm_$1_all(ncid, i,
+ err = GetVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -915,14 +928,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .NE. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .NE. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_get_varm_$1_all(ncid, i,
+ err = GetVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -933,11 +946,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_get_varm_$1_all(ncid, i,
+ err = GetVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1023,7 +1036,7 @@ C */
allInExtRange = .false.
end if
13 continue
- err = nfmpi_get_varm_$1_all(ncid,i,
+ err = GetVarm($1)(ncid,i,
+ index,count,stride,imap,value)
if (.NOT. canConvert) then
if (nels .gt. 0 .and. err .ne. NF_ECHAR)
@@ -1033,7 +1046,7 @@ C */
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('Range error: ', err)
@@ -1071,9 +1084,9 @@ C */
10 continue
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -1083,7 +1096,7 @@ dnl TEST_NFMPI_GET_ATT(TYPE)
dnl
define([TEST_NFMPI_GET_ATT],dnl
[dnl
- subroutine test_nfmpi_get_att_$1()
+ subroutine TestFunc(att_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -1108,27 +1121,26 @@ define([TEST_NFMPI_GET_ATT],dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 0, numVars
do 2, j = 1, NATTS(i)
canConvert = (ATT_TYPE(j,i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nfmpi_get_att_$1(BAD_ID, i,
+ err = GetAtt($1)(BAD_ID, i,
+ ATT_NAME(j,i),
+ value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_get_att_$1(ncid, BAD_VARID,
+ err = GetAtt($1)(ncid, BAD_VARID,
+ ATT_NAME(j,i),
+ value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
- err = nfmpi_get_att_$1(ncid, i,
- + 'noSuch',
- + value)
+ err = GetAtt($1)(ncid, i,
+ + 'noSuch', value)
if (err .ne. NF_ENOTATT)
+ call errore('Bad attribute name: ', err)
allInIntRange = .true.
@@ -1145,14 +1157,14 @@ define([TEST_NFMPI_GET_ATT],dnl
allInExtRange = .false.
end if
3 continue
- err = nfmpi_get_att_$1(ncid, i,
+ err = GetAtt($1)(ncid, i,
+ ATT_NAME(j,i),
+ value)
if (canConvert .or. ATT_LEN(j,i) .eq. 0) then
if (allInExtRange) then
if (allInIntRange) then
if (err .ne. NF_NOERR)
- + call errore('nfmpi_get_att_$1: ',
+ + call errore('GetAtt($1): ',
+ err)
else
if (err .ne. NF_ERANGE)
@@ -1195,9 +1207,9 @@ define([TEST_NFMPI_GET_ATT],dnl
2 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
diff --git a/test/nf_test/test_iget.m4 b/test/nf_test/test_iget.m4
index 8f96e69..77d826b 100644
--- a/test/nf_test/test_iget.m4
+++ b/test/nf_test/test_iget.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_iget.m4 2618 2016-11-14 22:47:18Z wkliao $
+! $Id: test_iget.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
@@ -19,6 +19,20 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,])
+define([TestFunc],[ifdef([PNETCDF],[test_nfmpi_iget_$1],[test_nf_iget_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nfmpi_$1],[nf_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nfmpi_strerror($1)],[nf_strerror($1)])])dnl
+
+define([FileOpen],[ifdef([PNETCDF],[nfmpi_open(comm, $1, $2, info, ncid)],[nf_ope
+n($1, $2, ncid)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nfmpi_close($1)],[nf_close($1)])])dnl
+
+define([iGetVar1],[ifdef([PNETCDF],[nfmpi_iget_var1_$1],[nf_iget_var1_$1])])dnl
+define([iGetVar], [ifdef([PNETCDF],[nfmpi_iget_var_$1], [nf_iget_var_$1])])dnl
+define([iGetVara],[ifdef([PNETCDF],[nfmpi_iget_vara_$1],[nf_iget_vara_$1])])dnl
+define([iGetVars],[ifdef([PNETCDF],[nfmpi_iget_vars_$1],[nf_iget_vars_$1])])dnl
+define([iGetVarm],[ifdef([PNETCDF],[nfmpi_iget_varm_$1],[nf_iget_varm_$1])])dnl
+
undefine([index])dnl
dnl Macros
@@ -79,7 +93,7 @@ ifelse($1, double, doubleprecision $2)[]dnl
dnl TEST_NFMPI_IGET_VAR1(TYPE)
dnl
define([TEST_NFMPI_IGET_VAR1],[dnl
- subroutine test_nfmpi_iget_var1_$1()
+ subroutine TestFunc(var1_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -101,26 +115,26 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nfmpi_iget_var1_$1(BAD_ID,i,index,value,
+ err = iGetVar1($1)(BAD_ID,i,index,value,
+ reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_var1_$1(ncid,BAD_VARID,
+ err = iGetVar1($1)(ncid,BAD_VARID,
+ index, value, reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
index(j) = var_shape(j,i) + 1
- err = nfmpi_iget_var1_$1(ncid,i,index,value,
+ err = iGetVar1($1)(ncid,i,index,value,
+ reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -137,10 +151,10 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
if (err .ne. NF_NOERR)
+ call error('error in index2indexes 1')
expect = hash4(var_type(i), var_rank(i), index)
- err = nfmpi_iget_var1_$1(ncid,i,index,value,
+ err = iGetVar1($1)(ncid,i,index,value,
+ reqid(1))
if (err .eq. NF_NOERR)
- + err_w = nfmpi_wait_all(ncid, 1, reqid, st)
+ + err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
if (.NOT. canConvert) then
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -151,7 +165,8 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
if (in_internal_range(NFT_ITYPE($1),
+ expect)) then
if (st(1) .ne. 0) then
- call errore('nfmpi_iget_var: ',st(1))
+ call errore('iGetVar1($1): ',
+ + st(1))
else
val = ARITH_VAR1($1, value)
if (.not. equal(val, expect,
@@ -172,9 +187,9 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
end if
4 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -182,7 +197,7 @@ define([TEST_NFMPI_IGET_VAR1],[dnl
dnl TEST_NFMPI_IGET_VAR(TYPE)
dnl
define([TEST_NFMPI_IGET_VAR],[dnl
- subroutine test_nfmpi_iget_var_$1()
+ subroutine TestFunc(var_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -207,16 +222,16 @@ define([TEST_NFMPI_IGET_VAR],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nfmpi_iget_var_$1(BAD_ID, i, value,reqid(1))
+ err = iGetVar($1)(BAD_ID, i, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_var_$1(ncid, BAD_VARID, value,reqid(1))
+ err = iGetVar($1)(ncid, BAD_VARID, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
nels = 1
@@ -238,9 +253,9 @@ define([TEST_NFMPI_IGET_VAR],[dnl
allInExtRange = .false.
end if
4 continue
- err = nfmpi_iget_var_$1(ncid, i, value,reqid(1))
+ err = iGetVar($1)(ncid, i, value,reqid(1))
if (err .eq. NF_NOERR)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (.NOT. canConvert) then
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -249,7 +264,7 @@ define([TEST_NFMPI_IGET_VAR],[dnl
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0)
- + call errore('nfmpi_iget_var: ', st(1))
+ + call errore('iGetVar($1): ', st(1))
else
if (st(1) .ne. NF_ERANGE)
+ call errore('Range error: ', st(1))
@@ -273,9 +288,9 @@ define([TEST_NFMPI_IGET_VAR],[dnl
endif
5 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])
@@ -284,7 +299,7 @@ define([TEST_NFMPI_IGET_VAR],[dnl
dnl TEST_NFMPI_IGET_VARA(TYPE)
dnl
define([TEST_NFMPI_IGET_VARA],[dnl
- subroutine test_nfmpi_iget_vara_$1()
+ subroutine TestFunc(vara_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -316,9 +331,9 @@ define([TEST_NFMPI_IGET_VARA],[dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -328,17 +343,17 @@ define([TEST_NFMPI_IGET_VARA],[dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nfmpi_iget_vara_$1(BAD_ID, i,
+ err = iGetVara($1)(BAD_ID, i,
+ start, edge, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_vara_$1(ncid, BAD_VARID,
+ err = iGetVara($1)(ncid, BAD_VARID,
+ start, edge, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vara_$1(ncid, i,
+ err = iGetVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -349,7 +364,7 @@ define([TEST_NFMPI_IGET_VARA],[dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vara_$1(ncid, i,
+ err = iGetVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -367,18 +382,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iget_vara_$1(BAD_ID, i,
+ err = iGetVara($1)(BAD_ID, i,
+ start, edge, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_vara_$1(ncid, BAD_VARID,
+ err = iGetVara($1)(ncid, BAD_VARID,
+ start, edge, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vara_$1(ncid, i,
+ err = iGetVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -386,14 +401,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iget_vara_$1(ncid, i,
+ err = iGetVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -404,11 +419,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_iget_vara_$1(ncid, i,
+ err = iGetVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -457,10 +472,10 @@ C bits of k determine whether to get lower or upper part of dim
allInExtRange = .false.
end if
10 continue
- err = nfmpi_iget_vara_$1(ncid, i, start,
+ err = iGetVara($1)(ncid, i, start,
+ edge, value,reqid(1))
if (err .EQ. NF_NOERR)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (.NOT. canConvert) then
if (nels .gt. 0 .and. err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -469,7 +484,7 @@ C bits of k determine whether to get lower or upper part of dim
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0) call errore(
- + 'nfmpi_iget_vara_$1:',st(1))
+ + 'iGetVara($1):',st(1))
else
if (st(1) .ne. NF_ERANGE)
+ call errore('Range error: ', st(1))
@@ -503,9 +518,9 @@ C bits of k determine whether to get lower or upper part of dim
12 continue
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errorc('nfmpi_close: ', nfmpi_strerror(err))
+ + call errorc('APIFunc(close): ', ErrFunc(err))
call print_nok(nok)
end
])dnl
@@ -515,7 +530,7 @@ dnl TEST_NFMPI_IGET_VARS(TYPE)
dnl
define([TEST_NFMPI_IGET_VARS],dnl
[dnl
- subroutine test_nfmpi_iget_vars_$1()
+ subroutine TestFunc(vars_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -553,9 +568,9 @@ define([TEST_NFMPI_IGET_VARS],dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -566,17 +581,17 @@ define([TEST_NFMPI_IGET_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nfmpi_iget_vars_$1(BAD_ID, i,
+ err = iGetVars($1)(BAD_ID, i,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_vars_$1(ncid, BAD_VARID,
+ err = iGetVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride,value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -587,7 +602,7 @@ define([TEST_NFMPI_IGET_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride,value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -598,7 +613,7 @@ define([TEST_NFMPI_IGET_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride,value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -616,18 +631,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iget_vars_$1(BAD_ID, i,
+ err = iGetVars($1)(BAD_ID, i,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_vars_$1(ncid, BAD_VARID,
+ err = iGetVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -635,14 +650,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -653,11 +668,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_iget_vars_$1(ncid, i,
+ err = iGetVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -737,10 +752,10 @@ C */
allInExtRange = .false.
end if
12 continue
- err = nfmpi_iget_vars_$1(ncid, i, index,
+ err = iGetVars($1)(ncid, i, index,
+ count,stride,value,reqid(1))
if (err .EQ. NF_NOERR)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (.NOT. canConvert) then
if (nels .gt. 0 .and. err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -749,7 +764,7 @@ C */
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (st(1) .ne. NF_ERANGE)
+ call errore('Range error: ', st(1))
@@ -786,9 +801,9 @@ C */
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -798,7 +813,7 @@ dnl TEST_NFMPI_IGET_VARM(TYPE)
dnl
define([TEST_NFMPI_IGET_VARM],dnl
[dnl
- subroutine test_nfmpi_iget_varm_$1()
+ subroutine TestFunc(varm_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -837,9 +852,9 @@ define([TEST_NFMPI_IGET_VARM],dnl
nok = 0
- err = nfmpi_open(comm, testfile, NF_NOWRITE, info, ncid)
+ err = FileOpen(testfile, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
@@ -851,17 +866,17 @@ define([TEST_NFMPI_IGET_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nfmpi_iget_varm_$1(BAD_ID, i,
+ err = iGetVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_varm_$1(ncid, BAD_VARID,
+ err = iGetVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -872,7 +887,7 @@ define([TEST_NFMPI_IGET_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -883,7 +898,7 @@ define([TEST_NFMPI_IGET_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value, reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -901,18 +916,18 @@ C /* there is nothing to get (edge(j).eq.0) */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iget_varm_$1(BAD_ID, i,
+ err = iGetVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iget_varm_$1(ncid, BAD_VARID,
+ err = iGetVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -920,14 +935,14 @@ C /* there is nothing to get (edge(j).eq.0) */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.NOT. canConvert) then
if (err .NE. NF_ECHAR)
@@ -938,11 +953,11 @@ C /* there is nothing to get (edge(j).eq.0) */
endif
start(j) = 1
5 continue
- err = nfmpi_iget_varm_$1(ncid, i,
+ err = iGetVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1029,10 +1044,10 @@ C */
allInExtRange = .false.
end if
13 continue
- err = nfmpi_iget_varm_$1(ncid,i,index,count,
+ err = iGetVarm($1)(ncid,i,index,count,
+ stride,imap, value, reqid(1))
if (err .EQ. NF_NOERR)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (.NOT. canConvert) then
if (nels .gt. 0 .and. err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1041,7 +1056,7 @@ C */
if (allInExtRange) then
if (allInIntRange) then
if (st(1) .ne. 0)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (st(1) .ne. NF_ERANGE)
+ call errore('Range error: ', st(1))
@@ -1077,9 +1092,9 @@ C */
10 continue
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
diff --git a/test/nf_test/test_iput.m4 b/test/nf_test/test_iput.m4
index bf17724..b0d424f 100644
--- a/test/nf_test/test_iput.m4
+++ b/test/nf_test/test_iput.m4
@@ -10,7 +10,7 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_iput.m4 2618 2016-11-14 22:47:18Z wkliao $
+! $Id: test_iput.m4 2646 2016-11-22 06:41:20Z wkliao $
dnl divert(-1)
@@ -19,6 +19,20 @@ dnl Process using m4 to produce FORTRAN language file.
changequote([,]) dnl
+define([TestFunc],[ifdef([PNETCDF],[test_nfmpi_iput_$1],[test_nf_iput_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nfmpi_$1],[nf_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nfmpi_strerror($1)],[nf_strerror($1)])])dnl
+
+define([FileCreate],[ifdef([PNETCDF],[nfmpi_create(comm, $1, $2, info, ncid)], [nf_create($1, $2, ncid)])])dnl
+define([FileDelete],[ifdef([PNETCDF],[nfmpi_delete($1,$2)],[nf_delete($1)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nfmpi_close($1)],[nf_close($1)])])dnl
+
+define([iPutVar1],[ifdef([PNETCDF],[nfmpi_iput_var1_$1],[nf_iput_var1_$1])])dnl
+define([iPutVar], [ifdef([PNETCDF],[nfmpi_iput_var_$1], [nf_iput_var_$1])])dnl
+define([iPutVara],[ifdef([PNETCDF],[nfmpi_iput_vara_$1],[nf_iput_vara_$1])])dnl
+define([iPutVars],[ifdef([PNETCDF],[nfmpi_iput_vars_$1],[nf_iput_vars_$1])])dnl
+define([iPutVarm],[ifdef([PNETCDF],[nfmpi_iput_varm_$1],[nf_iput_varm_$1])])dnl
+
undefine([index])dnl
dnl Macros
@@ -132,7 +146,7 @@ dnl TEST_NFMPI_IPUT_VAR1(TYPE)
dnl
define([TEST_NFMPI_IPUT_VAR1],dnl
[dnl
- subroutine test_nfmpi_iput_var1_$1()
+ subroutine TestFunc(var1_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -153,34 +167,34 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
value = MAKE_TYPE($1, 5)!/* any value would do - only for error cases */
flags = IOR(NF_NOCLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nfmpi_iput_var1_$1(BAD_ID, i, index, value,
+ err = iPutVar1($1)(BAD_ID, i, index, value,
+ reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_var1_$1(ncid, BAD_VARID,
+ err = iPutVar1($1)(ncid, BAD_VARID,
+ index, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
index(j) = var_shape(j,i) + 1
- err = nfmpi_iput_var1_$1(ncid, i,
+ err = iPutVar1($1)(ncid, i,
+ index, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -199,19 +213,18 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
val = hash_$1(var_type(i),var_rank(i),
+ index, NFT_ITYPE($1))
MAKE_TYPE2($1, value, val)
- err = nfmpi_iput_var1_$1(ncid, i,
+ err = iPutVar1($1)(ncid, i,
+ index, value, reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
val = ARITH_VAR1($1, value)
if (inRange3(val, var_type(i), NFT_ITYPE($1))) then
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ERANGE)
+ call errore('Range error: ', err)
- err = nfmpi_cancel(ncid, 1, reqid,st)
end if
else
if (err .ne. NF_ECHAR)
@@ -219,13 +232,13 @@ define([TEST_NFMPI_IPUT_VAR1],dnl
end if
4 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -237,7 +250,7 @@ dnl TEST_NFMPI_IPUT_VAR(TYPE)
dnl
define([TEST_NFMPI_IPUT_VAR],dnl
[dnl
- subroutine test_nfmpi_iput_var_$1()
+ subroutine TestFunc(var_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -259,23 +272,23 @@ define([TEST_NFMPI_IPUT_VAR],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nfmpi_iput_var_$1(BAD_ID, i, value,reqid(1))
+ err = iPutVar($1)(BAD_ID, i, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_var_$1(ncid, BAD_VARID, value,
+ err = iPutVar($1)(ncid, BAD_VARID, value,
+ reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
@@ -296,15 +309,15 @@ define([TEST_NFMPI_IPUT_VAR],dnl
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
4 continue
- err = nfmpi_iput_var_$1(ncid, i, value,reqid(1))
+ err = iPutVar($1)(ncid, i, value,reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid, 1, reqid, st)
+ + err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
! NF_ERANGE is not a fatal error
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE .and.
+ var_dimid(var_rank(i),i) .ne. RECDIM)
@@ -322,15 +335,15 @@ C again with more than 0 records.
C Write record number NRECS to force writing of preceding records.
C Assumes variable cr is char vector with UNLIMITED dimension.
- err = nfmpi_inq_varid(ncid, "cr", vid)
+ err = APIFunc(inq_varid)(ncid, "cr", vid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_inq_varid: ', err)
+ + call errore('APIFunc(inq_varid): ', err)
index(1) = NRECS
- err = nfmpi_iput_var1_text(ncid, vid, index, 'x',reqid(1))
+ err = iPutVar1(text)(ncid, vid, index, 'x',reqid(1))
if (err .ne. NF_NOERR) then
- call errore('nfmpi_iput_var1_text: ', err)
+ call errore('iPutVar1(text): ', err)
else
- err_w = nfmpi_wait_all(ncid, 1, reqid, st)
+ err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
endif
do 5 i = 1, numVars
@@ -361,14 +374,14 @@ C Only test record variables here
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
7 continue
- err = nfmpi_iput_var_$1(ncid, i, value,reqid(1))
+ err = iPutVar($1)(ncid, i, value,reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid, 1, reqid, st)
+ + err_w = APIFunc(wait_all)(ncid, 1, reqid, st)
! NF_ERANGE is not a fatal error?
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -379,13 +392,13 @@ C Only test record variables here
endif
endif
5 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -397,7 +410,7 @@ dnl TEST_NFMPI_IPUT_VARA(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARA],dnl
[dnl
- subroutine test_nfmpi_iput_vara_$1()
+ subroutine TestFunc(vara_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -425,16 +438,16 @@ define([TEST_NFMPI_IPUT_VARA],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -447,18 +460,18 @@ define([TEST_NFMPI_IPUT_VARA],dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nfmpi_iput_vara_$1(BAD_ID, i,
+ err = iPutVara($1)(BAD_ID, i,
+ start, edge, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_vara_$1(ncid, BAD_VARID,
+ err = iPutVara($1)(ncid, BAD_VARID,
+ start, edge, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vara_$1(ncid, i,
+ err = iPutVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -469,7 +482,7 @@ define([TEST_NFMPI_IPUT_VARA],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vara_$1(ncid, i,
+ err = iPutVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -485,18 +498,18 @@ C /* Check correct error returned even when nothing to put */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iput_vara_$1(BAD_ID, i,
+ err = iPutVara($1)(BAD_ID, i,
+ start, edge, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_vara_$1(ncid, BAD_VARID,
+ err = iPutVara($1)(ncid, BAD_VARID,
+ start, edge, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vara_$1(ncid, i,
+ err = iPutVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -504,14 +517,14 @@ C /* Check correct error returned even when nothing to put */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iput_vara_$1(ncid, i,
+ err = iPutVara($1)(ncid, i,
+ start, edge, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -523,16 +536,16 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_iput_vara_$1(ncid, i,
+ err = iPutVara($1)(ncid, i,
+ start, edge, value, reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
- err = nfmpi_wait_all(ncid,1,reqid,st)
+ + call error(ErrFunc(err))
+ err = APIFunc(wait_all)(ncid,1,reqid,st)
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -576,15 +589,15 @@ C /* Check correct error returned even when nothing to put */
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
10 continue
- err = nfmpi_iput_vara_$1(ncid, i, start,
+ err = iPutVara($1)(ncid, i, start,
+ edge, value,reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
! NF_ERANGE is not a fatal error?
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -596,13 +609,13 @@ C /* Check correct error returned even when nothing to put */
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -614,7 +627,7 @@ dnl TEST_NFMPI_IPUT_VARS(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARS],dnl
[dnl
- subroutine test_nfmpi_iput_vars_$1()
+ subroutine TestFunc(vars_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -648,16 +661,16 @@ define([TEST_NFMPI_IPUT_VARS],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -671,18 +684,18 @@ define([TEST_NFMPI_IPUT_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nfmpi_iput_vars_$1(BAD_ID, i,
+ err = iPutVars($1)(BAD_ID, i,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_vars_$1(ncid, BAD_VARID,
+ err = iPutVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -693,7 +706,7 @@ define([TEST_NFMPI_IPUT_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -704,7 +717,7 @@ define([TEST_NFMPI_IPUT_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -720,18 +733,18 @@ C /* Check correct error returned even when nothing to put */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iput_vars_$1(BAD_ID, i,
+ err = iPutVars($1)(BAD_ID, i,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_vars_$1(ncid, BAD_VARID,
+ err = iPutVars($1)(ncid, BAD_VARID,
+ start, edge, stride, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -739,14 +752,14 @@ C /* Check correct error returned even when nothing to put */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -758,16 +771,16 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ start, edge, stride, value, reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
- err = nfmpi_wait_all(ncid,1,reqid,st)
+ + call error(ErrFunc(err))
+ err = APIFunc(wait_all)(ncid,1,reqid,st)
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -840,14 +853,14 @@ C*/
+ inRange3(val, var_type(i),
+ NFT_ITYPE($1))
12 continue
- err = nfmpi_iput_vars_$1(ncid, i,
+ err = iPutVars($1)(ncid, i,
+ index, count, stride, value,reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -860,13 +873,13 @@ C*/
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
@@ -880,7 +893,7 @@ dnl TEST_NFMPI_IPUT_VARM(TYPE)
dnl
define([TEST_NFMPI_IPUT_VARM],dnl
[dnl
- subroutine test_nfmpi_iput_varm_$1()
+ subroutine TestFunc(varm_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -915,16 +928,16 @@ define([TEST_NFMPI_IPUT_VARM],dnl
integer err_w, reqid(1), st(1)
flags = IOR(NF_NOCLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -939,18 +952,18 @@ define([TEST_NFMPI_IPUT_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nfmpi_iput_varm_$1(BAD_ID, i,
+ err = iPutVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_varm_$1(ncid, BAD_VARID,
+ err = iPutVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -961,7 +974,7 @@ define([TEST_NFMPI_IPUT_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -972,7 +985,7 @@ define([TEST_NFMPI_IPUT_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -988,18 +1001,18 @@ C /* Check correct error returned even when nothing to put */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_iput_varm_$1(BAD_ID, i,
+ err = iPutVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_iput_varm_$1(ncid, BAD_VARID,
+ err = iPutVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value,reqid(1))
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1007,14 +1020,14 @@ C /* Check correct error returned even when nothing to put */
else
#ifdef RELAX_COORD_BOUND
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
#else
if (err .ne. NF_EINVALCOORDS)
+ call errore('bad start: ', err)
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value,reqid(1))
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1026,16 +1039,16 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_iput_varm_$1(ncid, i,
+ err = iPutVarm($1)(ncid, i,
+ start, edge, stride, imap, value, reqid(1))
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
- err = nfmpi_wait_all(ncid,1,reqid,st)
+ + call error(ErrFunc(err))
+ err = APIFunc(wait_all)(ncid,1,reqid,st)
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1115,14 +1128,14 @@ C*/
+ inRange3(val, var_type(i),
+ NFT_ITYPE($1))
14 continue
- err = nfmpi_iput_varm_$1(ncid,i,
+ err = iPutVarm($1)(ncid,i,
+ index,count, stride,imap, value,reqid(1))
if (err .eq. NF_NOERR .or. err .eq. NF_ERANGE)
- + err_w = nfmpi_wait_all(ncid,1,reqid,st)
+ + err_w = APIFunc(wait_all)(ncid,1,reqid,st)
if (canConvert) then
if (allInExtRange) then
if (st(1) .ne. NF_NOERR)
- + call error(nfmpi_strerror(st(1)))
+ + call error(ErrFunc(st(1)))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -1135,13 +1148,13 @@ C*/
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
diff --git a/test/nf_test/test_put.m4 b/test/nf_test/test_put.m4
index 13b4307..2adc5ef 100644
--- a/test/nf_test/test_put.m4
+++ b/test/nf_test/test_put.m4
@@ -10,14 +10,32 @@ dnl
! Copyright (C) 2003, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_put.m4 2618 2016-11-14 22:47:18Z wkliao $
+! $Id: test_put.m4 2671 2016-12-03 19:07:10Z wkliao $
dnl divert(-1)
dnl This is m4 source.
dnl Process using m4 to produce FORTRAN language file.
-changequote([,]) dnl
+changequote(`[',`]') dnl
+
+define([TestFunc],[ifdef([PNETCDF],[test_nfmpi_put_$1],[test_nf_put_$1])])dnl
+define([APIFunc],[ifdef([PNETCDF],[nfmpi_$1],[nf_$1])])dnl
+define([ErrFunc],[ifdef([PNETCDF],[nfmpi_strerror($1)],[nf_strerror($1)])])dnl
+
+define([FileOpen],[ifdef([PNETCDF],[nfmpi_open(comm, $1, $2, info, ncid)],[nf_open($1, $2, ncid)])])dnl
+define([FileCreate],[ifdef([PNETCDF],[nfmpi_create(comm, $1, $2, info, ncid)], [nf_create($1, $2, ncid)])])dnl
+define([FileDelete],[ifdef([PNETCDF],[nfmpi_delete($1,$2)],[nf_delete($1)])])dnl
+define([FileClose],[ifdef([PNETCDF],[nfmpi_close($1)],[nf_close($1)])])dnl
+
+define([PutVar1],[ifdef([PNETCDF],[nfmpi_put_var1_$1_all],[nf_put_var1_$1])])dnl
+define([PutVar], [ifdef([PNETCDF],[nfmpi_put_var_$1_all], [nf_put_var_$1])])dnl
+define([PutVara],[ifdef([PNETCDF],[nfmpi_put_vara_$1_all],[nf_put_vara_$1])])dnl
+define([PutVars],[ifdef([PNETCDF],[nfmpi_put_vars_$1_all],[nf_put_vars_$1])])dnl
+define([PutVarm],[ifdef([PNETCDF],[nfmpi_put_varm_$1_all],[nf_put_varm_$1])])dnl
+define([PutAtt], [ifdef([PNETCDF],[nfmpi_put_att_$1],[nf_put_att_$1])])dnl
+define([GetAtt], [ifdef([PNETCDF],[nfmpi_get_att_$1],[nf_get_att_$1])])dnl
+define([GetVar1],[ifdef([PNETCDF],[nfmpi_get_var1_$1_all],[nf_get_var1_$1])])dnl
undefine([index])dnl
@@ -193,17 +211,17 @@ C
nok = 0
- err = nfmpi_open(comm, filename, NF_NOWRITE, info, ncid)
+ err = FileOpen(filename, NF_NOWRITE)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_open: ', err)
+ + call errore('APIFunc(open): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
if (.NOT. canConvert) go to 1
- err = nfmpi_inq_var(ncid, i, name, datatype, ndims,
+ err = APIFunc(inq_var)(ncid, i, name, datatype, ndims,
+ dimids, ngatts)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_inq_var: ', err)
+ + call errore('APIFunc(inq_var): ', err)
if (name .ne. var_name(i))
+ call error('Unexpected var_name')
if (datatype .ne. var_type(i))
@@ -211,9 +229,9 @@ C
if (ndims .ne. var_rank(i))
+ call error('Unexpected rank')
do 2, j = 1, ndims
- err = nfmpi_inq_dim(ncid, dimids(j), name, length)
+ err = APIFunc(inq_dim)(ncid, dimids(j), name, length)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_inq_dim: ', err)
+ + call errore('APIFunc(inq_dim): ', err)
if (length .ne. var_shape(j,i))
+ call error('Unexpected shape')
2 continue
@@ -223,13 +241,13 @@ C
if (err .ne. NF_NOERR)
+ call error('error in index2indexes()')
expect = hash4(var_type(i), var_rank(i), index)
- err = nfmpi_get_var1_$1_all(ncid, i, index, value)
+ err = GetVar1($1)(ncid, i, index, value)
if (.NOT. inRange3(expect,datatype,NFT_ITYPE($1)))
+ go to 3
if (in_internal_range(NFT_ITYPE($1), expect)) then
if (err .ne. NF_NOERR) then
call errore (
- + 'nfmpi_get_var1_$1_all: ', err)
+ + 'GatVar1($1): ', err)
else
val = MAKE_ARITH_VAR1($1,value)
if (.not.equal(val, expect,var_type(i),
@@ -255,9 +273,9 @@ C
end if
3 continue
1 continue
- err = nfmpi_close (ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call print_nok(nok)
end
])dnl
@@ -267,10 +285,10 @@ dnl CHECK_ATTS(TYPE) numeric only
dnl
define([CHECK_ATTS],dnl
[dnl
-C/*
-C * check all attributes in file which are (text/numeric) compatible with TYPE
-C * ignore any attributes containing values outside range of TYPE
-C */
+C
+C check all attributes in file which are (text/numeric) compatible with TYPE
+C ignore any attributes containing values outside range of TYPE
+C
subroutine check_atts_$1(ncid)
implicit none
include "pnetcdf.inc"
@@ -303,14 +321,14 @@ C */
canConvert = (ATT_TYPE(j,i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
if (canConvert) then
- err = nfmpi_inq_att(ncid, i, ATT_NAME(j,i),
+ err = APIFunc(inq_att)(ncid, i, ATT_NAME(j,i),
+ datatype, length)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_inq_att: ', err)
+ + call errore('APIFunc(inq_att): ', err)
if (datatype .ne. ATT_TYPE(j,i))
- + call error('nfmpi_inq_att: unexpected type')
+ + call error('APIFunc(inq_att): unexpected type')
if (length .ne. ATT_LEN(j,i))
- + call error('nfmpi_inq_att: unexpected length')
+ + call error('APIFunc(inq_att): unexpected length')
if (.not.(length .le. MAX_NELS))
+ stop 'assert(length .le. MAX_NELS)'
nInIntRange = 0
@@ -326,12 +344,12 @@ C */
+ nInIntRange = nInIntRange + 1
end if
4 continue
- err = nfmpi_get_att_$1(ncid, i,
+ err = GetAtt($1)(ncid, i,
+ ATT_NAME(j,i), value)
if (nInExtRange .eq. length .and.
+ nInIntRange .eq. length) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_NOERR .and. err .ne. NF_ERANGE)
+ call errore('OK or Range error: ', err)
@@ -375,7 +393,7 @@ dnl TEST_NFMPI_PUT_VAR1(TYPE)
dnl
define([TEST_NFMPI_PUT_VAR1],dnl
[dnl
- subroutine test_nfmpi_put_var1_$1()
+ subroutine TestFunc(var1_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -395,33 +413,33 @@ define([TEST_NFMPI_PUT_VAR1],dnl
value = MAKE_TYPE($1, 5)!/* any value would do - only for error cases */
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
do 2, j = 1, var_rank(i)
index(j) = 1
2 continue
- err = nfmpi_put_var1_$1_all(BAD_ID, i, index, value)
+ err = PutVar1($1)(BAD_ID, i, index, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_var1_$1_all(ncid, BAD_VARID,
+ err = PutVar1($1)(ncid, BAD_VARID,
+ index, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
index(j) = var_shape(j,i) + 1
- err = nfmpi_put_var1_$1_all(ncid, i,
+ err = PutVar1($1)(ncid, i,
+ index, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -440,12 +458,12 @@ define([TEST_NFMPI_PUT_VAR1],dnl
val = hash_$1(var_type(i),var_rank(i),
+ index, NFT_ITYPE($1))
MAKE_TYPE2($1, value, val)
- err = nfmpi_put_var1_$1_all(ncid, i, index, value)
+ err = PutVar1($1)(ncid, i, index, value)
if (canConvert) then
val = ARITH_VAR1($1, value)
if (inRange3(val, var_type(i), NFT_ITYPE($1))) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('Range error: ', err)
@@ -456,13 +474,13 @@ define([TEST_NFMPI_PUT_VAR1],dnl
end if
4 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -474,7 +492,7 @@ dnl TEST_NFMPI_PUT_VAR(TYPE)
dnl
define([TEST_NFMPI_PUT_VAR],dnl
[dnl
- subroutine test_nfmpi_put_var_$1()
+ subroutine TestFunc(var_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -495,23 +513,23 @@ define([TEST_NFMPI_PUT_VAR],dnl
doubleprecision val
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
+ (NFT_ITYPE($1) .eq. NFT_TEXT)
- err = nfmpi_put_var_$1_all(BAD_ID, i, value)
+ err = PutVar($1)(BAD_ID, i, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_var_$1_all(ncid, BAD_VARID, value)
+ err = PutVar($1)(ncid, BAD_VARID, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
nels = 1
@@ -531,11 +549,11 @@ define([TEST_NFMPI_PUT_VAR],dnl
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
4 continue
- err = nfmpi_put_var_$1_all(ncid, i, value)
+ err = PutVar($1)(ncid, i, value)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE .and.
+ var_dimid(var_rank(i),i) .ne. RECDIM)
@@ -553,13 +571,13 @@ C again with more than 0 records.
C Write record number NRECS to force writing of preceding records.
C Assumes variable cr is char vector with UNLIMITED dimension.
- err = nfmpi_inq_varid(ncid, "cr", vid)
+ err = APIFunc(inq_varid)(ncid, "cr", vid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_inq_varid: ', err)
+ + call errore('APIFunc(inq_varid): ', err)
index(1) = NRECS
- err = nfmpi_put_var1_text_all(ncid, vid, index, 'x')
+ err = PutVar1(text)(ncid, vid, index, 'x')
if (err .ne. NF_NOERR)
- + call errore('nfmpi_put_var1_text_all: ', err)
+ + call errore('PutVar1(text): ', err)
do 5 i = 1, numVars
C Only test record variables here
@@ -571,7 +589,7 @@ C Only test record variables here
+ stop 'var_rank(i) .gt. MAX_RANK'
if (var_nels(i) .gt. MAX_NELS)
+ stop 'var_nels(i) .gt. MAX_NELS'
- err = nfmpi_put_var_$1_all(BAD_ID, i, value)
+ err = PutVar($1)(BAD_ID, i, value)
nels = 1
do 6 j = 1, var_rank(i)
@@ -590,11 +608,11 @@ C Only test record variables here
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
7 continue
- err = nfmpi_put_var_$1_all(ncid, i, value)
+ err = PutVar($1)(ncid, i, value)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -605,13 +623,13 @@ C Only test record variables here
endif
endif
5 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -623,7 +641,7 @@ dnl TEST_NFMPI_PUT_VARA(TYPE)
dnl
define([TEST_NFMPI_PUT_VARA],dnl
[dnl
- subroutine test_nfmpi_put_vara_$1()
+ subroutine TestFunc(vara_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -650,16 +668,16 @@ define([TEST_NFMPI_PUT_VARA],dnl
integer ud_shift
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -672,18 +690,18 @@ define([TEST_NFMPI_PUT_VARA],dnl
start(j) = 1
edge(j) = 1
2 continue
- err = nfmpi_put_vara_$1_all(BAD_ID, i, start,
+ err = PutVara($1)(BAD_ID, i, start,
+ edge, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_vara_$1_all(ncid, BAD_VARID,
+ err = PutVara($1)(ncid, BAD_VARID,
+ start, edge, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_vara_$1_all(ncid, i, start,
+ err = PutVara($1)(ncid, i, start,
+ edge, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -694,7 +712,7 @@ define([TEST_NFMPI_PUT_VARA],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_put_vara_$1_all(ncid, i, start,
+ err = PutVara($1)(ncid, i, start,
+ edge, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -710,18 +728,18 @@ C /* Check correct error returned even when nothing to put */
do 4, j = 1, var_rank(i)
edge(j) = 0
4 continue
- err = nfmpi_put_vara_$1_all(BAD_ID, i,
+ err = PutVara($1)(BAD_ID, i,
+ start, edge, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_vara_$1_all(ncid, BAD_VARID,
+ err = PutVara($1)(ncid, BAD_VARID,
+ start, edge, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_vara_$1_all(ncid, i,
+ err = PutVara($1)(ncid, i,
+ start, edge, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -736,7 +754,7 @@ C /* Check correct error returned even when nothing to put */
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_put_vara_$1_all(ncid, i,
+ err = PutVara($1)(ncid, i,
+ start, edge, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -748,11 +766,11 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_put_vara_$1_all(ncid, i,
+ err = PutVara($1)(ncid, i,
+ start, edge, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -796,12 +814,12 @@ C /* Check correct error returned even when nothing to put */
allInExtRange = allInExtRange .and.
+ inRange3(val, var_type(i), NFT_ITYPE($1))
10 continue
- err = nfmpi_put_vara_$1_all(ncid, i, start,
+ err = PutVara($1)(ncid, i, start,
+ edge, value)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -813,13 +831,13 @@ C /* Check correct error returned even when nothing to put */
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed: ',
+ scratch)
@@ -831,7 +849,7 @@ dnl TEST_NFMPI_PUT_VARS(TYPE)
dnl
define([TEST_NFMPI_PUT_VARS],dnl
[dnl
- subroutine test_nfmpi_put_vars_$1()
+ subroutine TestFunc(vars_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -864,16 +882,16 @@ define([TEST_NFMPI_PUT_VARS],dnl
integer ud_shift
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -887,11 +905,11 @@ define([TEST_NFMPI_PUT_VARS],dnl
edge(j) = 1
stride(j) = 1
2 continue
- err = nfmpi_put_vars_$1_all(BAD_ID, i, start,
+ err = PutVars($1)(BAD_ID, i, start,
+ edge, stride, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_vars_$1_all(ncid, BAD_VARID, start,
+ err = PutVars($1)(ncid, BAD_VARID, start,
+ edge, stride,
+ value)
if (err .ne. NF_ENOTVAR)
@@ -899,7 +917,7 @@ define([TEST_NFMPI_PUT_VARS],dnl
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_vars_$1_all(ncid, i, start,
+ err = PutVars($1)(ncid, i, start,
+ edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -910,7 +928,7 @@ define([TEST_NFMPI_PUT_VARS],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_put_vars_$1_all(ncid, i, start,
+ err = PutVars($1)(ncid, i, start,
+ edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -921,7 +939,7 @@ define([TEST_NFMPI_PUT_VARS],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_put_vars_$1_all(ncid, i, start,
+ err = PutVars($1)(ncid, i, start,
+ edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -939,7 +957,7 @@ C /* Check correct error returned even when nothing to put */
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_vars_$1_all(ncid, i,
+ err = PutVars($1)(ncid, i,
+ start, edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -954,7 +972,7 @@ C /* Check correct error returned even when nothing to put */
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_put_vars_$1_all(ncid, i,
+ err = PutVars($1)(ncid, i,
+ start, edge, stride, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -966,11 +984,11 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_put_vars_$1_all(ncid, i,
+ err = PutVars($1)(ncid, i,
+ start, edge, stride, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1043,13 +1061,13 @@ C*/
+ inRange3(val, var_type(i),
+ NFT_ITYPE($1))
12 continue
- err = nfmpi_put_vars_$1_all(ncid, i, index,
+ err = PutVars($1)(ncid, i, index,
+ count, stride,
+ value)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -1062,13 +1080,13 @@ C*/
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
@@ -1082,7 +1100,7 @@ dnl TEST_NFMPI_PUT_VARM(TYPE)
dnl
define([TEST_NFMPI_PUT_VARM],dnl
[dnl
- subroutine test_nfmpi_put_varm_$1()
+ subroutine TestFunc(varm_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -1116,16 +1134,16 @@ define([TEST_NFMPI_PUT_VARM],dnl
integer ud_shift
flags = IOR(NF_CLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
call def_vars(ncid)
- err = nfmpi_enddef(ncid)
+ err = APIFunc(enddef)(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_enddef: ', err)
+ + call errore('APIFunc(enddef): ', err)
do 1, i = 1, numVars
canConvert = (var_type(i) .eq. NF_CHAR) .eqv.
@@ -1140,18 +1158,18 @@ define([TEST_NFMPI_PUT_VARM],dnl
stride(j) = 1
imap(j) = 1
2 continue
- err = nfmpi_put_varm_$1_all(BAD_ID, i,
+ err = PutVarm($1)(BAD_ID, i,
+ start, edge, stride, imap, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_varm_$1_all(ncid, BAD_VARID,
+ err = PutVarm($1)(ncid, BAD_VARID,
+ start, edge, stride, imap, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 3 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1162,7 +1180,7 @@ define([TEST_NFMPI_PUT_VARM],dnl
endif
start(j) = 1
edge(j) = var_shape(j,i) + 1
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1173,7 +1191,7 @@ define([TEST_NFMPI_PUT_VARM],dnl
endif
edge(j) = 1
stride(j) = 0
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1191,7 +1209,7 @@ C /* Check correct error returned even when nothing to put */
do 5, j = 1, var_rank(i)
if (var_dimid(j,i) .EQ. RECDIM) goto 5 ! skip record dim
start(j) = var_shape(j,i) + 1
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1206,7 +1224,7 @@ C /* Check correct error returned even when nothing to put */
#endif
endif
start(j) = var_shape(j,i) + 2
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (.not. canConvert) then
if (err .ne. NF_ECHAR)
@@ -1218,11 +1236,11 @@ C /* Check correct error returned even when nothing to put */
start(j) = 1
5 continue
MAKE_TYPE2($1, value, 0)
- err = nfmpi_put_varm_$1_all(ncid, i,
+ err = PutVarm($1)(ncid, i,
+ start, edge, stride, imap, value)
if (canConvert) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ECHAR)
+ call errore('wrong type: ', err)
@@ -1302,13 +1320,13 @@ C*/
+ inRange3(val, var_type(i),
+ NFT_ITYPE($1))
14 continue
- err = nfmpi_put_varm_$1_all(ncid,i,index,count,
+ err = PutVarm($1)(ncid,i,index,count,
+ stride,imap,
+ value)
if (canConvert) then
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -1321,13 +1339,13 @@ C*/
8 continue
1 continue
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
call check_vars_$1(scratch)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
@@ -1339,7 +1357,7 @@ dnl TEST_NFMPI_PUT_ATT(TYPE) numeric only
dnl
define([TEST_NFMPI_PUT_ATT],dnl
[dnl
- subroutine test_nfmpi_put_att_$1()
+ subroutine TestFunc(att_$1)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -1360,9 +1378,9 @@ define([TEST_NFMPI_PUT_ATT],dnl
doubleprecision val
flags = IOR(NF_NOCLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
@@ -1374,18 +1392,18 @@ define([TEST_NFMPI_PUT_ATT],dnl
ATT_LEN_LL = ATT_LEN(j,i)
if (.not.((ATT_LEN_LL .le. MAX_NELS)))
+ stop 'assert(ATT_LEN_LL .le. MAX_NELS)'
- err = nfmpi_put_att_$1(BAD_ID, i,
+ err = PutAtt($1)(BAD_ID, i,
+ ATT_NAME(j,i),
+ ATT_TYPE(j,i),
+ ATT_LEN_LL, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_att_$1(ncid, BAD_VARID,
+ err = PutAtt($1)(ncid, BAD_VARID,
+ ATT_NAME(j,i),
+ ATT_TYPE(j,i), ATT_LEN_LL, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
- err = nfmpi_put_att_$1(ncid, i,
+ err = PutAtt($1)(ncid, i,
+ ATT_NAME(j,i), BAD_TYPE,
+ ATT_LEN_LL, value)
if (err .ne. NF_EBADTYPE)
@@ -1401,12 +1419,12 @@ define([TEST_NFMPI_PUT_ATT],dnl
+ inRange3(val, ATT_TYPE(j,i),
+ NFT_ITYPE($1))
3 continue
- err = nfmpi_put_att_$1(ncid, i, ATT_NAME(j,i),
+ err = PutAtt($1)(ncid, i, ATT_NAME(j,i),
+ ATT_TYPE(j,i), ATT_LEN_LL,
+ value)
if (allInExtRange) then
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
else
if (err .ne. NF_ERANGE)
+ call errore('range error: ', err)
@@ -1416,11 +1434,11 @@ define([TEST_NFMPI_PUT_ATT],dnl
1 continue
call check_atts_$1(ncid)
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
@@ -1525,7 +1543,7 @@ TEST_NFMPI_PUT_VARM(int8)
TEST_NFMPI_PUT_VARM(real)
TEST_NFMPI_PUT_VARM(double)
- subroutine test_nfmpi_put_att_text()
+ subroutine TestFunc(att_text)
implicit none
include "pnetcdf.inc"
#include "tests.inc"
@@ -1538,13 +1556,14 @@ TEST_NFMPI_PUT_VARM(double)
integer i
integer j
integer*8 k
+ integer*8 ndx(1)
integer err, flags
character*MAX_NELS value
flags = IOR(NF_NOCLOBBER, extra_flags)
- err = nfmpi_create(comm, scratch, flags, info, ncid)
+ err = FileCreate(scratch, flags)
if (err .ne. NF_NOERR) then
- call errore('nfmpi_create: ', err)
+ call errore('APIFunc(create): ', err)
return
end if
call def_dims(ncid)
@@ -1556,33 +1575,34 @@ TEST_NFMPI_PUT_VARM(double)
ATT_LEN_LL = ATT_LEN(j,i)
if (.not.(ATT_LEN_LL .le. MAX_NELS))
+ stop 'assert(ATT_LEN_LL .le. MAX_NELS)'
- err = nfmpi_put_att_text(BAD_ID, i,
+ err = PutAtt(text)(BAD_ID, i,
+ ATT_NAME(j,i), ATT_LEN_LL, value)
if (err .ne. NF_EBADID)
+ call errore('bad ncid: ', err)
- err = nfmpi_put_att_text(ncid, BAD_VARID,
+ err = PutAtt(text)(ncid, BAD_VARID,
+ ATT_NAME(j,i),
+ ATT_LEN_LL, value)
if (err .ne. NF_ENOTVAR)
+ call errore('bad var id: ', err)
do 3, k = 1, int(ATT_LEN_LL)
+ ndx(1) = k
value(k:k) = char(int(hash(ATT_TYPE(j,i),
- + -1, k)))
+ + -1, ndx)))
3 continue
- err = nfmpi_put_att_text(ncid, i, ATT_NAME(j,i),
+ err = PutAtt(text)(ncid, i, ATT_NAME(j,i),
+ ATT_LEN_LL, value)
if (err .ne. NF_NOERR)
- + call error(nfmpi_strerror(err))
+ + call error(ErrFunc(err))
end if
2 continue
1 continue
call check_atts_text(ncid)
- err = nfmpi_close(ncid)
+ err = FileClose(ncid)
if (err .ne. NF_NOERR)
- + call errore('nfmpi_close: ', err)
+ + call errore('APIFunc(close): ', err)
- err = nfmpi_delete(scratch, info)
+ err = FileDelete(scratch, info)
if (err .ne. NF_NOERR)
+ call errorc('delete of scratch file failed:',
+ scratch)
diff --git a/test/nonblocking/Makefile.in b/test/nonblocking/Makefile.in
index f038bf1..b5299b0 100644
--- a/test/nonblocking/Makefile.in
+++ b/test/nonblocking/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2012, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2590 2016-10-31 21:37:02Z wkliao $
+# $Id: Makefile.in 2648 2016-11-23 00:42:47Z wkliao $
#
# @configure_input@
@@ -16,14 +16,15 @@ FPPFLAGS += -I../../src/libf @FC_MODINC at ../../src/libf90 @FC_MODINC at ../common
LDFLAGS := -L../common $(LDFLAGS)
LIBS := $(LIBRARY) -ltestutils $(LIBS) @LCOV_LIB@
+M4_SRCS = bput_varn.m4 \
+ column_wise.m4
+
C_SRCS = mcoll_perf.c \
test_bput.c \
interleaved.c \
i_varn_int64.c \
- bput_varn_uint.c \
flexible_bput.c \
wait_after_indep.c \
- column_wise.c \
req_all.c \
i_varn_indef.c
@@ -33,8 +34,8 @@ F77_SRCS = mcoll_testf77.f \
F90_SRCS = mcoll_testf.f90 \
test_bputf.f90
-PROGS = $(C_SRCS:.c=)
-OBJS = $(C_SRCS:.c=.o)
+PROGS = $(C_SRCS:.c=) $(M4_SRCS:.m4=)
+OBJS = $(C_SRCS:.c=.o) $(M4_SRCS:.m4=.o)
ifeq (@has_fortran@, yes)
PROGS += $(F77_SRCS:.f=)
OBJS += $(F77_SRCS:.f=.o)
@@ -44,12 +45,13 @@ OBJS += $(F90_SRCS:.f90=.o)
endif
endif
-GARBAGE = $(PROGS) *.nc
-PACKING_LIST = $(C_SRCS) $(F77_SRCS) $(F90_SRCS) Makefile.in README depend
+GARBAGE = $(PROGS) $(M4_SRCS:.m4=.c) *.nc
+PACKING_LIST = $(M4_SRCS) $(C_SRCS) $(F77_SRCS) $(F90_SRCS) \
+ Makefile.in README depend
all: $(PROGS)
-$(C_SRCS:.c=.o): $(srcdir)/../common/testutils.h
+$(OBJS): $(srcdir)/../common/testutils.h
$(PROGS): ../common/libtestutils.a
@@ -65,7 +67,10 @@ test_bput: test_bput.o $(LIBRARY)
i_varn_int64: i_varn_int64.o $(LIBRARY)
$(LINK.c) $< $(LDFLAGS) $(LIBS)
-bput_varn_uint: bput_varn_uint.o $(LIBRARY)
+bput_varn.c: bput_varn.m4
+ $(M4) $(M4FLAGS) $< >$@
+
+bput_varn: bput_varn.o $(LIBRARY)
$(LINK.c) $< $(LDFLAGS) $(LIBS)
interleaved: interleaved.o $(LIBRARY)
@@ -77,6 +82,9 @@ flexible_bput: flexible_bput.o $(LIBRARY)
wait_after_indep: wait_after_indep.o $(LIBRARY)
$(LINK.c) $< $(LDFLAGS) $(LIBS)
+column_wise.c: column_wise.m4
+ $(M4) $(M4FLAGS) $< >$@
+
column_wise: column_wise.o $(LIBRARY)
$(LINK.c) $< $(LDFLAGS) $(LIBS)
diff --git a/test/nonblocking/bput_varn_uint.c b/test/nonblocking/bput_varn.m4
similarity index 64%
rename from test/nonblocking/bput_varn_uint.c
rename to test/nonblocking/bput_varn.m4
index bfb3b71..cfe1639 100644
--- a/test/nonblocking/bput_varn_uint.c
+++ b/test/nonblocking/bput_varn.m4
@@ -1,33 +1,37 @@
-/*********************************************************************
- *
+dnl This is m4 source.
+dnl Process using m4 to produce 'C' language file.
+dnl
+dnl If you see this line, you can ignore the next one.
+/* Do not edit this file. It is produced from the corresponding .m4 source */
+dnl
+/*
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
- *
- *********************************************************************/
-/* $Id: bput_varn_uint.c 2400 2016-04-18 22:25:13Z wkliao $ */
+ */
+/* $Id: bput_varn.m4 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests nonblocking buffered write varn APIs, including
- * ncmpi_bput_varn_uint() and ncmpi_bput_varn(),
+ * ncmpi_bput_varn_<type>() and ncmpi_bput_varn(),
* It first writes a sequence of requests with arbitrary array indices and
- * lengths to four variables of type NC_UINT, and reads back.
+ * lengths to four variables of various NC data types, and reads back.
*
* The compile and run commands are given below, together with an ncmpidump of
* the output file.
*
- * % mpicc -O2 -o bput_varn_uint bput_varn_uint.c -lpnetcdf
- * % mpiexec -n 4 ./bput_varn_uint /pvfs2/wkliao/testfile.nc
+ * % m4 bput_varn.m4 > bput_varn.c
+ * % mpicc -O2 -o bput_varn bput_varn.c -lpnetcdf
+ * % mpiexec -n 4 ./bput_varn /pvfs2/wkliao/testfile.nc
* % ncmpidump /pvfs2/wkliao/testfile.nc
* netcdf testfile {
- * // file format: CDF-5 (big variables)
* dimensions:
* Y = 4 ;
* X = 10 ;
* variables:
- * uint var0(Y, X) ;
- * uint var1(Y, X) ;
- * uint var2(Y, X) ;
- * uint var3(Y, X) ;
+ * uint64 var0(Y, X) ;
+ * uint64 var1(Y, X) ;
+ * uint64 var2(Y, X) ;
+ * uint64 var3(Y, X) ;
* data:
*
* var0 =
@@ -56,17 +60,47 @@
* }
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <ncconfig.h> /* output of 'configure' */
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
+#define NLOOPS 4
+#define MAX_NREQS 6
+#define NDIMS 2
+
#define NY 4
#define NX 10
-#define NDIMS 2
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h> /* ushort, uint */
+#endif
+
+typedef char text;
+typedef signed char schar;
+#ifndef HAVE_UCHAR
+typedef unsigned char uchar;
+#endif
+#ifndef HAVE_USHORT
+typedef unsigned short ushort;
+#endif
+#ifndef HAVE_UINT
+typedef unsigned int uint;
+#endif
+#ifndef HAVE_LONGLONG
+typedef long long longlong;
+#endif
+#ifndef HAVE_ULONGLONG
+typedef unsigned long long ulonglong;
+#endif
+
+include(`foreach.m4')dnl
+include(`utils.m4')dnl
#define ERR \
if (err != NC_NOERR) { \
@@ -85,76 +119,14 @@
} \
}
-static
-void clear_file_contents(int ncid, int *varid)
-{
- int i, err, rank;
- unsigned int *w_buffer = (unsigned int*) malloc(NY*NX * sizeof(unsigned int));
- for (i=0; i<NY*NX; i++) w_buffer[i] = 99999;
-
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-
- for (i=0; i<4; i++) {
- err = ncmpi_put_var_uint_all(ncid, varid[i], w_buffer);
- if (err != NC_NOERR) printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
- }
- free(w_buffer);
-}
-
-static
-int check_contents_for_fail(int ncid, int *varid)
-{
- /* all processes read entire variables back and check contents */
- int i, j, err, nprocs;
- unsigned int expected[4][NY*NX] = {{13, 13, 13, 11, 11, 10, 10, 12, 11, 11,
- 10, 12, 12, 12, 13, 11, 11, 12, 12, 12,
- 11, 11, 12, 13, 13, 13, 10, 10, 11, 11,
- 10, 10, 10, 12, 11, 11, 11, 13, 13, 13},
- {12, 12, 12, 10, 10, 13, 13, 11, 10, 10,
- 13, 11, 11, 11, 12, 10, 10, 11, 11, 11,
- 10, 10, 11, 12, 12, 12, 13, 13, 10, 10,
- 13, 13, 13, 11, 10, 10, 10, 12, 12, 12},
- {11, 11, 11, 13, 13, 12, 12, 10, 13, 13,
- 12, 10, 10, 10, 11, 13, 13, 10, 10, 10,
- 13, 13, 10, 11, 11, 11, 12, 12, 13, 13,
- 12, 12, 12, 10, 13, 13, 13, 11, 11, 11},
- {10, 10, 10, 12, 12, 11, 11, 13, 12, 12,
- 11, 13, 13, 13, 10, 12, 12, 13, 13, 13,
- 12, 12, 13, 10, 10, 10, 11, 11, 12, 12,
- 11, 11, 11, 13, 12, 12, 12, 10, 10, 10}};
-
- unsigned int *r_buffer = (unsigned int*) malloc(NY*NX * sizeof(unsigned int));
-
- MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- if (nprocs > 4) MPI_Barrier(MPI_COMM_WORLD);
-
- for (i=0; i<4; i++) {
- for (j=0; j<NY*NX; j++) r_buffer[j] = 99999;
- err = ncmpi_get_var_uint_all(ncid, varid[i], r_buffer);
- if (err != NC_NOERR) printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
-
- /* check if the contents of buf are expected */
- for (j=0; j<NY*NX; j++) {
- if (expected[i][j] >= nprocs) continue;
- if (r_buffer[j] != expected[i][j]) {
- printf("Expected read buf[%d][%d]=%u, but got %u\n",
- i,j,expected[i][j],r_buffer[j]);
- free(r_buffer);
- return 1;
- }
- }
- }
- free(r_buffer);
- return 0;
-}
-
static int
check_num_pending_reqs(int ncid, int expected, int lineno)
/* check if PnetCDF can reports expected number of pending requests */
{
int err, n_pendings;
err = ncmpi_inq_nreqs(ncid, &n_pendings);
- if (err != NC_NOERR) printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
+ if (err != NC_NOERR)
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
if (n_pendings != expected) {
printf("Error at line %d: expect %d pending requests but got %d\n",
lineno, expected, n_pendings);
@@ -177,13 +149,15 @@ void check_attached_buffer_usage(int ncid,
if (rank >= 4) return;
err = ncmpi_inq_buffer_size(ncid, &buf_size);
- if (err != NC_NOERR) printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
+ if (err != NC_NOERR)
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
if (expected_size != buf_size)
printf("Error at line %d: expect buffer size %lld but got %lld\n",
lineno, expected_size, buf_size);
err = ncmpi_inq_buffer_usage(ncid, &usage);
- if (err != NC_NOERR) printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
+ if (err != NC_NOERR)
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
if (expected_usage != usage)
printf("Error at line %d: expect buffer usage %lld but got %lld\n",
lineno, expected_usage, usage);
@@ -200,20 +174,88 @@ void permute(MPI_Offset *a, MPI_Offset *b)
}
}
-int main(int argc, char** argv)
+define(`TEST_BPUT_VARN',`dnl
+static
+void clear_file_contents_$1(int ncid, int *varid)
{
- char filename[256];
- int i, j, k, rank, nprocs, verbose=0, err, nerrs=0;
- int ncid, cmode, varid[4], dimid[2], nreqs, reqs[4], sts[4];
- unsigned int *buffer[4];
- int num_segs[4] = {4, 6, 5, 4};
- int req_lens[4], my_nsegs[4];
- MPI_Offset **starts[4], **counts[4];
- MPI_Offset n_starts[4][6][2] = {{{0,5}, {1,0}, {2,6}, {3,0}, {0,0}, {0,0}},
+ int i, err, rank;
+ $1 *w_buffer = ($1*) malloc(NY*NX * sizeof($1));
+ for (i=0; i<NY*NX; i++) w_buffer[i] = 99;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ for (i=0; i<4; i++) {
+ err = ncmpi_put_var_$1_all(ncid, varid[i], w_buffer);
+ if (err != NC_NOERR)
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
+ }
+ free(w_buffer);
+}
+
+static
+int check_contents_for_fail_$1(int ncid, int *varid)
+{
+ /* all processes read entire variables back and check contents */
+ int i, j, err, nprocs;
+ $1 expected[4][NY*NX] =
+ {{13, 13, 13, 11, 11, 10, 10, 12, 11, 11,
+ 10, 12, 12, 12, 13, 11, 11, 12, 12, 12,
+ 11, 11, 12, 13, 13, 13, 10, 10, 11, 11,
+ 10, 10, 10, 12, 11, 11, 11, 13, 13, 13},
+ {12, 12, 12, 10, 10, 13, 13, 11, 10, 10,
+ 13, 11, 11, 11, 12, 10, 10, 11, 11, 11,
+ 10, 10, 11, 12, 12, 12, 13, 13, 10, 10,
+ 13, 13, 13, 11, 10, 10, 10, 12, 12, 12},
+ {11, 11, 11, 13, 13, 12, 12, 10, 13, 13,
+ 12, 10, 10, 10, 11, 13, 13, 10, 10, 10,
+ 13, 13, 10, 11, 11, 11, 12, 12, 13, 13,
+ 12, 12, 12, 10, 13, 13, 13, 11, 11, 11},
+ {10, 10, 10, 12, 12, 11, 11, 13, 12, 12,
+ 11, 13, 13, 13, 10, 12, 12, 13, 13, 13,
+ 12, 12, 13, 10, 10, 10, 11, 11, 12, 12,
+ 11, 11, 11, 13, 12, 12, 12, 10, 10, 10}};
+
+ $1 *r_buffer = ($1*) malloc(NY*NX * sizeof($1));
+
+ MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+ if (nprocs > 4) MPI_Barrier(MPI_COMM_WORLD);
+
+ for (i=0; i<4; i++) {
+ for (j=0; j<NY*NX; j++) r_buffer[j] = 99;
+ err = ncmpi_get_var_$1_all(ncid, varid[i], r_buffer);
+ if (err != NC_NOERR)
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));
+
+ /* check if the contents of buf are expected */
+ for (j=0; j<NY*NX; j++) {
+ if (expected[i][j] >= nprocs) continue;
+ if (r_buffer[j] != expected[i][j]) {
+ printf("Expected read buf[%d][%d]=IFMT($1), but got IFMT($1)\n",
+ i,j,expected[i][j],r_buffer[j]);
+ free(r_buffer);
+ return 1;
+ }
+ }
+ }
+ free(r_buffer);
+ return 0;
+}
+
+static int
+test_bput_varn_$1(char *filename, int cdf)
+{
+ int i, j, k, rank, err, nerrs=0;
+ int ncid, cmode, varid[NLOOPS], dimid[2], nreqs, reqs[NLOOPS], sts[NLOOPS];
+ int req_lens[NLOOPS], my_nsegs[NLOOPS], num_segs[NLOOPS] = {4, 6, 5, 4};
+ $1 *buffer[NLOOPS];
+ MPI_Offset **starts[NLOOPS], **counts[NLOOPS];
+ MPI_Offset n_starts[NLOOPS][MAX_NREQS][2] =
+ {{{0,5}, {1,0}, {2,6}, {3,0}, {0,0}, {0,0}},
{{0,3}, {0,8}, {1,5}, {2,0}, {2,8}, {3,4}},
{{0,7}, {1,1}, {1,7}, {2,2}, {3,3}, {0,0}},
{{0,0}, {1,4}, {2,3}, {3,7}, {0,0}, {0,0}}};
- MPI_Offset n_counts[4][6][2] = {{{1,2}, {1,1}, {1,2}, {1,3}, {0,0}, {0,0}},
+ MPI_Offset n_counts[NLOOPS][MAX_NREQS][2] =
+ {{{1,2}, {1,1}, {1,2}, {1,3}, {0,0}, {0,0}},
{{1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,3}},
{{1,1}, {1,3}, {1,3}, {1,1}, {1,1}, {0,0}},
{{1,3}, {1,1}, {1,3}, {1,3}, {0,0}, {0,0}}};
@@ -239,40 +281,25 @@ int main(int argc, char** argv)
- - - X X X - - - -
- - - - - - - X X X
*/
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
-
- if (argc > 2) {
- if (!rank) printf("Usage: %s [filename]\n",argv[0]);
- MPI_Finalize();
- return 0;
- }
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
- MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
- if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for bput_varn_uint ", argv[0]);
- printf("%-66s ------ ", cmd_str);
- }
-
- if (verbose && nprocs != 4 && rank == 0)
- printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
/* create a new file for writing ----------------------------------------*/
- cmode = NC_CLOBBER | NC_64BIT_DATA;
+ cmode = NC_CLOBBER;
+ if (cdf == NC_FORMAT_CDF2)
+ cmode |= NC_64BIT_OFFSET;
+ else if (cdf == NC_FORMAT_CDF5)
+ cmode |= NC_64BIT_DATA;
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, MPI_INFO_NULL, &ncid);
ERR
/* create a global array of size NY * NX */
err = ncmpi_def_dim(ncid, "Y", NY, &dimid[0]); ERR
err = ncmpi_def_dim(ncid, "X", NX, &dimid[1]); ERR
- err = ncmpi_def_var(ncid, "var0", NC_UINT, NDIMS, dimid, &varid[0]); ERR
- err = ncmpi_def_var(ncid, "var1", NC_UINT, NDIMS, dimid, &varid[1]); ERR
- err = ncmpi_def_var(ncid, "var2", NC_UINT, NDIMS, dimid, &varid[2]); ERR
- err = ncmpi_def_var(ncid, "var3", NC_UINT, NDIMS, dimid, &varid[3]); ERR
+ err = ncmpi_def_var(ncid, "var0", NC_TYPE($1), NDIMS, dimid, &varid[0]); ERR
+ err = ncmpi_def_var(ncid, "var1", NC_TYPE($1), NDIMS, dimid, &varid[1]); ERR
+ err = ncmpi_def_var(ncid, "var2", NC_TYPE($1), NDIMS, dimid, &varid[2]); ERR
+ err = ncmpi_def_var(ncid, "var3", NC_TYPE($1), NDIMS, dimid, &varid[3]); ERR
err = ncmpi_enddef(ncid); ERR
/* allocate space for starts and counts */
@@ -294,10 +321,10 @@ int main(int argc, char** argv)
}
/* set values for starts and counts */
- for (i=0; i<4; i++) {
- int n = (i + rank) % 4;
+ for (i=0; i<NLOOPS; i++) {
+ int n = (i + rank) % NLOOPS;
my_nsegs[i] = num_segs[n]; /* number of segments for this request */
- for (j=0; j<6; j++) {
+ for (j=0; j<MAX_NREQS; j++) {
for (k=0; k<NDIMS; k++) {
starts[i][j][k] = n_starts[n][j][k];
counts[i][j][k] = n_counts[n][j][k];
@@ -306,7 +333,7 @@ int main(int argc, char** argv)
}
/* test error code: NC_ENULLABUF */
- err = ncmpi_bput_varn_uint(ncid, varid[0], 1, NULL, NULL, NULL, &reqs[0]);
+ err = ncmpi_bput_varn_$1(ncid, varid[0], 1, NULL, NULL, NULL, &reqs[0]);
if (err != NC_ENULLABUF) {
printf("Error at line %d: expecting error code NC_ENULLABUF but got %s\n",
__LINE__, nc_err_code_name(err));
@@ -330,23 +357,21 @@ int main(int argc, char** argv)
req_len *= counts[i][j][k];
req_lens[i] += req_len;
}
- if (verbose) printf("req_lens[%d]=%d\n",i,req_lens[i]);
/* allocate I/O buffer and initialize its contents */
- buffer[i] = (unsigned int*) malloc(req_lens[i] * sizeof(unsigned int));
- for (j=0; j<req_lens[i]; j++) buffer[i][j] = rank+10;
+ buffer[i] = ($1*) malloc(req_lens[i] * sizeof($1));
+ for (j=0; j<req_lens[i]; j++) buffer[i][j] = ($1)rank+10;
bufsize += req_lens[i];
}
- bufsize *= sizeof(unsigned int);
+ bufsize *= sizeof($1);
/* give PnetCDF a space to buffer the nonblocking requests */
if (bufsize > 0) {
err = ncmpi_buffer_attach(ncid, bufsize); ERR
}
- if (verbose) printf("%d: Attach buffer size %lld\n", rank, bufsize);
/* test error code: NC_ENULLSTART */
- err = ncmpi_bput_varn_uint(ncid, varid[0], 1, NULL, NULL, NULL, &reqs[0]);
+ err = ncmpi_bput_varn_$1(ncid, varid[0], 1, NULL, NULL, NULL, &reqs[0]);
if (rank < 4 && err != NC_ENULLSTART) {
printf("Error at line %d: expecting error code NC_ENULLSTART but got %s\n",
__LINE__, nc_err_code_name(err));
@@ -354,17 +379,18 @@ int main(int argc, char** argv)
}
/* write using varn API, one bput call per variable */
- clear_file_contents(ncid, varid);
+ clear_file_contents_$1(ncid, varid);
for (i=0; i<nreqs; i++) {
- err = ncmpi_bput_varn_uint(ncid, varid[i], my_nsegs[i], starts[i],
- counts[i], buffer[i], &reqs[i]);
+ err = ncmpi_bput_varn_$1(ncid, varid[i], my_nsegs[i], starts[i],
+ counts[i], buffer[i], &reqs[i]);
ERR
}
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -377,7 +403,7 @@ int main(int argc, char** argv)
check_attached_buffer_usage(ncid, bufsize, 0, __LINE__);
/* all processes read entire variables back and check contents */
- nerrs += check_contents_for_fail(ncid, varid);
+ nerrs += check_contents_for_fail_$1(ncid, varid);
/* permute write order: so starts[*] are not in an increasing order:
* swap segment 0 with segment 2 and swap segment 1 with segment 3
@@ -388,17 +414,18 @@ int main(int argc, char** argv)
}
/* write using varn API, one bput call per variable */
- clear_file_contents(ncid, varid);
+ clear_file_contents_$1(ncid, varid);
for (i=0; i<nreqs; i++) {
- err = ncmpi_bput_varn_uint(ncid, varid[i], my_nsegs[i], starts[i],
- counts[i], buffer[i], &reqs[i]);
+ err = ncmpi_bput_varn_$1(ncid, varid[i], my_nsegs[i], starts[i],
+ counts[i], buffer[i], &reqs[i]);
ERR
}
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -411,18 +438,18 @@ int main(int argc, char** argv)
check_attached_buffer_usage(ncid, bufsize, 0, __LINE__);
/* all processes read entire variables back and check contents */
- nerrs += check_contents_for_fail(ncid, varid);
+ nerrs += check_contents_for_fail_$1(ncid, varid);
for (i=0; i<nreqs; i++) free(buffer[i]);
/* test flexible API, using a noncontiguous buftype */
- clear_file_contents(ncid, varid);
+ clear_file_contents_$1(ncid, varid);
for (i=0; i<nreqs; i++) {
MPI_Datatype buftype;
- MPI_Type_vector(req_lens[i], 1, 2, MPI_UNSIGNED, &buftype);
+ MPI_Type_vector(req_lens[i], 1, 2, ITYPE2MPI($1), &buftype);
MPI_Type_commit(&buftype);
- buffer[i] = (unsigned int*)malloc(req_lens[i]*2*sizeof(unsigned int));
- for (j=0; j<req_lens[i]*2; j++) buffer[i][j] = rank+10;
+ buffer[i] = ($1*)malloc(req_lens[i]*2*sizeof($1));
+ for (j=0; j<req_lens[i]*2; j++) buffer[i][j] = ($1)rank+10;
err = ncmpi_bput_varn(ncid, varid[i], my_nsegs[i], starts[i],
counts[i], buffer[i], 1, buftype, &reqs[i]);
@@ -432,8 +459,9 @@ int main(int argc, char** argv)
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]*2; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -446,8 +474,9 @@ int main(int argc, char** argv)
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]*2; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -455,7 +484,7 @@ int main(int argc, char** argv)
check_attached_buffer_usage(ncid, bufsize, 0, __LINE__);
/* all processes read entire variables back and check contents */
- nerrs += check_contents_for_fail(ncid, varid);
+ nerrs += check_contents_for_fail_$1(ncid, varid);
/* permute back to original order */
for (i=0; i<nreqs; i++) {
@@ -465,12 +494,12 @@ int main(int argc, char** argv)
/* test flexible API, using a noncontiguous buftype, one bput call per
* variable */
- clear_file_contents(ncid, varid);
+ clear_file_contents_$1(ncid, varid);
for (i=0; i<nreqs; i++) {
MPI_Datatype buftype;
- MPI_Type_vector(req_lens[i], 1, 2, MPI_UNSIGNED, &buftype);
+ MPI_Type_vector(req_lens[i], 1, 2, ITYPE2MPI($1), &buftype);
MPI_Type_commit(&buftype);
- for (j=0; j<req_lens[i]*2; j++) buffer[i][j] = rank+10;
+ for (j=0; j<req_lens[i]*2; j++) buffer[i][j] = ($1)rank+10;
err = ncmpi_bput_varn(ncid, varid[i], my_nsegs[i], starts[i],
counts[i], buffer[i], 1, buftype, &reqs[i]);
@@ -480,8 +509,9 @@ int main(int argc, char** argv)
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]*2; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -494,8 +524,9 @@ int main(int argc, char** argv)
/* check if write buffer contents have been altered */
for (i=0; i<nreqs; i++) {
for (j=0; j<req_lens[i]*2; j++) {
- if (buffer[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%u\n", i,j,buffer[i][j]);
+ if (buffer[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buffer[i][j]);
nerrs++;
}
}
@@ -503,7 +534,7 @@ int main(int argc, char** argv)
check_attached_buffer_usage(ncid, bufsize, 0, __LINE__);
/* all processes read entire variables back and check contents */
- nerrs += check_contents_for_fail(ncid, varid);
+ nerrs += check_contents_for_fail_$1(ncid, varid);
/* free the buffer space for bput */
if (bufsize > 0) {
@@ -526,6 +557,62 @@ int main(int argc, char** argv)
free(starts[0]);
free(counts[0]);
+ return nerrs;
+}
+')
+TEST_BPUT_VARN(text)
+TEST_BPUT_VARN(schar)
+TEST_BPUT_VARN(uchar)
+TEST_BPUT_VARN(short)
+TEST_BPUT_VARN(ushort)
+TEST_BPUT_VARN(int)
+TEST_BPUT_VARN(uint)
+TEST_BPUT_VARN(float)
+TEST_BPUT_VARN(double)
+TEST_BPUT_VARN(longlong)
+TEST_BPUT_VARN(ulonglong)
+
+int main(int argc, char** argv)
+{
+ char filename[256];
+ int i, rank, err, nerrs=0;
+ int cdf_formats[3]={NC_FORMAT_CLASSIC, NC_FORMAT_CDF2, NC_FORMAT_CDF5};
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ if (argc > 2) {
+ if (!rank) printf("Usage: %s [filename]\n",argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+ MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
+
+ if (rank == 0) {
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for bput_varn ", basename(argv[0]));
+ printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
+ }
+
+ for (i=0; i<3; i++) {
+ nerrs += test_bput_varn_text(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_schar(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_short(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_int(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_float(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_double(filename, cdf_formats[i]);
+ if (cdf_formats[i] == NC_FORMAT_CDF5) {
+ nerrs += test_bput_varn_uchar(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_ushort(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_uint(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_longlong(filename, cdf_formats[i]);
+ nerrs += test_bput_varn_ulonglong(filename, cdf_formats[i]);
+ }
+ }
+
/* check if PnetCDF freed all internal malloc */
MPI_Offset malloc_size, sum_size;
err = ncmpi_inq_malloc_size(&malloc_size);
diff --git a/test/nonblocking/column_wise.c b/test/nonblocking/column_wise.m4
similarity index 65%
rename from test/nonblocking/column_wise.c
rename to test/nonblocking/column_wise.m4
index 1fb7573..19812a0 100644
--- a/test/nonblocking/column_wise.c
+++ b/test/nonblocking/column_wise.m4
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: column_wise.c 2404 2016-04-20 17:45:34Z wkliao $ */
+/* $Id: column_wise.m4 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests a number of nonblocking API calls, each writes a single
@@ -23,6 +23,7 @@
* The compile and run commands are given below, together with an ncmpidump of
* the output file.
*
+ * % m4 column_wise.m4 > column_wise.c
* % mpicc -O2 -o column_wise column_wise.c -lpnetcdf
* % mpiexec -l -n 4 ./column_wise /pvfs2/wkliao/testfile.nc
* 0: 0: myOff= 0 myNX= 4
@@ -58,9 +59,11 @@
* }
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <ncconfig.h> /* output of 'configure' */
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <unistd.h> /* getopt() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -70,36 +73,50 @@
#define NY 10
#define NX 4
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h> /* ushort, uint */
+#endif
+
+typedef char text;
+typedef signed char schar;
+#ifndef HAVE_UCHAR
+typedef unsigned char uchar;
+#endif
+#ifndef HAVE_USHORT
+typedef unsigned short ushort;
+#endif
+#ifndef HAVE_UINT
+typedef unsigned int uint;
+#endif
+#ifndef HAVE_LONGLONG
+typedef long long longlong;
+#endif
+#ifndef HAVE_ULONGLONG
+typedef unsigned long long ulonglong;
+#endif
+
+include(`foreach.m4')dnl
+include(`utils.m4')dnl
+
#define ERR {if(err!=NC_NOERR){nerrs++; printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));}}
-int main(int argc, char** argv)
+define(`TEST_COLUMN_WISE',`dnl
+static
+int test_column_wise_$1(char *filename, int cdf)
{
- extern int optind;
- char filename[256];
int i, j, nerrs=0, rank, nprocs, err, myNX, G_NX, myOff, num_reqs;
- int ncid, cmode, varid, dimid[2], *reqs, *sts, **buf;
+ int ncid, cmode, varid, dimid[2], *reqs, *sts;
+ $1 **buf;
MPI_Offset start[2], count[2];
- MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- if (argc > 2) {
- if (!rank) printf("Usage: %s [filename]\n",argv[0]);
- MPI_Finalize();
- return 0;
- }
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
- MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
-
- if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for iput/iget interleaved access ", argv[0]);
- printf("%-66s ------ ", cmd_str);
- }
-
- cmode = NC_CLOBBER | NC_64BIT_DATA;
+ cmode = NC_CLOBBER;
+ if (cdf == NC_FORMAT_CDF2)
+ cmode |= NC_64BIT_OFFSET;
+ else if (cdf == NC_FORMAT_CDF5)
+ cmode |= NC_64BIT_DATA;
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, MPI_INFO_NULL, &ncid);
ERR
@@ -108,29 +125,25 @@ int main(int argc, char** argv)
myOff = NX * rank;
myNX = NX;
- err = ncmpi_def_dim(ncid, "Y", NY, &dimid[0]);
- ERR
- err = ncmpi_def_dim(ncid, "X", G_NX, &dimid[1]);
- ERR
- err = ncmpi_def_var(ncid, "var", NC_INT, 2, dimid, &varid);
- ERR
- err = ncmpi_enddef(ncid);
- ERR
+ err = ncmpi_def_dim(ncid, "Y", NY, &dimid[0]); ERR
+ err = ncmpi_def_dim(ncid, "X", G_NX, &dimid[1]); ERR
+ err = ncmpi_def_var(ncid, "var", NC_TYPE($1), 2, dimid, &varid); ERR
+ err = ncmpi_enddef(ncid); ERR
/* First, fill the entire array with zeros, using a blocking I/O.
Every process writes a subarray of size NY * myNX */
- buf = (int**) malloc(myNX * sizeof(int*));
- buf[0] = (int*) calloc(NY * myNX, sizeof(int));
+ buf = ($1**) malloc(myNX * sizeof($1*));
+ buf[0] = ($1*) calloc(NY * myNX, sizeof($1));
start[0] = 0; start[1] = myOff;
count[0] = NY; count[1] = myNX;
- err = ncmpi_put_vara_int_all(ncid, varid, start, count, buf[0]);
+ err = ncmpi_put_vara_`$1'_all(ncid, varid, start, count, buf[0]);
free(buf[0]);
/* initialize the buffer with rank ID. Also make the case interesting,
by allocatsing buffersd separately */
for (i=0; i<myNX; i++) {
- buf[i] = (int*) malloc(NY * sizeof(int));
- for (j=0; j<NY; j++) buf[i][j] = rank+10;
+ buf[i] = ($1*) malloc(NY * sizeof($1));
+ for (j=0; j<NY; j++) buf[i][j] = ($1)rank+10;
}
reqs = (int*) malloc(myNX * sizeof(int));
@@ -142,9 +155,8 @@ int main(int argc, char** argv)
num_reqs = 0;
for (i=0; i<myNX; i++) {
- err = ncmpi_iput_vara_int(ncid, varid, start, count, buf[i],
- &reqs[num_reqs++]);
- ERR
+ err = ncmpi_iput_vara_$1(ncid, varid, start, count, buf[i],
+ &reqs[num_reqs++]); ERR
start[1] += nprocs;
}
@@ -160,14 +172,14 @@ int main(int argc, char** argv)
* changed to use a number > NC_BYTE_SWAP_BUFFER_SIZE/sizeof(int), say
* 1025
*/
- err = ncmpi_cancel(ncid, num_reqs, reqs, sts);
- ERR
+ err = ncmpi_cancel(ncid, num_reqs, reqs, sts); ERR
/* check if write buffer contents have been altered after cancelling */
for (i=0; i<myNX; i++) {
for (j=0; j<NY; j++) {
- if (buf[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%d\n", i,j,buf[i][j]);
+ if (buf[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buf[i][j]);
nerrs++;
}
}
@@ -177,9 +189,8 @@ int main(int argc, char** argv)
start[1] = rank;
num_reqs = 0;
for (i=0; i<myNX; i++) {
- err = ncmpi_iput_vara_int(ncid, varid, start, count, buf[i],
- &reqs[num_reqs++]);
- ERR
+ err = ncmpi_iput_vara_$1(ncid, varid, start, count, buf[i],
+ &reqs[num_reqs++]); ERR
start[1] += nprocs;
}
@@ -190,14 +201,14 @@ int main(int argc, char** argv)
reqs[2*i+1] = tmp;
}
- err = ncmpi_wait_all(ncid, num_reqs, reqs, sts);
- ERR
+ err = ncmpi_wait_all(ncid, num_reqs, reqs, sts); ERR
/* check if write buffer contents have been altered after wait */
for (i=0; i<myNX; i++) {
for (j=0; j<NY; j++) {
- if (buf[i][j] != rank+10) {
- printf("Error: put buffer altered buffer[%d][%d]=%d\n", i,j,buf[i][j]);
+ if (buf[i][j] != ($1)rank+10) {
+ printf("Error: put buffer altered buffer[%d][%d]=IFMT($1)\n",
+ i,j,buf[i][j]);
nerrs++;
}
}
@@ -218,7 +229,7 @@ int main(int argc, char** argv)
/* read back using the same access pattern */
for (i=0; i<myNX; i++)
- for (j=0; j<NY; j++) buf[i][j] = -1;
+ for (j=0; j<NY; j++) buf[i][j] = ($1)99;
/* each proc reads myNX single columns of the 2D array */
start[0] = 0; start[1] = rank;
@@ -226,26 +237,22 @@ int main(int argc, char** argv)
num_reqs = 0;
for (i=0; i<myNX; i++) {
- err = ncmpi_iget_vara_int(ncid, varid, start, count, buf[i],
- &reqs[num_reqs++]);
- ERR
+ err = ncmpi_iget_vara_$1(ncid, varid, start, count, buf[i],
+ &reqs[num_reqs++]); ERR
start[1] += nprocs;
}
/* this test is to see if cancelling free up all the internal malloc */
- err = ncmpi_cancel(ncid, num_reqs, reqs, sts);
- ERR
+ err = ncmpi_cancel(ncid, num_reqs, reqs, sts); ERR
/* post iget requests again */
start[1] = rank;
num_reqs = 0;
for (i=0; i<myNX; i++) {
- err = ncmpi_iget_vara_int(ncid, varid, start, count, buf[i],
- &reqs[num_reqs++]);
- ERR
+ err = ncmpi_iget_vara_$1(ncid, varid, start, count, buf[i],
+ &reqs[num_reqs++]); ERR
start[1] += nprocs;
}
- err = ncmpi_wait_all(ncid, num_reqs, reqs, sts);
- ERR
+ err = ncmpi_wait_all(ncid, num_reqs, reqs, sts); ERR
/* check status of all requests */
for (i=0; i<num_reqs; i++)
@@ -256,21 +263,81 @@ int main(int argc, char** argv)
}
for (i=0; i<myNX; i++) {
- for (j=0; j<NY; j++)
- if (buf[i][j] != rank+10) {
- printf("Error: expect buf[%d][%d]=%d but got %d\n",i,j,rank+10,buf[i][j]);
+ for (j=0; j<NY; j++) {
+ $1 expected = ($1)rank+10;
+ if (buf[i][j] != expected) {
+ printf("Error: expect buf[%d][%d]=IFMT($1) but got IFMT($1)\n",
+ i,j,expected,buf[i][j]);
nerrs++;
}
+ }
}
- err = ncmpi_close(ncid);
- ERR
+ err = ncmpi_close(ncid); ERR
free(sts);
free(reqs);
for (i=0; i<myNX; i++) free(buf[i]);
free(buf);
+ return nerrs;
+}'
+)dnl
+
+TEST_COLUMN_WISE(text)
+TEST_COLUMN_WISE(schar)
+TEST_COLUMN_WISE(uchar)
+TEST_COLUMN_WISE(short)
+TEST_COLUMN_WISE(ushort)
+TEST_COLUMN_WISE(int)
+TEST_COLUMN_WISE(uint)
+TEST_COLUMN_WISE(float)
+TEST_COLUMN_WISE(double)
+TEST_COLUMN_WISE(longlong)
+TEST_COLUMN_WISE(ulonglong)
+
+int main(int argc, char** argv)
+{
+ extern int optind;
+ char filename[256];
+ int i, nerrs=0, rank, err;
+ int cdf_formats[3]={NC_FORMAT_CLASSIC, NC_FORMAT_CDF2, NC_FORMAT_CDF5};
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ if (argc > 2) {
+ if (!rank) printf("Usage: %s [filename]\n",argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+ MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
+
+ if (rank == 0) {
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for iput/iget interleaved access ", basename(argv[0]));
+ printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
+ }
+
+ for (i=0; i<3; i++) {
+ nerrs += test_column_wise_text(filename, cdf_formats[i]);
+ nerrs += test_column_wise_schar(filename, cdf_formats[i]);
+ nerrs += test_column_wise_short(filename, cdf_formats[i]);
+ nerrs += test_column_wise_int(filename, cdf_formats[i]);
+ nerrs += test_column_wise_float(filename, cdf_formats[i]);
+ nerrs += test_column_wise_double(filename, cdf_formats[i]);
+ if (cdf_formats[i] == NC_FORMAT_CDF5) {
+ nerrs += test_column_wise_uchar(filename, cdf_formats[i]);
+ nerrs += test_column_wise_ushort(filename, cdf_formats[i]);
+ nerrs += test_column_wise_uint(filename, cdf_formats[i]);
+ nerrs += test_column_wise_longlong(filename, cdf_formats[i]);
+ nerrs += test_column_wise_ulonglong(filename, cdf_formats[i]);
+ }
+ }
+
/* check if PnetCDF freed all internal malloc */
MPI_Offset malloc_size, sum_size;
err = ncmpi_inq_malloc_size(&malloc_size);
diff --git a/test/nonblocking/depend b/test/nonblocking/depend
index f4e3b8c..4b00744 100644
--- a/test/nonblocking/depend
+++ b/test/nonblocking/depend
@@ -6,7 +6,7 @@ test_bputf.o: test_bputf.f90
test_bputf77.o: test_bputf77.f
interleaved.o: interleaved.c
i_varn_int64.o: i_varn_int64.c
-bput_varn_uint.o: bput_varn_uint.c
+bput_varn.o: bput_varn.c
flexible_bput.o: flexible_bput.c
wait_after_indep.o: wait_after_indep.c
column_wise.o: column_wise.c
diff --git a/test/nonblocking/flexible_bput.c b/test/nonblocking/flexible_bput.c
index 4d094c3..dda12b0 100644
--- a/test/nonblocking/flexible_bput.c
+++ b/test/nonblocking/flexible_bput.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: flexible_bput.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: flexible_bput.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -137,14 +138,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for flexible bput_varm ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for flexible bput_varm ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/nonblocking/i_varn_indef.c b/test/nonblocking/i_varn_indef.c
index 34ee753..1d90aef 100644
--- a/test/nonblocking/i_varn_indef.c
+++ b/test/nonblocking/i_varn_indef.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: i_varn_indef.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: i_varn_indef.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests posting nonblocking varn APIs, including
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -178,7 +179,7 @@ void permute(MPI_Offset *a, MPI_Offset *b)
int main(int argc, char** argv)
{
char filename[256], *varname[4];
- int i, j, k, rank, nprocs, verbose=0, err, nerrs=0, bufsize=0;
+ int i, j, k, rank, nprocs, err, nerrs=0, bufsize=0;
int ncid, cmode, varid[4], dimid[2], nreqs, reqs[12], sts[4];
long long *buffer[4], *cbuffer[4], *rbuffer[4];
int num_segs[4] = {4, 6, 5, 4};
@@ -224,18 +225,21 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for iput/iget varn in define mode ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for iput/iget varn in define mode ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
- if (verbose && nprocs != 4 && rank == 0)
+#ifdef DEBUG
+ if (nprocs != 4 && rank == 0)
printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+#endif
/* allocate space for starts and counts */
starts[0] = (MPI_Offset**) malloc(4 * 6 * sizeof(MPI_Offset*));
@@ -287,7 +291,6 @@ int main(int argc, char** argv)
req_len *= counts[i][j][k];
req_lens[i] += req_len;
}
- if (verbose) printf("req_lens[%d]=%d\n",i,req_lens[i]);
/* allocate I/O buffer and initialize its contents */
buffer[i] = (long long*) malloc(req_lens[i] * sizeof(long long));
diff --git a/test/nonblocking/i_varn_int64.c b/test/nonblocking/i_varn_int64.c
index 999bf2f..71933ff 100644
--- a/test/nonblocking/i_varn_int64.c
+++ b/test/nonblocking/i_varn_int64.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: i_varn_int64.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: i_varn_int64.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests nonblocking varn APIs, including
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -69,6 +70,12 @@
#define NX 10
#define NDIMS 2
+#define FATAL_ERR \
+ if (err != NC_NOERR) { \
+ printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err)); \
+ exit(1); \
+ }
+
#define ERR \
if (err != NC_NOERR) { \
printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err)); \
@@ -178,7 +185,7 @@ void permute(MPI_Offset *a, MPI_Offset *b)
int main(int argc, char** argv)
{
char filename[256];
- int i, j, k, rank, nprocs, verbose=0, err, nerrs=0, bufsize=0;
+ int i, j, k, rank, nprocs, err, nerrs=0, bufsize=0;
int ncid, cmode, varid[4], dimid[2], nreqs, reqs[4], sts[4];
long long *buffer[4], *cbuffer[4];
int num_segs[4] = {4, 6, 5, 4};
@@ -223,23 +230,26 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for iput/iget varn ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for iput/iget varn ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
- if (verbose && nprocs != 4 && rank == 0)
+#ifdef DEBUG
+ if (nprocs != 4 && rank == 0)
printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+#endif
/* create a new file for writing ----------------------------------------*/
cmode = NC_CLOBBER | NC_64BIT_DATA;
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, MPI_INFO_NULL, &ncid);
- ERR
+ FATAL_ERR
/* create a global array of size NY * NX */
err = ncmpi_def_dim(ncid, "Y", NY, &dimid[0]); ERR
@@ -303,7 +313,6 @@ int main(int argc, char** argv)
req_len *= counts[i][j][k];
req_lens[i] += req_len;
}
- if (verbose) printf("req_lens[%d]=%d\n",i,req_lens[i]);
/* allocate I/O buffer and initialize its contents */
buffer[i] = (long long*) malloc(req_lens[i] * sizeof(long long));
@@ -336,9 +345,11 @@ int main(int argc, char** argv)
/* try with buffer being a single contiguous space */
for (i=0; i<nreqs; i++) bufsize += req_lens[i];
- if (bufsize>0) cbuffer[0] = (long long*) malloc(bufsize * sizeof(long long));
- for (i=1; i<nreqs; i++) cbuffer[i] = cbuffer[i-1] + req_lens[i-1];
- for (i=0; i<bufsize; i++) cbuffer[0][i] = rank+10;
+ if (bufsize>0) {
+ cbuffer[0] = (long long*) malloc(bufsize * sizeof(long long));
+ for (i=1; i<nreqs; i++) cbuffer[i] = cbuffer[i-1] + req_lens[i-1];
+ for (i=0; i<bufsize; i++) cbuffer[0][i] = rank+10;
+ }
/* write usning varn API */
clear_file_contents(ncid, varid);
diff --git a/test/nonblocking/interleaved.c b/test/nonblocking/interleaved.c
index 1006054..4f7660c 100644
--- a/test/nonblocking/interleaved.c
+++ b/test/nonblocking/interleaved.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: interleaved.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: interleaved.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This program tests nonblocking APIs for handling interleaved file types.
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -82,13 +83,14 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for writing interleaved fileviews ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for writing interleaved fileviews ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
MPI_Info_create(&info);
diff --git a/test/nonblocking/mcoll_perf.c b/test/nonblocking/mcoll_perf.c
index fe50e0f..73153bb 100644
--- a/test/nonblocking/mcoll_perf.c
+++ b/test/nonblocking/mcoll_perf.c
@@ -3,14 +3,15 @@
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*
- * $Id: mcoll_perf.c 2150 2015-10-10 05:52:57Z wkliao $
+ * $Id: mcoll_perf.c 2744 2016-12-28 16:25:22Z wkliao $
*/
-#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
-#include <pnetcdf.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <unistd.h>
+#include <mpi.h>
+#include <pnetcdf.h>
#include <testutils.h>
@@ -294,7 +295,7 @@ int main(int argc, char **argv)
int array_of_psizes[3];
int status;
MPI_Offset array_of_starts[3], stride[3];
- char basename[256], filename[256];
+ char fbasename[256], filename[256];
char filename1[256], filename2[256], filename3[256];
char dimname[20], varname[20];
int ncid, dimids0[3], dimids1[3], rank_dim[3], *varid;
@@ -325,14 +326,15 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- strcpy(basename, "testfile.nc");
- if (argc == 2) strcpy(basename, argv[1]);
- MPI_Bcast(basename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
+ if (argc == 2) snprintf(fbasename, 256, "%s", argv[1]);
+ else strcpy(fbasename, "testfile");
+ MPI_Bcast(fbasename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for mput/iput APIs ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for mput/iput APIs ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
length = 2;
@@ -442,7 +444,7 @@ int main(int argc, char **argv)
MPI_Info_set(info, "romio_cb_write", "true");
*/
for (k=0; k<=9; k++){
- sprintf(filename, "%s.%d.%d.%d.nc", basename, length, nvars, k);
+ sprintf(filename, "%s.%d.%d.%d.nc", fbasename, length, nvars, k);
if (k==0)
strcpy(filename1, filename);
else if (k==7)
diff --git a/test/nonblocking/req_all.c b/test/nonblocking/req_all.c
index 4f9dfba..7583b65 100644
--- a/test/nonblocking/req_all.c
+++ b/test/nonblocking/req_all.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: req_all.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: req_all.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use NC_REQ_ALL in nonblocking I/O operations.
@@ -56,6 +56,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -84,14 +85,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for NC_REQ_ALL ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for NC_REQ_ALL ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/nonblocking/test_bput.c b/test/nonblocking/test_bput.c
index a90a793..8df28c6 100644
--- a/test/nonblocking/test_bput.c
+++ b/test/nonblocking/test_bput.c
@@ -4,11 +4,13 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: test_bput.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: test_bput.c 2744 2016-12-28 16:25:22Z wkliao $ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
+#include <assert.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -19,10 +21,10 @@
/*----< main() >------------------------------------------------------------*/
int main(int argc, char **argv) {
- int i, j, ncid, dimid[2], varid, err, nerrs=0, rank, nprocs, verbose;
+ int i, j, ncid, dimid[2], varid, err, nerrs=0, rank, nprocs;
int req[2], status[2];
float var[4][6];
- char *filename="testfile.nc";
+ char filename[256];
MPI_Offset bufsize, start[2], count[2], stride[2], imap[2];
MPI_Info info;
@@ -30,21 +32,24 @@ int main(int argc, char **argv) {
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- verbose = 0;
- if (nprocs > 1 && rank == 0 && verbose)
+#ifdef DEBUG
+ if (nprocs > 1 && rank == 0)
printf("Warning: %s is designed to run on 1 process\n", argv[0]);
+#endif
if (argc > 2) {
if (!rank) printf("Usage: %s [filename]\n",argv[0]);
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for bput API ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for bput API ", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
MPI_Info_create(&info);
diff --git a/test/nonblocking/wait_after_indep.c b/test/nonblocking/wait_after_indep.c
index 0122977..c97a7b6 100644
--- a/test/nonblocking/wait_after_indep.c
+++ b/test/nonblocking/wait_after_indep.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: wait_after_indep.c 2400 2016-04-18 22:25:13Z wkliao $ */
+/* $Id: wait_after_indep.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -33,6 +34,7 @@
int main(int argc, char** argv)
{
+ char filename[256];
int i, j, rank, nprocs, err, nerrs=0;
int ncid, varid, dimid[2], req, st;
MPI_Offset start[2], count[2], stride[2];
@@ -42,13 +44,23 @@ int main(int argc, char** argv)
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+ if (argc > 2) {
+ if (!rank) printf("Usage: %s [filename]\n",argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+ MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
+
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for ncmpi_end_indep_data ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for ncmpi_end_indep_data ", basename(argv[0]));
printf("%-66s ------ ",cmd_str);
+ free(cmd_str);
}
- err = ncmpi_create(MPI_COMM_WORLD, "testfile.nc", NC_CLOBBER|NC_64BIT_DATA,
+ err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER|NC_64BIT_DATA,
MPI_INFO_NULL, &ncid);
ERR
diff --git a/test/subfile/test_subfile.c b/test/subfile/test_subfile.c
index ab8e611..f19bbc9 100644
--- a/test/subfile/test_subfile.c
+++ b/test/subfile/test_subfile.c
@@ -2,14 +2,15 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
-/* $Id: test_subfile.c 2205 2015-11-28 20:41:50Z wkliao $ */
-#include <mpi.h>
+/* $Id: test_subfile.c 2744 2016-12-28 16:25:22Z wkliao $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
+#include <mpi.h>
#include <pnetcdf.h>
#include <testutils.h>
@@ -42,7 +43,7 @@ int main(int argc, char **argv)
int array_of_psizes[3];
int status;
MPI_Offset array_of_starts[3];
- char *basename = NULL, *basename1 = NULL, filename[256];
+ char *fbasename = NULL, *fbasename1 = NULL, filename[256];
char dimname[20], varname[20];
int ncid, dimids0[3], rank_dim[3], *varid=NULL;
MPI_Info info=MPI_INFO_NULL, info_used=MPI_INFO_NULL;
@@ -69,32 +70,32 @@ int main(int argc, char **argv)
if (!rank) {
while ((opt = getopt(argc, argv, "f:s:rp:n:l:")) != EOF) {
switch (opt) {
- case 'f': basename = optarg;
+ case 'f': fbasename = optarg;
break;
- case 's': num_sf = atoi(optarg);
+ case 's': num_sf = (int)strtol(optarg,NULL,10);
break;
case 'r': do_read = 1;
break;
- case 'p': par_dim_id = atoi(optarg);
+ case 'p': par_dim_id = (int)strtol(optarg,NULL,10);
break;
- case 'n': nvars = atoi(optarg);
+ case 'n': nvars = (int)strtol(optarg,NULL,10);
break;
- case 'l': length = atoi(optarg);
+ case 'l': length = (int)strtol(optarg,NULL,10);
break;
default:
break;
}
}
- if (basename == NULL) {
+ if (fbasename == NULL) {
fprintf(stderr, "\n*# Usage: test_subfile -f pathname -s num_sf -p par_dim_id \n\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
- basename1 = (char *) malloc (MAXLINE);
- sprintf(basename1, "%s", basename);
- len = strlen(basename1);
+ fbasename1 = (char *) malloc (MAXLINE);
+ sprintf(fbasename1, "%s", fbasename);
+ len = strlen(fbasename1);
MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(basename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_Bcast(fbasename, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
MPI_Bcast(&num_sf, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(&par_dim_id, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(&nvars, 1, MPI_INT, 0, MPI_COMM_WORLD);
@@ -102,9 +103,9 @@ int main(int argc, char **argv)
MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD);
}
else {
- basename1 = (char *) malloc (MAXLINE);
+ fbasename1 = (char *) malloc (MAXLINE);
MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(basename1, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
+ MPI_Bcast(fbasename1, len+1, MPI_CHAR, 0, MPI_COMM_WORLD);
MPI_Bcast(&num_sf, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(&par_dim_id, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast(&nvars, 1, MPI_INT, 0, MPI_COMM_WORLD);
@@ -113,9 +114,10 @@ int main(int argc, char **argv)
}
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for subfiling", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for subfiling", basename(argv[0]));
printf("%-66s ------ ", cmd_str);
+ free(cmd_str);
}
array_of_gsizes[0] = array_of_gsizes[1] = array_of_gsizes[2] = length;
@@ -208,7 +210,7 @@ int main(int argc, char **argv)
sprintf(tmp, "%d", num_sf);
MPI_Info_set(info, "nc_num_subfiles", tmp);
- sprintf(filename, "%s.%d.%d.%d.nc", basename1, length, 1, 0);
+ sprintf(filename, "%s.%d.%d.%d.nc", fbasename1, length, 1, 0);
if (do_read == 1) goto read;
@@ -386,7 +388,7 @@ end:
if (!do_read) free(varid);
free(starts_list);
free(count_list);
- free(basename1);
+ free(fbasename1);
MPI_Offset malloc_size, sum_size;
int err, nfiles, ncids[10];
diff --git a/test/testcases/Makefile.in b/test/testcases/Makefile.in
index 52cc021..b4e548a 100644
--- a/test/testcases/Makefile.in
+++ b/test/testcases/Makefile.in
@@ -2,7 +2,7 @@
# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
-# $Id: Makefile.in 2614 2016-11-12 19:50:02Z wkliao $
+# $Id: Makefile.in 2730 2016-12-19 00:09:18Z wkliao $
#
# @configure_input@
@@ -224,9 +224,9 @@ testing check verbose_testing : $(PROGS)
for i in $(PROGS); do ( \
$(TEST_SEQRUN) ./$$i $(TEST_OUTDIR)/testfile.nc \
; ) ; done
- $(TEST_SEQRUN) ./redef1 $(TEST_OUTDIR)/testfile.nc
$(TEST_SEQRUN) $(NCMPIGEN) -v 2 -o $(TEST_OUTDIR)/redef1.nc $(srcdir)/redef-good.ncdump
- $(TEST_SEQRUN) $(NCMPIDIFF) $(TEST_OUTDIR)/testfile.nc $(TEST_OUTDIR)/redef1.nc
+ $(TEST_SEQRUN) ./redef1 $(TEST_OUTDIR)/testfile.nc
+ $(TEST_SEQRUN) $(NCMPIDIFF) -q $(TEST_OUTDIR)/testfile.nc $(TEST_OUTDIR)/redef1.nc
# Some of these tests are designed to run on one process,
# Run them on 4 processes to see if they can handle well
diff --git a/test/testcases/add_var.c b/test/testcases/add_var.c
index c2b8a3f..458198a 100644
--- a/test/testcases/add_var.c
+++ b/test/testcases/add_var.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: add_var.c 2367 2016-03-22 03:54:38Z wkliao $
+ * $Id: add_var.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -44,14 +45,15 @@ int main(int argc, char** argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for checking offsets of new variables ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for checking offsets of new variables ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid); ERR
diff --git a/test/testcases/alignment_test.c b/test/testcases/alignment_test.c
index 904bd5c..5306614 100644
--- a/test/testcases/alignment_test.c
+++ b/test/testcases/alignment_test.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: alignment_test.c 2399 2016-04-17 18:59:32Z wkliao $
+ * $Id: alignment_test.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -35,7 +36,7 @@
#define ERR {if(err!=NC_NOERR){nerrs++;printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));}}
int main(int argc, char** argv) {
- char *filename="redef1.nc";
+ char filename[256];
int i, j, rank, nprocs, err, verbose=0, nerrs=0;
int ncid, cmode, varid[NVARS], dimid[2], *buf;
char str[32];
@@ -53,12 +54,14 @@ int main(int argc, char** argv) {
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "redef1.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for alignment ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for alignment ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/testcases/attrf.f b/test/testcases/attrf.f
index 9fec783..35a7f3f 100644
--- a/test/testcases/attrf.f
+++ b/test/testcases/attrf.f
@@ -2,7 +2,7 @@
! Copyright (C) 2015, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: attrf.f 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: attrf.f 2638 2016-11-18 14:51:02Z wkliao $
! This program tests if NF_ERANGE is properly returned with a coredump
! when an out-of-range value is used to write to a global attribute.
@@ -181,7 +181,7 @@
if (rank .EQ. 0 .AND. sum_size .GT. 0)
+ print 998,
+ 'heap memory allocated by PnetCDF internally has ',
- + sum_size/1048576, ' MiB yet to be freed'
+ + sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/buftype_free.c b/test/testcases/buftype_free.c
index e21cfc4..ecb732a 100644
--- a/test/testcases/buftype_free.c
+++ b/test/testcases/buftype_free.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: buftype_free.c 2399 2016-04-17 18:59:32Z wkliao $
+ * $Id: buftype_free.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -42,14 +43,15 @@ int main(int argc, char **argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for free buftype in flexible API ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for free buftype in flexible API ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid); ERR
diff --git a/test/testcases/buftype_freef.f b/test/testcases/buftype_freef.f
index 40a587a..eac3d04 100644
--- a/test/testcases/buftype_freef.f
+++ b/test/testcases/buftype_freef.f
@@ -2,7 +2,7 @@
! Copyright (C) 2015, Northwestern University
! See COPYRIGHT notice in top-level directory.
!
-! $Id: buftype_freef.f 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: buftype_freef.f 2638 2016-11-18 14:51:02Z wkliao $
! This example tests if PnetCDF duplicates the MPI derived data type supplied
! by the user, when calling the flexible APIs. It tests a PnetCDF bug
@@ -164,7 +164,7 @@
if (rank .EQ. 0 .AND. sum_size .GT. 0)
+ print 998,
+ 'heap memory allocated by PnetCDF internally has ',
- + sum_size/1048576, ' MiB yet to be freed'
+ + sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/check_striping.c b/test/testcases/check_striping.c
index 06b5092..09af47a 100644
--- a/test/testcases/check_striping.c
+++ b/test/testcases/check_striping.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: check_striping.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: check_striping.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -30,7 +31,7 @@
#define ERR {if(err!=NC_NOERR){nerrs++;printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));}}
int main(int argc, char** argv) {
- char *filename="testfile.nc";
+ char filename[256];
int rank, nprocs, err, nerrs=0, ncid, cmode;
int striping_size, striping_count, root_striping_size, root_striping_count;
@@ -43,12 +44,14 @@ int main(int argc, char** argv) {
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for strining info ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for strining info ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
cmode = NC_CLOBBER;
@@ -59,8 +62,10 @@ int main(int argc, char** argv) {
root_striping_size = striping_size;
root_striping_count = striping_count;
- MPI_Bcast(&root_striping_size, 1, MPI_INT, 0, MPI_COMM_WORLD);
- MPI_Bcast(&root_striping_count, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ err = MPI_Bcast(&root_striping_size, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
+ err = MPI_Bcast(&root_striping_count, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ MPI_ERR(err)
if (root_striping_size != striping_size) {
printf("Error at PE %2d: inconsistent striping_size (root=%d local=%d)\n",
rank, root_striping_size, striping_size);
diff --git a/test/testcases/check_type.c b/test/testcases/check_type.c
index b54bcb1..3f14fa1 100644
--- a/test/testcases/check_type.c
+++ b/test/testcases/check_type.c
@@ -2,7 +2,7 @@
* Copyright (C) 2015, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: check_type.c 2567 2016-10-20 23:18:58Z wkliao $
+ * $Id: check_type.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -73,14 +74,15 @@ int main(int argc, char* argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for checking for type conflict ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for checking for type conflict ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER|NC_64BIT_DATA, MPI_INFO_NULL, &ncid); ERR0
diff --git a/test/testcases/collective_error.c b/test/testcases/collective_error.c
index 337f109..c0bc11a 100644
--- a/test/testcases/collective_error.c
+++ b/test/testcases/collective_error.c
@@ -2,71 +2,59 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: collective_error.c 2614 2016-11-12 19:50:02Z wkliao $
+ * $Id: collective_error.c 2744 2016-12-28 16:25:22Z wkliao $
*/
-/* This test program checks if a collective API can be nicely aborted without
- * causing the program to hang. It runs on 2 processes. One process deliberately
- * produces an error (using an illegal start argument), while the other does not.
+/* This test program checks whether a collective API can be nicely aborted
+ * without causing the program to hang. It runs on 2 processes.
+ * One process deliberately produces an error (using an illegal start argument),
+ * while the other does not.
+ *
+ * Note when in safe mode, all processes obtain the same error code and hence
+ * can terminate nicely. However, when not in safe mode, collective APIs can
+ * hang for the following erros: NC_EBADID, NC_EPERM, NC_EINDEFINE, NC_EINDEP,
+ * and NC_ENOTINDEP. These errors are considered fatal and program should stop.
+ * For other kinds of errors, the processes causing the error will continue to
+ * participate the collective I/O with zero-length requests, so that the MPI
+ * collective I/O can complete with all processes participating the call.
+ *
+ * This program tests error code NC_EINVALCOORDS, not in the above list.
*/
-#include <mpi.h>
-#include <pnetcdf.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h> /* basename() */
#include <assert.h>
+#include <mpi.h>
+#include <pnetcdf.h>
#include <testutils.h>
#define ERR { if (err!=NC_NOERR){printf("PE %d: error at line %d (%s)\n",rank,__LINE__,ncmpi_strerror(err)); nerrs++;}}
-#define CHECK_ERROR(fn) { \
- if (rank == 0 && err != NC_NOERR) \
- printf("PE %d: %s error is %s\n",rank,fn,ncmpi_strerror(err)); \
- if (rank == 1 && err != NC_EINVALCOORDS) \
- printf("PE %d: %s error code should be NC_EINVALCOORDS but got %s\n",rank,fn,nc_err_code_name(err)); \
+
+#define EXP_ERR(e) { \
+ if (err!=e) { \
+ printf("PE %d: error at line %d expecting %s but got %s\n",rank,__LINE__,nc_err_code_name(e),nc_err_code_name(err)); \
+ nerrs++; \
+ } \
}
-int main(int argc, char *argv[])
+static
+int test_collective_error(char *filename, int safe_mode)
{
- char *filename="testfile.nc";
- int rank, nproc, ncid, err, nerrs=0, varid, dimids[1];
- int req, status, verbose;
- MPI_Offset start[1], count[1];
+ int rank, nproc, ncid, err, nerrs=0, varid, dimids[1], req, status;
double buf[2];
+ MPI_Offset start[1], count[1];
+ MPI_Comm comm=MPI_COMM_WORLD;
- MPI_Init(&argc, &argv);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_rank(comm, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
- if (argc > 2) {
- if (!rank) printf("Usage: %s [filename]\n",argv[0]);
- MPI_Finalize();
- return 0;
- }
- if (argc == 2) filename = argv[1];
-
- if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for collective abort ", argv[0]);
- printf("%-66s ------ ", cmd_str); fflush(stdout);
- }
-
- verbose = 0;
- if (nproc != 2 && rank == 0 && verbose)
- printf("Warning: %s is designed to run on 2 processes\n",argv[0]);
-
/* Create a 2 element vector of doubles */
- err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid);
- ERR
-
- err = ncmpi_def_dim(ncid, "dim", 2, &dimids[0]);
- ERR
-
- err = ncmpi_def_var(ncid, "var", NC_DOUBLE, 1, dimids, &varid);
- ERR
-
- err = ncmpi_enddef(ncid);
- ERR
+ err = ncmpi_create(comm, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid); ERR
+ err = ncmpi_def_dim(ncid, "dim", 2, &dimids[0]); ERR
+ err = ncmpi_def_var(ncid, "var", NC_DOUBLE, 1, dimids, &varid); ERR
+ err = ncmpi_enddef(ncid); ERR
if (rank == 0) {
start[0] = 0;
@@ -89,7 +77,8 @@ int main(int argc, char *argv[])
err = ncmpi_put_vara_all(ncid, varid, start, count,
buf, count[0], MPI_DOUBLE);
- CHECK_ERROR("ncmpi_put_vara_all")
+ if ((safe_mode && nproc > 1) || rank == 1) EXP_ERR(NC_EINVALCOORDS)
+ else EXP_ERR(NC_NOERR)
/* check if user put buffer contents altered */
if (buf[0] != 1.0) {
@@ -104,7 +93,8 @@ int main(int argc, char *argv[])
}
err = ncmpi_put_vara_double_all(ncid, varid, start, count, buf);
- CHECK_ERROR("ncmpi_put_vara_double_all")
+ if ((safe_mode && nproc > 1) || rank == 1) EXP_ERR(NC_EINVALCOORDS)
+ else EXP_ERR(NC_NOERR)
/* check if user put buffer contents altered */
if (buf[0] != 1.0) {
@@ -119,10 +109,12 @@ int main(int argc, char *argv[])
}
err = ncmpi_iput_vara_double(ncid, varid, start, count, buf, &req);
- CHECK_ERROR("ncmpi_iput_vara_double")
+ if (rank == 1)
+ EXP_ERR(NC_EINVALCOORDS)
+ else
+ EXP_ERR(NC_NOERR)
- err = ncmpi_wait_all(ncid, 1, &req, &status);
- ERR
+ err = ncmpi_wait_all(ncid, 1, &req, &status); ERR
/* check if user put buffer contents altered */
if (buf[0] != 1.0) {
@@ -138,19 +130,56 @@ int main(int argc, char *argv[])
err = ncmpi_get_vara_all(ncid, varid, start, count,
buf, count[0], MPI_DOUBLE);
- CHECK_ERROR("ncmpi_get_vara_all")
+ if ((safe_mode && nproc > 1) || rank == 1) EXP_ERR(NC_EINVALCOORDS)
+ else EXP_ERR(NC_NOERR)
err = ncmpi_get_vara_double_all(ncid, varid, start, count, buf);
- CHECK_ERROR("ncmpi_get_vara_double_all")
+ if ((safe_mode && nproc > 1) || rank == 1) EXP_ERR(NC_EINVALCOORDS)
+ else EXP_ERR(NC_NOERR)
err = ncmpi_iget_vara_double(ncid, varid, start, count, buf, &req);
- CHECK_ERROR("ncmpi_iget_vara_double")
+ if (rank == 1)
+ EXP_ERR(NC_EINVALCOORDS)
+ else
+ EXP_ERR(NC_NOERR)
+
+ err = ncmpi_wait_all(ncid, 1, &req, &status); ERR
+
+ err = ncmpi_close(ncid); ERR
+
+ return nerrs;
+}
+
+int main(int argc, char *argv[])
+{
+ char filename[256];
+ int rank, err, nerrs=0;
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ if (argc > 2) {
+ if (!rank) printf("Usage: %s [filename]\n",argv[0]);
+ MPI_Finalize();
+ return 0;
+ }
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
+
+ if (rank == 0) {
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for collective abort ", basename(argv[0]));
+ printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
+ }
- err = ncmpi_wait_all(ncid, 1, &req, &status);
- ERR
+ /* test in non-safe mode */
+ setenv("PNETCDF_SAFE_MODE", "0", 1);
+ nerrs += test_collective_error(filename, 0);
- err = ncmpi_close(ncid);
- ERR
+ /* test in safe mode */
+ setenv("PNETCDF_SAFE_MODE", "1", 1);
+ nerrs += test_collective_error(filename, 1);
/* check if PnetCDF freed all internal malloc */
MPI_Offset malloc_size, sum_size;
diff --git a/test/testcases/erange_fill.m4 b/test/testcases/erange_fill.m4
index ea89e78..d20a5ac 100644
--- a/test/testcases/erange_fill.m4
+++ b/test/testcases/erange_fill.m4
@@ -2,7 +2,7 @@
* Copyright (C) 2016, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: erange_fill.m4 2577 2016-10-25 00:03:31Z wkliao $
+ * $Id: erange_fill.m4 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -283,14 +284,15 @@ int main(int argc, char** argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for checking for type conflict ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for checking for type conflict ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/*---- CDF-2 format -----------------------------------------------------*/
diff --git a/test/testcases/flexible.c b/test/testcases/flexible.c
index 6104321..83eba84 100644
--- a/test/testcases/flexible.c
+++ b/test/testcases/flexible.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: flexible.c 2399 2016-04-17 18:59:32Z wkliao $
+ * $Id: flexible.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -65,14 +66,15 @@ int main(int argc, char **argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for flexible put and get ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for flexible put and get ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL,
diff --git a/test/testcases/flexible2.c b/test/testcases/flexible2.c
index 6c61b2b..5f22dc3 100644
--- a/test/testcases/flexible2.c
+++ b/test/testcases/flexible2.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: flexible2.c 2399 2016-04-17 18:59:32Z wkliao $ */
+/* $Id: flexible2.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -75,6 +75,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -106,14 +107,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for flexible APIs ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for flexible APIs ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/testcases/flexible_varm.c b/test/testcases/flexible_varm.c
index 3df4ec1..9b22224 100644
--- a/test/testcases/flexible_varm.c
+++ b/test/testcases/flexible_varm.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: flexible_varm.c 2133 2015-09-26 19:16:01Z wkliao $ */
+/* $Id: flexible_varm.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <assert.h>
#include <mpi.h>
#include <pnetcdf.h>
@@ -134,14 +135,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for flexible varm APIs ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for flexible varm APIs ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a new file for writing ----------------------------------------*/
diff --git a/test/testcases/inq_num_vars.c b/test/testcases/inq_num_vars.c
index 302743c..7b2358a 100644
--- a/test/testcases/inq_num_vars.c
+++ b/test/testcases/inq_num_vars.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: inq_num_vars.c 2219 2015-12-11 22:30:03Z wkliao $
+ * $Id: inq_num_vars.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -59,7 +60,7 @@ void check_num_vars(int ncid,
}
int main(int argc, char** argv) {
- char *filename="testfile.nc";
+ char filename[256];
int nerrs, rank, nprocs, err;
int ncid, cmode, varid[7], dimid[3];
MPI_Info info=MPI_INFO_NULL;
@@ -72,12 +73,14 @@ int main(int argc, char** argv) {
if (!rank) printf("Usage: %s [filename]\n",argv[0]);
goto fn_exit;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for no. record/fixed variables", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for no. record/fixed variables", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* printf("PnetCDF version string: \"%s\"\n", ncmpi_inq_libvers()); */
diff --git a/test/testcases/inq_num_varsf.f90 b/test/testcases/inq_num_varsf.f90
index c35284f..319cfdc 100644
--- a/test/testcases/inq_num_varsf.f90
+++ b/test/testcases/inq_num_varsf.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2014, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: inq_num_varsf.f90 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: inq_num_varsf.f90 2638 2016-11-18 14:51:02Z wkliao $
!
! This program tests if one can get the number of record variables and
@@ -155,7 +155,7 @@
MPI_SUM, 0, MPI_COMM_WORLD, ierr)
if (rank .EQ. 0 .AND. sum_size .GT. 0_MPI_OFFSET_KIND) print 998, &
'heap memory allocated by PnetCDF internally has ', &
- sum_size/1048576, ' MiB yet to be freed'
+ sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/inq_recsize.c b/test/testcases/inq_recsize.c
index cf3bea3..a62256b 100644
--- a/test/testcases/inq_recsize.c
+++ b/test/testcases/inq_recsize.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: inq_recsize.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: inq_recsize.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -31,7 +32,7 @@
#define ERR {if(err!=NC_NOERR)printf("Error at line=%d: %s\n", __LINE__, ncmpi_strerror(err));}
int main(int argc, char** argv) {
- char *filename="testfile.nc";
+ char filename[256];
int nerrs, rank, nprocs, err;
int ncid, cmode, varid[7], dimid[3];
MPI_Offset expected_recsize, recsize;
@@ -45,12 +46,14 @@ int main(int argc, char** argv) {
if (!rank) printf("Usage: %s [filename]\n",argv[0]);
goto fn_exit;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for inquiring record size ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for inquiring record size ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* printf("PnetCDF version string: \"%s\"\n", ncmpi_inq_libvers()); */
diff --git a/test/testcases/inq_recsizef.f90 b/test/testcases/inq_recsizef.f90
index f2730c7..522ee8c 100644
--- a/test/testcases/inq_recsizef.f90
+++ b/test/testcases/inq_recsizef.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2014, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: inq_recsizef.f90 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: inq_recsizef.f90 2638 2016-11-18 14:51:02Z wkliao $
!
! This program tests if one can get the size of record block correctly.
@@ -131,7 +131,7 @@
MPI_SUM, 0, MPI_COMM_WORLD, ierr)
if (rank .EQ. 0 .AND. sum_size .GT. 0_MPI_OFFSET_KIND) print 998, &
'heap memory allocated by PnetCDF internally has ', &
- sum_size/1048576, ' MiB yet to be freed'
+ sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/ivarn.c b/test/testcases/ivarn.c
index 87ae2f7..3a366c8 100644
--- a/test/testcases/ivarn.c
+++ b/test/testcases/ivarn.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: ivarn.c 2219 2015-12-11 22:30:03Z wkliao $ */
+/* $Id: ivarn.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests using calls to ncmpi_iput_varn_int(),
@@ -58,6 +58,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -156,7 +157,7 @@ int check_dbl_buf(double *buffer, double extra)
int main(int argc, char** argv)
{
char filename[256];
- int i, rank, nprocs, err, verbose=0, nerrs=0;
+ int i, rank, nprocs, err, nerrs=0;
int ncid, cmode, dimid[2];
int vari0001, vari0002, varr0001, varr0002, vard0001, vard0002;
MPI_Offset **starts, **counts;
@@ -174,18 +175,21 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for ncmpi_iput_varn_<type>() ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for ncmpi_iput_varn_<type>() ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- if (verbose && nprocs != 4 && rank == 0)
+#ifdef DEBUG
+ if (nprocs != 4 && rank == 0)
printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+#endif
/* create a new file for writing ----------------------------------------*/
cmode = NC_CLOBBER | NC_64BIT_DATA;
diff --git a/test/testcases/last_large_var.c b/test/testcases/last_large_var.c
index c03b431..7926359 100644
--- a/test/testcases/last_large_var.c
+++ b/test/testcases/last_large_var.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: last_large_var.c 2454 2016-06-23 19:14:10Z wkliao $ */
+/* $Id: last_large_var.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This program tests the special case when there is no record variable, the
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -340,14 +341,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for last large var in CDF-1/2", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for last large var in CDF-1/2", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
nerrs += check_fix_var(filename);
diff --git a/test/testcases/modes.c b/test/testcases/modes.c
index 636dbea..ca275d4 100644
--- a/test/testcases/modes.c
+++ b/test/testcases/modes.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: modes.c 2474 2016-09-05 23:13:05Z wkliao $ */
+/* $Id: modes.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This program tests if the correct error codes are returns given various
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy() */
+#include <libgen.h> /* basename() */
#include <unistd.h> /* unlink(), access() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -43,7 +44,7 @@
static
int check_modes(char *filename)
{
- int rank, err, nerrs=0, file_exist;
+ int rank, err, nerrs=0;
int ncid, cmode;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -62,52 +63,57 @@ int check_modes(char *filename)
EXPECT_ERR(NC_EINVAL_CMODE)
/* The file should not be created */
- file_exist = 0;
- if (rank == 0 && access(filename, F_OK) == 0) file_exist = 1;
- MPI_Bcast(&file_exist, 1, MPI_INT, 0, MPI_COMM_WORLD);
- if (file_exist) {
- printf("Error at line %d: file (%s) should not be created\n", __LINE__, filename);
- nerrs++;
+ if (rank == 0) {
+ if (access(filename, F_OK) == 0) {
+ printf("Error at line %d: file (%s) should not be created\n",
+ __LINE__, filename);
+ nerrs++;
+ /* delete the file and ignore error */
+ unlink(filename);
+ }
+ /* else : file does not exist */
}
-
- /* delete the file and ignore error */
- unlink(filename);
MPI_Barrier(MPI_COMM_WORLD);
/* Collectively opening a non-existing file for read, expect error code
* NC_ENOENT on all processes */
err = ncmpi_open(MPI_COMM_WORLD, filename, NC_NOWRITE, MPI_INFO_NULL, &ncid);
- /* older version of OpenMPI and MPICH may return MPI_ERR_IO instead of MPI_ERR_NO_SUCH_FILE */
+ /* older version of OpenMPI and MPICH may return MPI_ERR_IO instead of
+ * MPI_ERR_NO_SUCH_FILE */
EXPECT_ERR2(NC_ENOENT, NC_EFILE)
- file_exist = 0;
- if (rank == 0 && access(filename, F_OK) == 0) file_exist = 1;
- MPI_Bcast(&file_exist, 1, MPI_INT, 0, MPI_COMM_WORLD);
- if (file_exist) {
- printf("Error at line %d: file (%s) should not be created\n", __LINE__, filename);
- nerrs++;
+ /* The file should not be created */
+ if (rank == 0) {
+ if (access(filename, F_OK) == 0) {
+ printf("Error at line %d: file (%s) should not be created\n",
+ __LINE__, filename);
+ nerrs++;
+ /* delete the file and ignore error */
+ unlink(filename);
+ }
+ /* else : file does not exist */
}
-
- /* delete the file and ignore error */
- unlink(filename);
MPI_Barrier(MPI_COMM_WORLD);
/* Collectively opening a non-existing file for write, expect error code
* NC_ENOENT on all processes */
err = ncmpi_open(MPI_COMM_WORLD, filename, NC_WRITE, MPI_INFO_NULL, &ncid);
- /* older version of OpenMPI and MPICH may return MPI_ERR_IO instead of MPI_ERR_NO_SUCH_FILE */
+ /* older version of OpenMPI and MPICH may return MPI_ERR_IO instead of
+ * MPI_ERR_NO_SUCH_FILE */
EXPECT_ERR2(NC_ENOENT, NC_EFILE)
- file_exist = 0;
- if (rank == 0 && access(filename, F_OK) == 0) file_exist = 1;
- MPI_Bcast(&file_exist, 1, MPI_INT, 0, MPI_COMM_WORLD);
- if (file_exist) {
- printf("Error at line %d: file (%s) should not be created\n", __LINE__, filename);
- nerrs++;
+ /* The file should not be created */
+ if (rank == 0) {
+ if (access(filename, F_OK) == 0) {
+ printf("Error at line %d: file (%s) should not be created\n",
+ __LINE__, filename);
+ nerrs++;
+ /* delete the file and ignore error */
+ unlink(filename);
+ }
+ /* else : file does not exist */
}
-
- /* delete the file and ignore error */
- unlink(filename);
+ MPI_Barrier(MPI_COMM_WORLD);
return nerrs;
}
@@ -125,14 +131,15 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for file create/open modes ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for file create/open modes ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* test under safe mode enabled */
diff --git a/test/testcases/ncmpi_vars_null_stride.c b/test/testcases/ncmpi_vars_null_stride.c
index d0d302f..b20b902 100644
--- a/test/testcases/ncmpi_vars_null_stride.c
+++ b/test/testcases/ncmpi_vars_null_stride.c
@@ -2,12 +2,13 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: ncmpi_vars_null_stride.c 2453 2016-06-23 18:59:04Z wkliao $
+ * $Id: ncmpi_vars_null_stride.c 2744 2016-12-28 16:25:22Z wkliao $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -35,12 +36,12 @@
int main(int argc, char **argv)
{
+ char filename[256];
int err, nerrs=0, ncid, dimid[NDIMS], varid[5], ndims=NDIMS;
int i, j, k, nprocs, rank, req, *buf;
MPI_Offset start[NDIMS] = {0};
MPI_Offset count[NDIMS] = {0};
MPI_Offset stride[NDIMS] = {0};
- char *filename="testfile.nc";
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -51,12 +52,14 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for NULL stride ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for NULL stride ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
err = ncmpi_create(MPI_COMM_WORLD, filename, 0, MPI_INFO_NULL, &ncid);
diff --git a/test/testcases/noclobber.c b/test/testcases/noclobber.c
index f7e9a82..e2e0550 100644
--- a/test/testcases/noclobber.c
+++ b/test/testcases/noclobber.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: noclobber.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: noclobber.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -33,14 +34,15 @@ int main(int argc, char **argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for NC_NOCLOBBER and NC_EEXIST ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for NC_NOCLOBBER and NC_EEXIST ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
/* create a file if it does not exist */
diff --git a/test/testcases/nonblocking.c b/test/testcases/nonblocking.c
index b840f28..8547d29 100644
--- a/test/testcases/nonblocking.c
+++ b/test/testcases/nonblocking.c
@@ -2,7 +2,7 @@
* Copyright (C) 2013, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: nonblocking.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: nonblocking.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -61,14 +62,15 @@ int main(int argc, char **argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for using ncmpi_iput_vara_int() ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for using ncmpi_iput_vara_int() ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
MPI_Info_create(&info);
diff --git a/test/testcases/one_record.c b/test/testcases/one_record.c
index 23d93e4..1e84e40 100644
--- a/test/testcases/one_record.c
+++ b/test/testcases/one_record.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: one_record.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: one_record.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -31,12 +32,12 @@
/*----< main() >------------------------------------------------------------*/
int main(int argc, char **argv)
{
+ char filename[256];
int i, err, nerrs=0, rank, nprocs, cmode;
int ncid, dimids[2], varid;
char data[NUM_VALS][STR_LEN + 1], data_in[NUM_VALS*STR_LEN];
MPI_Offset start[2];
MPI_Offset count[2];
- char *filename="testfile.nc";
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -47,18 +48,19 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for only one record variable ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for only one record variable ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
strcpy(data[0], "2005-04-11_12:00:00"); /* 19 bytes not a multiply of 4 */
strcpy(data[1], "2005-04-11_13:00:00");
- cmode = NC_CLOBBER | NC_64BIT_DATA;
cmode = NC_CLOBBER;
err = ncmpi_create(MPI_COMM_WORLD, filename, cmode, MPI_INFO_NULL, &ncid); ERR
diff --git a/test/testcases/put_parameter.f b/test/testcases/put_parameter.f
index fd0f33e..402daf6 100644
--- a/test/testcases/put_parameter.f
+++ b/test/testcases/put_parameter.f
@@ -3,7 +3,7 @@
! Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: put_parameter.f 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: put_parameter.f 2638 2016-11-18 14:51:02Z wkliao $
! This example tests PnetCDF's avoiding in-place Endianness byte swap when
! the user's write buffer is immutable, i.e. defined as PARAMETER.
@@ -154,7 +154,7 @@
if (rank .EQ. 0 .AND. sum_size .GT. 0)
+ print 998,
+ 'heap memory allocated by PnetCDF internally has ',
- + sum_size/1048576, ' MiB yet to be freed'
+ + sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/record.c b/test/testcases/record.c
index 2f3bfdf..a2fd0d8 100644
--- a/test/testcases/record.c
+++ b/test/testcases/record.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: record.c 2219 2015-12-11 22:30:03Z wkliao $
+ * $Id: record.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -38,7 +39,7 @@ static
int test_only_record_var_1D(char *filename)
{
int ncid, cmode, varid, dimid, buf[20], err, nerrs=0;
- MPI_Offset start, count, length;
+ MPI_Offset start[1], count[1], length;
MPI_Info info=MPI_INFO_NULL;
/* create a new file for writing ----------------------------------------*/
@@ -52,13 +53,13 @@ int test_only_record_var_1D(char *filename)
/* write the 2nd record first */
buf[0] = 91;
- start = 1; count = 1;
- err = ncmpi_put_vara_int_all(ncid, varid, &start, &count, buf); ERR
+ start[0] = 1; count[0] = 1;
+ err = ncmpi_put_vara_int_all(ncid, varid, start, count, buf); ERR
/* write the 1st record now */
buf[0] = 90;
- start = 0; count = 1;
- err = ncmpi_put_vara_int_all(ncid, varid, &start, &count, buf); ERR
+ start[0] = 0; count[0] = 1;
+ err = ncmpi_put_vara_int_all(ncid, varid, start, count, buf); ERR
err = ncmpi_inq_dimlen(ncid, dimid, &length); ERR
if (length != 2) {
@@ -70,13 +71,13 @@ int test_only_record_var_1D(char *filename)
err = ncmpi_begin_indep_data(ncid); ERR
/* write the 4th record */
buf[0] = 93;
- start = 3; count = 1;
- err = ncmpi_put_vara_int(ncid, varid, &start, &count, buf); ERR
+ start[0] = 3; count[0] = 1;
+ err = ncmpi_put_vara_int(ncid, varid, start, count, buf); ERR
/* write the 3rd record */
buf[0] = 92; buf[1] = 93;
- start = 2; count = 2;
- err = ncmpi_put_vara_int(ncid, varid, &start, &count, buf); ERR
+ start[0] = 2; count[0] = 2;
+ err = ncmpi_put_vara_int(ncid, varid, start, count, buf); ERR
err = ncmpi_inq_dimlen(ncid, dimid, &length); ERR
if (length != 4) {
@@ -249,7 +250,7 @@ int test_two_record_var(char *filename)
}
int main(int argc, char** argv) {
- char *filename="testfile.nc";
+ char filename[256];
int nerrs=0, rank, nprocs, err;
MPI_Init(&argc, &argv);
@@ -260,12 +261,14 @@ int main(int argc, char** argv) {
if (!rank) printf("Usage: %s [filename]\n",argv[0]);
goto fn_exit;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for write records in reversed order", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for write records in reversed order", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
if (rank >= 1) goto fn_exit; /* this test is for running 1 process */
diff --git a/test/testcases/redef1.c b/test/testcases/redef1.c
index d397813..a75ba41 100644
--- a/test/testcases/redef1.c
+++ b/test/testcases/redef1.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: redef1.c 2465 2016-09-01 18:07:56Z wkliao $
+ * $Id: redef1.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -33,8 +34,8 @@
int main(int argc, char** argv)
{
- char filename[256]="redef1.nc";
- int i, j, k, commsize, rank, ncid, verbose=0, err, nerrs=0;
+ char filename[256];
+ int i, j, k, commsize, rank, ncid, err, nerrs=0;
int dim0id, dim1id, dim5id, dim9id, dim2id, dimsid[2], dims2id[2];
int varid, var3id, var4id, var2id;
int *data;
@@ -52,16 +53,20 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "redef2.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for entering re-define mode ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for entering re-define mode ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- if (commsize > 1 && rank == 0 && verbose)
+#ifdef DEBUG
+ if (commsize > 1 && rank == 0)
printf("Warning: %s is designed to run on 1 process\n",argv[0]);
+#endif
err = ncmpi_create(comm, filename, NC_CLOBBER|NC_64BIT_OFFSET,
MPI_INFO_NULL, &ncid);
diff --git a/test/testcases/scalar.c b/test/testcases/scalar.c
index 19403fb..abc4d71 100644
--- a/test/testcases/scalar.c
+++ b/test/testcases/scalar.c
@@ -2,7 +2,7 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: scalar.c 2347 2016-03-09 23:00:53Z wkliao $
+ * $Id: scalar.c 2744 2016-12-28 16:25:22Z wkliao $
*
* Check if arguments start, count, stride, and imap are properly ignored
* when get/put a scalar variable.
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -24,10 +25,10 @@
/*----< main() >------------------------------------------------------------*/
int main(int argc, char **argv)
{
- int err, nerrs=0, rank, nprocs, verbose, ncid, varid;
+ int err, nerrs=0, rank, nprocs, ncid, varid;
MPI_Offset start[1], count[1], stride[1], imap[1];
int buf;
- char *filename="testfile.nc";
+ char filename[256];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -38,17 +39,20 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for get/put scalar variables ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for get/put scalar variables ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- verbose = 0;
- if (nprocs > 1 && rank == 0 && verbose)
+#ifdef DEBUG
+ if (nprocs > 1 && rank == 0)
printf("Warning: %s is designed to run on 1 process\n", argv[0]);
+#endif
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER | NC_64BIT_DATA,
MPI_INFO_NULL, &ncid); ERR
diff --git a/test/testcases/test_erange.c b/test/testcases/test_erange.c
index f65467a..9d02a91 100644
--- a/test/testcases/test_erange.c
+++ b/test/testcases/test_erange.c
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -42,9 +43,9 @@ static
int test_cdf2(char *filename)
{
int err, nerrs=0, ncid, vid, dimid;
- unsigned char uc;
- signed char sc;
- int si;
+ unsigned char uc[1];
+ signed char sc[1];
+ int si[1];
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid); ERR
@@ -54,20 +55,20 @@ int test_cdf2(char *filename)
* In brief, NC_BYTE is signed in all signed CDF-2 APIs, and unsigned in
* all unsigned APIs. In CDF-2, there is only one unsigned API, _uchar.
*/
- uc = 255;
- err = ncmpi_put_att_uchar(ncid, NC_GLOBAL, "att1", NC_BYTE, 1, &uc); ERR
- uc = 0; /* initialize with a number that is not 0 */
- err = ncmpi_get_att_uchar(ncid, NC_GLOBAL, "att1", &uc); ERR
- if (uc != 255) {
- printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc);
+ uc[0] = 255;
+ err = ncmpi_put_att_uchar(ncid, NC_GLOBAL, "att1", NC_BYTE, 1, uc); ERR
+ uc[0] = 0; /* initialize with a number that is not 0 */
+ err = ncmpi_get_att_uchar(ncid, NC_GLOBAL, "att1", uc); ERR
+ if (uc[0] != 255) {
+ printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc[0]);
nerrs++;
}
- sc = 3; /* initialize with a number that is not -1 or -0 */
+ sc[0] = 3; /* initialize with a number that is not -1 or -0 */
/* No NC_ERANGE as the internal and external types are considered the same */
- err = ncmpi_get_att_schar(ncid, NC_GLOBAL, "att1", &sc); ERR
- if ( sc != -1 /* 2-complement bit representation */
- && sc != -0) { /* 1-complement bit representation */
- printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc);
+ err = ncmpi_get_att_schar(ncid, NC_GLOBAL, "att1", sc); ERR
+ if ( sc[0] != -1 /* 2-complement bit representation */
+ && sc[0] != -0) { /* 1-complement bit representation */
+ printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc[0]);
nerrs++;
}
@@ -76,48 +77,48 @@ int test_cdf2(char *filename)
err = ncmpi_enddef(ncid); ERR
/* No NC_ERANGE should be returned for CDF-1 and 2 */
- uc = 255;
- err = ncmpi_put_var_uchar_all(ncid, vid, &uc); ERR
- uc = 3; /* initialize with a number that is not -1 or -0 */
- err = ncmpi_get_var_uchar_all(ncid, vid, &uc); ERR
- if (uc != 255) {
- printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc);
+ uc[0] = 255;
+ err = ncmpi_put_var_uchar_all(ncid, vid, uc); ERR
+ uc[0] = 3; /* initialize with a number that is not -1 or -0 */
+ err = ncmpi_get_var_uchar_all(ncid, vid, uc); ERR
+ if (uc[0] != 255) {
+ printf("Error at line %d: unexpected read value %d (expecting 255)\n",__LINE__,(int)uc[0]);
nerrs++;
}
/* No NC_ERANGE should be returned for CDF-1 and 2 */
- sc = -128;
- err = ncmpi_put_var_schar_all(ncid, vid, &sc); ERR
- sc = 0;
- err = ncmpi_get_var_schar_all(ncid, vid, &sc); ERR
- if (sc != -128) {
- printf("Error at line %d: unexpected read value %d (expecting -128)\n",__LINE__,(int)sc);
+ sc[0] = -128;
+ err = ncmpi_put_var_schar_all(ncid, vid, sc); ERR
+ sc[0] = 0;
+ err = ncmpi_get_var_schar_all(ncid, vid, sc); ERR
+ if (sc[0] != -128) {
+ printf("Error at line %d: unexpected read value %d (expecting -128)\n",__LINE__,(int)sc[0]);
nerrs++;
}
/* expect NC_ERANGE */
- si = -129;
- err = ncmpi_put_var_int_all(ncid, vid, &si); EXPECT_ERR
- if (si != -129) { /* check if put buffer content is altered */
- printf("Error at line %d: put buffer content altered %d (expecting -128)\n",__LINE__,si);
+ si[0] = -129;
+ err = ncmpi_put_var_int_all(ncid, vid, si); EXPECT_ERR
+ if (si[0] != -129) { /* check if put buffer content is altered */
+ printf("Error at line %d: put buffer content altered %d (expecting -128)\n",__LINE__,si[0]);
nerrs++;
}
/* expect NC_ERANGE */
- si = 256;
- err = ncmpi_put_var_int_all(ncid, vid, &si); EXPECT_ERR
- if (si != 256) { /* check if put buffer content is altered */
- printf("Error at line %d: put buffer content altered %d (expecting 256)\n",__LINE__,si);
+ si[0] = 256;
+ err = ncmpi_put_var_int_all(ncid, vid, si); EXPECT_ERR
+ if (si[0] != 256) { /* check if put buffer content is altered */
+ printf("Error at line %d: put buffer content altered %d (expecting 256)\n",__LINE__,si[0]);
nerrs++;
}
/* expect no error */
- si = -128;
- err = ncmpi_put_var_int_all(ncid, vid, &si); ERR
- si = 0;
- err = ncmpi_get_var_int_all(ncid, vid, &si); ERR
- if (si != -128) {
- printf("Error at line %d: unexpected read value %d (expecting -128)\n",__LINE__,si);
+ si[0] = -128;
+ err = ncmpi_put_var_int_all(ncid, vid, si); ERR
+ si[0] = 0;
+ err = ncmpi_get_var_int_all(ncid, vid, si); ERR
+ if (si[0] != -128) {
+ printf("Error at line %d: unexpected read value %d (expecting -128)\n",__LINE__,si[0]);
nerrs++;
}
@@ -130,8 +131,8 @@ static
int test_cdf5(char *filename)
{
int err, nerrs=0, ncid, uc_vid, sc_vid, dimid;
- unsigned char uc;
- signed char sc;
+ unsigned char uc[1];
+ signed char sc[1];
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER|NC_64BIT_DATA, MPI_INFO_NULL, &ncid); ERR
@@ -140,36 +141,36 @@ int test_cdf5(char *filename)
* NC_ERANGE checking for converting between NC_BYTE and unsigned
* char is no longer held.
*/
- uc = 255;
- err = ncmpi_put_att_uchar(ncid, NC_GLOBAL, "att1", NC_UBYTE, 1, &uc); ERR
+ uc[0] = 255;
+ err = ncmpi_put_att_uchar(ncid, NC_GLOBAL, "att1", NC_UBYTE, 1, uc); ERR
/* in CDF-5, get 255 to a schar buffer should result in NC_ERANGE */
- err = ncmpi_get_att_schar(ncid, NC_GLOBAL, "att1", &sc); EXPECT_ERR
+ err = ncmpi_get_att_schar(ncid, NC_GLOBAL, "att1", sc); EXPECT_ERR
- sc = -1; /* a value should cause NC_ERANGE */
- err = ncmpi_put_att_schar(ncid, NC_GLOBAL, "att2", NC_UBYTE, 1, &sc); EXPECT_ERR
+ sc[0] = -1; /* a value should cause NC_ERANGE */
+ err = ncmpi_put_att_schar(ncid, NC_GLOBAL, "att2", NC_UBYTE, 1, sc); EXPECT_ERR
err = ncmpi_def_dim(ncid, "x", 1, &dimid); ERR
err = ncmpi_def_var(ncid, "var_ubyte", NC_UBYTE, 1, &dimid, &uc_vid); ERR
err = ncmpi_def_var(ncid, "var_byte", NC_BYTE, 1, &dimid, &sc_vid); ERR
err = ncmpi_enddef(ncid); ERR
- uc = 255;
- err = ncmpi_put_var_uchar_all(ncid, uc_vid, &uc); ERR
+ uc[0] = 255;
+ err = ncmpi_put_var_uchar_all(ncid, uc_vid, uc); ERR
/* in CDF-5, get 255 to an schar should result in NC_ERANGE */
- err = ncmpi_get_var_schar_all(ncid, uc_vid, &sc); EXPECT_ERR
+ err = ncmpi_get_var_schar_all(ncid, uc_vid, sc); EXPECT_ERR
- sc = -1; /* in CDF-5, put -1 to an uchar should result in NC_ERANGE */
- err = ncmpi_put_var_schar_all(ncid, uc_vid, &sc); EXPECT_ERR
+ sc[0] = -1; /* in CDF-5, put -1 to an uchar should result in NC_ERANGE */
+ err = ncmpi_put_var_schar_all(ncid, uc_vid, sc); EXPECT_ERR
- uc = 255; /* in CDF-5, put 255 to a schar should result in NC_ERANGE */
- err = ncmpi_put_var_uchar_all(ncid, sc_vid, &uc); EXPECT_ERR
+ uc[0] = 255; /* in CDF-5, put 255 to a schar should result in NC_ERANGE */
+ err = ncmpi_put_var_uchar_all(ncid, sc_vid, uc); EXPECT_ERR
- sc = -1;
- err = ncmpi_put_var_schar_all(ncid, sc_vid, &sc); ERR
- uc = 0; /* in CDF-5, get -1 to an uchar should result in NC_ERANGE */
- err = ncmpi_get_var_uchar_all(ncid, sc_vid, &uc); EXPECT_ERR
+ sc[0] = -1;
+ err = ncmpi_put_var_schar_all(ncid, sc_vid, sc); ERR
+ uc[0] = 0; /* in CDF-5, get -1 to an uchar should result in NC_ERANGE */
+ err = ncmpi_get_var_uchar_all(ncid, sc_vid, uc); EXPECT_ERR
err = ncmpi_close(ncid); ERR
@@ -189,14 +190,15 @@ int main(int argc, char* argv[])
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for checking for NC_ERANGE ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for checking for NC_ERANGE ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
nerrs += test_cdf2(filename);
diff --git a/test/testcases/test_vard.c b/test/testcases/test_vard.c
index 32b6169..bac4a5a 100644
--- a/test/testcases/test_vard.c
+++ b/test/testcases/test_vard.c
@@ -2,7 +2,7 @@
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: test_vard.c 2379 2016-03-28 21:43:38Z wkliao $
+ * $Id: test_vard.c 2744 2016-12-28 16:25:22Z wkliao $
*/
/*
@@ -47,6 +47,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -152,7 +153,7 @@ int main(int argc, char **argv) {
char filename[256];
int i, j, err, ncid, varid0, varid1, varid2, dimids[2], nerrs=0;
- int rank, nprocs, debug=0, blocklengths[2], **buf, *bufptr;
+ int rank, nprocs, blocklengths[2], **buf, *bufptr;
int array_of_sizes[2], array_of_subsizes[2], array_of_starts[2];
int buftype_size, expected_put_size, format;
MPI_Offset start[2], count[2], header_size, put_size, new_put_size;
@@ -168,14 +169,15 @@ int main(int argc, char **argv) {
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for flexible put and get ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for flexible put and get ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
buf = (int**)malloc(NY * sizeof(int*));
@@ -197,7 +199,6 @@ int main(int argc, char **argv) {
start[0] = 0; start[1] = NX*rank;
count[0] = 2; count[1] = NX;
- if (debug) printf("put start=%lld %lld count=%lld %lld\n",start[0],start[1],count[0],count[1]);
/* create a file type for the fixed-size variable */
array_of_sizes[0] = 2;
diff --git a/test/testcases/test_vardf.F b/test/testcases/test_vardf.F
index f5947bd..3f22f79 100644
--- a/test/testcases/test_vardf.F
+++ b/test/testcases/test_vardf.F
@@ -2,7 +2,7 @@
! Copyright (C) 2014, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_vardf.F 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: test_vardf.F 2638 2016-11-18 14:51:02Z wkliao $
!
! This program tests the vard API.
@@ -381,7 +381,7 @@
if (rank .EQ. 0 .AND. sum_size .GT. 0)
+ print 998,
+ 'heap memory allocated by PnetCDF internally has ',
- + sum_size/1048576, ' MiB yet to be freed'
+ + sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/test_vardf90.f90 b/test/testcases/test_vardf90.f90
index a423d09..04bc76b 100644
--- a/test/testcases/test_vardf90.f90
+++ b/test/testcases/test_vardf90.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2014, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: test_vardf90.f90 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: test_vardf90.f90 2639 2016-11-18 15:06:10Z wkliao $
!
! This program tests the vard API.
@@ -361,7 +361,7 @@
MPI_SUM, 0, MPI_COMM_WORLD, ierr)
if (rank .EQ. 0 .AND. sum_size .GT. 0_MPI_OFFSET_KIND) print 998, &
'heap memory allocated by PnetCDF internally has ', &
- sum_size/1048576, ' MiB yet to be freed'
+ sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/test_varm.c b/test/testcases/test_varm.c
index 91fee12..9ade07d 100644
--- a/test/testcases/test_varm.c
+++ b/test/testcases/test_varm.c
@@ -2,12 +2,13 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: test_varm.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: test_varm.c 2744 2016-12-28 16:25:22Z wkliao $
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h> /* basename() */
#include <pnetcdf.h>
#include <testutils.h>
@@ -20,14 +21,14 @@
/*----< main() >------------------------------------------------------------*/
int main(int argc, char **argv)
{
- int i, j, err, nerrs=0, rank, nprocs, verbose;
+ int i, j, err, nerrs=0, rank, nprocs;
int ncid, dimid[2], varid, req, status;
MPI_Offset start[2], count[2], stride[2], imap[2];
int var[6][4];
float rh[4][6];
signed char varT[4][6];
- char *filename="testfile.nc";
+ char filename[256];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -38,17 +39,20 @@ int main(int argc, char **argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for get/put varm ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for get/put varm ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- verbose = 0;
- if (nprocs > 1 && rank == 0 && verbose)
+#ifdef DEBUG
+ if (nprocs > 1 && rank == 0)
printf("Warning: %s is designed to run on 1 process\n", argv[0]);
+#endif
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER | NC_64BIT_DATA,
MPI_INFO_NULL, &ncid); ERR
diff --git a/test/testcases/varn_contig.c b/test/testcases/varn_contig.c
index 04b55e5..64ad4c8 100644
--- a/test/testcases/varn_contig.c
+++ b/test/testcases/varn_contig.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: varn_contig.c 2219 2015-12-11 22:30:03Z wkliao $ */
+/* $Id: varn_contig.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests using a single call of ncmpi_put_varn_int_all() to
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy(), memset() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -74,7 +75,7 @@ int check_contents_for_fail(int *buffer)
int main(int argc, char** argv)
{
char filename[256];
- int i, rank, nprocs, err, verbose=0, nerrs=0;
+ int i, rank, nprocs, err, nerrs=0;
int ncid, cmode, varid[3], dimid[2], num_reqs, *buffer, *r_buffer;
MPI_Offset w_len, **starts, **counts;
@@ -87,18 +88,21 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for put_varn with contig fileview", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for put_varn with contig fileview", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- if (verbose && nprocs != 4 && rank == 0)
+#ifdef DEBUG
+ if (nprocs != 4 && rank == 0)
printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+#endif
/* create a new file for writing ----------------------------------------*/
cmode = NC_CLOBBER | NC_64BIT_DATA;
diff --git a/test/testcases/varn_int.c b/test/testcases/varn_int.c
index 81f7bab..a57ea28 100644
--- a/test/testcases/varn_int.c
+++ b/test/testcases/varn_int.c
@@ -4,7 +4,7 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
-/* $Id: varn_int.c 2399 2016-04-17 18:59:32Z wkliao $ */
+/* $Id: varn_int.c 2744 2016-12-28 16:25:22Z wkliao $ */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example tests using a single call of ncmpi_put_varn_int_all() to
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcpy(), memset() */
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -91,7 +92,7 @@ void permute(MPI_Offset a[NDIMS], MPI_Offset b[NDIMS])
int main(int argc, char** argv)
{
char filename[256];
- int i, j, rank, nprocs, err, verbose=0, nerrs=0;
+ int i, j, rank, nprocs, err, nerrs=0;
int ncid, cmode, varid[3], dimid[2], num_reqs, *buffer, *r_buffer;
MPI_Offset w_len, **starts, **counts;
@@ -104,18 +105,21 @@ int main(int argc, char** argv)
MPI_Finalize();
return 0;
}
- strcpy(filename, "testfile.nc");
- if (argc == 2) strcpy(filename, argv[1]);
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
MPI_Bcast(filename, 256, MPI_CHAR, 0, MPI_COMM_WORLD);
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for ncmpi_put_varn_int_all() ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for ncmpi_put_varn_int_all() ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- if (verbose && nprocs != 4 && rank == 0)
+#ifdef DEBUG
+ if (nprocs != 4 && rank == 0)
printf("Warning: %s is intended to run on 4 processes\n",argv[0]);
+#endif
/* create a new file for writing ----------------------------------------*/
cmode = NC_CLOBBER | NC_64BIT_DATA;
diff --git a/test/testcases/varn_intf.f b/test/testcases/varn_intf.f
index c6b81f6..91c49e8 100644
--- a/test/testcases/varn_intf.f
+++ b/test/testcases/varn_intf.f
@@ -2,7 +2,7 @@
! Copyright (C) 2013, Northwestern University
! See COPYRIGHT notice in top-level directory.
!
-! $Id: varn_intf.f 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: varn_intf.f 2638 2016-11-18 14:51:02Z wkliao $
! This example shows how to use a single call of nfmpi_put_varn_int_all() to
! write a sequence of requests with arbitrary array indices and lengths.
@@ -277,7 +277,7 @@
if (rank .EQ. 0 .AND. sum_size .GT. 0)
+ print 998,
+ 'heap memory allocated by PnetCDF internally has ',
- + sum_size/1048576, ' MiB yet to be freed'
+ + sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/varn_real.f90 b/test/testcases/varn_real.f90
index 09c9813..3aaeebc 100644
--- a/test/testcases/varn_real.f90
+++ b/test/testcases/varn_real.f90
@@ -2,7 +2,7 @@
! Copyright (C) 2012, Northwestern University and Argonne National Laboratory
! See COPYRIGHT notice in top-level directory.
!
-! $Id: varn_real.f90 2512 2016-09-29 01:29:37Z wkliao $
+! $Id: varn_real.f90 2638 2016-11-18 14:51:02Z wkliao $
!
! This example shows how to use a single call of nf90mpi_put_varn_all()
@@ -287,7 +287,7 @@
MPI_SUM, 0, MPI_COMM_WORLD, ierr)
if (rank .EQ. 0 .AND. sum_size .GT. 0_MPI_OFFSET_KIND) print 998, &
'heap memory allocated by PnetCDF internally has ', &
- sum_size/1048576, ' MiB yet to be freed'
+ sum_size, ' bytes yet to be freed'
endif
if (rank .eq. 0) then
diff --git a/test/testcases/vectors.c b/test/testcases/vectors.c
index 69b68e0..2ca8dd2 100644
--- a/test/testcases/vectors.c
+++ b/test/testcases/vectors.c
@@ -2,12 +2,13 @@
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*
- * $Id: vectors.c 2133 2015-09-26 19:16:01Z wkliao $
+ * $Id: vectors.c 2744 2016-12-28 16:25:22Z wkliao $
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
+#include <libgen.h> /* basename() */
#include <mpi.h>
#include <pnetcdf.h>
@@ -20,14 +21,14 @@
#define STRIDE 5
int main(int argc, char ** argv)
{
- int ncid, dimid, varid, rank, nprocs, verbose;
+ int ncid, dimid, varid, rank, nprocs;
MPI_Datatype vtype, rtype, usertype;
MPI_Aint lb, extent;
int userbufsz, *userbuf, *cmpbuf, i, err, errs=0, nerrs=0;
int count = 25;
double pi = 3.14159;
MPI_Offset start, acount;
- char *filename="testfile.nc";
+ char filename[256];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -38,17 +39,20 @@ int main(int argc, char ** argv)
MPI_Finalize();
return 0;
}
- if (argc == 2) filename = argv[1];
+ if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+ else strcpy(filename, "testfile.nc");
if (rank == 0) {
- char cmd_str[256];
- sprintf(cmd_str, "*** TESTING C %s for put_vara/get_vara ", argv[0]);
+ char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+ sprintf(cmd_str, "*** TESTING C %s for put_vara/get_vara ", basename(argv[0]));
printf("%-66s ------ ", cmd_str); fflush(stdout);
+ free(cmd_str);
}
- verbose = 0;
- if (nprocs > 2 && rank == 0 && verbose)
+#ifdef DEBUG
+ if (nprocs > 2 && rank == 0)
printf("Warning: %s is designed to run on 1 process\n",argv[0]);
+#endif
err = ncmpi_create(MPI_COMM_WORLD, filename, NC_CLOBBER, MPI_INFO_NULL, &ncid);
HANDLE_ERR(err)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pnetcdf.git
More information about the debian-science-commits
mailing list