diff --git a/src/clib/pio.h b/src/clib/pio.h index d203190042c..b4e2ec206c7 100644 --- a/src/clib/pio.h +++ b/src/clib/pio.h @@ -1259,6 +1259,9 @@ extern "C" { int nc_free_decomp(int ioid); + int nc_put_vard_int(int ncid, int varid, int decompid, const size_t recnum, + const int *op); + #if defined(__cplusplus) } #endif diff --git a/src/ncint/Makefile.am b/src/ncint/Makefile.am index f2761f9409d..3b8ab933f4b 100644 --- a/src/ncint/Makefile.am +++ b/src/ncint/Makefile.am @@ -9,4 +9,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/clib noinst_LTLIBRARIES = libncint.la # The source files. -libncint_la_SOURCES = ncintdispatch.c ncintdispatch.h ncint_pio.c +libncint_la_SOURCES = ncintdispatch.c ncintdispatch.h ncint_pio.c \ +ncint_vard.c diff --git a/tests/ncint/tst_pio_udf.c b/tests/ncint/tst_pio_udf.c index 55758312dd6..de6923b1c76 100644 --- a/tests/ncint/tst_pio_udf.c +++ b/tests/ncint/tst_pio_udf.c @@ -44,6 +44,7 @@ main(int argc, char **argv) NC_Dispatch *disp_in; size_t elements_per_pe; size_t *compdof; /* The decomposition mapping. */ + int *my_data; int i; /* Turn on logging for PIO library. */ @@ -70,9 +71,16 @@ main(int argc, char **argv) /* Create the PIO decomposition for this test. */ if (nc_init_decomp(iosysid, PIO_INT, NDIM2, dimlen, elements_per_pe, - compdof, &ioid, 0, NULL, NULL)) ERR; + compdof, &ioid, 1, NULL, NULL)) ERR; free(compdof); + /* Create some data on this processor. */ + if (!(my_data = malloc(elements_per_pe * sizeof(int)))) ERR; + for (i = 0; i < elements_per_pe; i++) + my_data[i] = my_rank * 10 + i; + + /* Write some data with distributed arrays. */ + if (nc_put_vard_int(ncid, varid, ioid, 0, my_data)) ERR; if (nc_close(ncid)) ERR; /* Check that our user-defined format has been added. */ @@ -83,10 +91,9 @@ main(int argc, char **argv) if (nc_open(FILE_NAME, NC_UDF0, &ncid)) ERR; if (nc_close(ncid)) ERR; - /* Free the decomposition. */ + /* Free resources. */ + free(my_data); if (nc_free_decomp(ioid)) ERR; - - /* Close the iosystem. */ if (nc_free_iosystem(iosysid)) ERR; } SUMMARIZE_ERR;