How do I test if PIO is installed and working correctly?
- The PIO Library distribution contains a testpio subdirectory with a number of programs to test the PIO library. Please see the \ref examp page for details.
+ The PIO Library distribution contains tests for PIO. They are run my 'make check'. The tests use mpiexec to run tests on 4, 8, or 16 processors.
*/
diff --git a/examples/c/darray_no_async.c b/examples/c/darray_no_async.c
index 126adcd5ba0..784612acdcf 100644
--- a/examples/c/darray_no_async.c
+++ b/examples/c/darray_no_async.c
@@ -6,7 +6,7 @@
* (one unlimited) and one variable. It first writes, then reads the
* sample file using distributed arrays.
*
- * This example can be run in parallel for 4 processors.
+ * This example can be run in parallel for 16 processors.
*/
#include "config.h"
@@ -32,10 +32,10 @@
#define NUM_TIMESTEPS 2
/* The length of our sample data in X dimension.*/
-#define DIM_LEN_X 4
+#define DIM_LEN_X 8
/* The length of our sample data in Y dimension.*/
-#define DIM_LEN_Y 4
+#define DIM_LEN_Y 8
/* The name of the variable in the netCDF output file. */
#define VAR_NAME "foo"
@@ -48,7 +48,7 @@
#define START_DATA_VAL 42
/* Number of tasks this example runs on. */
-#define TARGET_NTASKS 4
+#define TARGET_NTASKS 16
/* Logging level. */
#define LOG_LEVEL -1
@@ -59,6 +59,11 @@ int dim_len[NDIM3] = {NC_UNLIMITED, DIM_LEN_X, DIM_LEN_Y};
/* Names of dimensions. */
char dim_name[NDIM3][PIO_MAX_NAME + 1] = {"unlimted", "x", "y"};
+/* These are used when writing the decomposition file. */
+#define DECOMP_FILENAME "darray_no_async_decomp.nc"
+#define DECOMP_TITLE "Example Decomposition from darray_no_async.c"
+#define DECOMP_HISTORY "This file is created by the program darray_no_async in the PIO C library"
+
/* Handle MPI errors. This should only be used with MPI library
* function calls. */
#define MPIERR(e) do { \
@@ -180,25 +185,33 @@ int check_file(int iosysid, int ntasks, char *filename, int iotype,
has the following contents (as shown by ncdump):
- netcdf darray_no_async_iotype_1 {
- dimensions:
- unlimted = UNLIMITED ; // (2 currently)
- x = 4 ;
- y = 4 ;
- variables:
- int foo(unlimted, x, y) ;
- data:
-
- foo =
- 42, 42, 42, 42,
- 43, 43, 43, 43,
- 44, 44, 44, 44,
- 45, 45, 45, 45,
- 142, 142, 142, 142,
- 143, 143, 143, 143,
- 144, 144, 144, 144,
- 145, 145, 145, 145 ;
- }
+netcdf darray_no_async_iotype_1 {
+dimensions:
+ unlimted = UNLIMITED ; // (2 currently)
+ x = 8 ;
+ y = 8 ;
+variables:
+ int foo(unlimted, x, y) ;
+data:
+
+ foo =
+ 42, 42, 42, 42, 43, 43, 43, 43,
+ 44, 44, 44, 44, 45, 45, 45, 45,
+ 46, 46, 46, 46, 47, 47, 47, 47,
+ 48, 48, 48, 48, 49, 49, 49, 49,
+ 50, 50, 50, 50, 51, 51, 51, 51,
+ 52, 52, 52, 52, 53, 53, 53, 53,
+ 54, 54, 54, 54, 55, 55, 55, 55,
+ 56, 56, 56, 56, 57, 57, 57, 57,
+ 142, 142, 142, 142, 143, 143, 143, 143,
+ 144, 144, 144, 144, 145, 145, 145, 145,
+ 146, 146, 146, 146, 147, 147, 147, 147,
+ 148, 148, 148, 148, 149, 149, 149, 149,
+ 150, 150, 150, 150, 151, 151, 151, 151,
+ 152, 152, 152, 152, 153, 153, 153, 153,
+ 154, 154, 154, 154, 155, 155, 155, 155,
+ 156, 156, 156, 156, 157, 157, 157, 157 ;
+}
*/
@@ -239,7 +252,7 @@ int main(int argc, char* argv[])
/* Check that a valid number of processors was specified. */
if (ntasks != TARGET_NTASKS)
- fprintf(stderr, "Number of processors must be 4!\n");
+ fprintf(stderr, "Number of processors must be 16!\n");
printf("%d: ParallelIO Library darray_no_async example running on %d processors.\n",
my_rank, ntasks);
@@ -253,7 +266,7 @@ int main(int argc, char* argv[])
/* Initialize the PIO IO system. This specifies how many and
* which processors are involved in I/O. */
- if ((ret = PIOc_Init_Intracomm(MPI_COMM_WORLD, 1, ioproc_stride,
+ if ((ret = PIOc_Init_Intracomm(MPI_COMM_WORLD, 4, ioproc_stride,
ioproc_start, PIO_REARR_BOX, &iosysid)))
ERR(ret);
@@ -268,9 +281,15 @@ int main(int argc, char* argv[])
/* Create the PIO decomposition for this example. Since this
* is a variable with an unlimited dimension, we want to
* create a 2-D composition which represents one record. */
- printf("rank: %d Creating decomposition...\n", my_rank);
+ printf("rank: %d Creating decomposition, elements_per_pe %lld...\n", my_rank,
+ elements_per_pe);
if ((ret = PIOc_init_decomp(iosysid, PIO_INT, NDIM3 - 1, &dim_len[1], elements_per_pe,
- compdof, &ioid, 0, NULL, NULL)))
+ compdof, &ioid, PIO_REARR_SUBSET, NULL, NULL)))
+ ERR(ret);
+
+ /* Write the decomposition file. */
+ if ((ret = PIOc_write_nc_decomp(iosysid, DECOMP_FILENAME, NC_CLOBBER,
+ ioid, DECOMP_TITLE, DECOMP_HISTORY, 0)))
ERR(ret);
/* The number of favors may change with the build parameters. */
diff --git a/examples/c/run_tests.sh b/examples/c/run_tests.sh
index 1cfb586d292..0d369bbb53d 100755
--- a/examples/c/run_tests.sh
+++ b/examples/c/run_tests.sh
@@ -11,18 +11,32 @@ trap exit INT TERM
printf 'running PIO examples...\n'
#PIO_EXAMPLES='examplePio'
-PIO_EXAMPLES='example1 examplePio darray_no_async'
+PIO_EXAMPLES='example1 examplePio'
+PIO_EXAMPLES_16='darray_no_async'
success1=true
for EXAMPLE in $PIO_EXAMPLES
do
success1=false
echo "running ${EXAMPLE}"
- mpiexec -n 4 ./${EXAMPLE} && success1=true || break
+ mpiexec -n 4 ./${EXAMPLE} && success1=true
+ if test $success1 = false; then
+ break
+ fi
+done
+success2=true
+for EXAMPLE in $PIO_EXAMPLES_16
+do
+ success2=false
+ echo "running ${EXAMPLE}"
+ mpiexec -n 16 ./${EXAMPLE} && success2=true
+ if test $success2 = false; then
+ break
+ fi
done
# Did we succeed?
-if test x$success1 = xtrue; then
+if test x$success1 = xtrue -a x$success2 = xtrue; then
exit 0
fi
exit 1
diff --git a/src/clib/pio.h b/src/clib/pio.h
index d88a4b3f3f6..f5647e364a0 100644
--- a/src/clib/pio.h
+++ b/src/clib/pio.h
@@ -410,7 +410,7 @@ typedef struct iosystem_desc_t
MPI_Comm comp_comm;
/** This is an MPI inter communicator between IO communicator and
- * computation communicator. */
+ * computation communicator, only used for async mode. */
MPI_Comm intercomm;
/** This is a copy (but not an MPI copy) of either the comp (for