diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
commit | 727b687ae6c80c9854cb53814fa1c12f27c2994c (patch) | |
tree | fabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /testpar | |
parent | 25486d50895fa4a30809d289b9aff4de583a9b84 (diff) | |
download | hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2 |
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/CMakeLists.txt | 10 | ||||
-rw-r--r-- | testpar/Makefile.am | 5 | ||||
-rw-r--r-- | testpar/Makefile.in | 26 | ||||
-rw-r--r-- | testpar/t_cache.c | 8 | ||||
-rw-r--r-- | testpar/t_file.c | 6 | ||||
-rw-r--r-- | testpar/t_mdset.c | 3 | ||||
-rw-r--r-- | testpar/t_mpi.c | 8 | ||||
-rw-r--r-- | testpar/t_shapesame.c (renamed from testpar/t_rank_projection.c) | 1191 | ||||
-rw-r--r-- | testpar/t_span_tree.c | 3 | ||||
-rw-r--r-- | testpar/testpar.h | 37 | ||||
-rw-r--r-- | testpar/testph5.sh.in | 11 | ||||
-rw-r--r-- | testpar/testphdf5.c | 18 | ||||
-rw-r--r-- | testpar/testphdf5.h | 12 |
13 files changed, 885 insertions, 453 deletions
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index e019689..f6ad731 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -17,24 +17,21 @@ SET (testphdf5_SRCS ${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c - ${HDF5_TEST_PAR_SOURCE_DIR}/t_rank_projection.c ) #-- Adding test for testhdf5 ADD_EXECUTABLE (testphdf5 ${testphdf5_SRCS}) -H5_NAMING (testphdf5) -TARGET_WIN_PROPERTIES (testphdf5) +H5_NAMING (testphdf5 ${LIB_TYPE}) TARGET_LINK_LIBRARIES (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:testphdf5>) MACRO (ADD_H5P_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - H5_NAMING (${file}) - TARGET_WIN_PROPERTIES (${file}) + H5_NAMING (${file} ${LIB_TYPE}) TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}>) + ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}> -p) ENDMACRO (ADD_H5P_TEST file) SET (H5P_TESTS @@ -43,6 +40,7 @@ SET (H5P_TESTS t_cache t_pflush1 t_pflush2 + t_shapesame ) FOREACH (testp ${H5P_TESTS}) diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 6e76e88..5a7a3f3 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -25,15 +25,14 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 +TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 t_shapesame TEST_SCRIPT_PARA=testph5.sh check_PROGRAMS = $(TEST_PROG_PARA) check_SCRIPTS= $(TEST_SCRIPT) testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \ - t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_rank_projection.c + t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c # The tests all depend on the hdf5 library and the test library LDADD = $(LIBH5TEST) $(LIBHDF5) diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 4d1008c..ceeb92b 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -66,7 +66,7 @@ CONFIG_CLEAN_FILES = testph5.sh CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = t_mpi$(EXEEXT) t_posix_compliant$(EXEEXT) \ testphdf5$(EXEEXT) t_cache$(EXEEXT) t_pflush1$(EXEEXT) \ - t_pflush2$(EXEEXT) + t_pflush2$(EXEEXT) t_shapesame$(EXEEXT) t_cache_SOURCES = t_cache.c t_cache_OBJECTS = t_cache.$(OBJEXT) t_cache_LDADD = $(LDADD) @@ -87,11 +87,14 @@ t_posix_compliant_SOURCES = t_posix_compliant.c t_posix_compliant_OBJECTS = t_posix_compliant.$(OBJEXT) t_posix_compliant_LDADD = $(LDADD) t_posix_compliant_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) +t_shapesame_SOURCES = t_shapesame.c +t_shapesame_OBJECTS = t_shapesame.$(OBJEXT) +t_shapesame_LDADD = $(LDADD) +t_shapesame_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) am_testphdf5_OBJECTS = testphdf5.$(OBJEXT) t_dset.$(OBJEXT) \ t_file.$(OBJEXT) t_mdset.$(OBJEXT) t_ph5basic.$(OBJEXT) \ t_coll_chunk.$(OBJEXT) t_span_tree.$(OBJEXT) \ - t_chunk_alloc.$(OBJEXT) t_filter_read.$(OBJEXT) \ - t_rank_projection.$(OBJEXT) + t_chunk_alloc.$(OBJEXT) t_filter_read.$(OBJEXT) testphdf5_OBJECTS = $(am_testphdf5_OBJECTS) testphdf5_LDADD = $(LDADD) testphdf5_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5) @@ -109,9 +112,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c \ - t_posix_compliant.c $(testphdf5_SOURCES) + t_posix_compliant.c t_shapesame.c $(testphdf5_SOURCES) DIST_SOURCES = t_cache.c t_mpi.c t_pflush1.c t_pflush2.c \ - t_posix_compliant.c $(testphdf5_SOURCES) + t_posix_compliant.c t_shapesame.c $(testphdf5_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -164,6 +167,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -225,6 +229,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -281,6 +286,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -397,12 +403,11 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test # Test programs and scripts. These are our main targets. # -TEST_PROG_PARA = t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 +TEST_PROG_PARA = t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2 t_shapesame TEST_SCRIPT_PARA = testph5.sh check_SCRIPTS = $(TEST_SCRIPT) testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_mdset.c t_ph5basic.c \ - t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_rank_projection.c + t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c # The tests all depend on the hdf5 library and the test library @@ -484,6 +489,9 @@ t_pflush2$(EXEEXT): $(t_pflush2_OBJECTS) $(t_pflush2_DEPENDENCIES) t_posix_compliant$(EXEEXT): $(t_posix_compliant_OBJECTS) $(t_posix_compliant_DEPENDENCIES) @rm -f t_posix_compliant$(EXEEXT) $(LINK) $(t_posix_compliant_OBJECTS) $(t_posix_compliant_LDADD) $(LIBS) +t_shapesame$(EXEEXT): $(t_shapesame_OBJECTS) $(t_shapesame_DEPENDENCIES) + @rm -f t_shapesame$(EXEEXT) + $(LINK) $(t_shapesame_OBJECTS) $(t_shapesame_LDADD) $(LIBS) testphdf5$(EXEEXT): $(testphdf5_OBJECTS) $(testphdf5_DEPENDENCIES) @rm -f testphdf5$(EXEEXT) $(LINK) $(testphdf5_OBJECTS) $(testphdf5_LDADD) $(LIBS) @@ -506,7 +514,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_pflush2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_ph5basic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_posix_compliant.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_rank_projection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_shapesame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_span_tree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testphdf5.Po@am__quote@ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index b302663..b0cad48 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7236,6 +7236,14 @@ main(int argc, char **argv) world_server_mpi_rank = mpi_size - 1; world_mpi_comm = MPI_COMM_WORLD; + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); express_test = do_express_test(); diff --git a/testpar/t_file.c b/testpar/t_file.c index ff983a9..5cd3e9d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -44,7 +44,7 @@ test_split_comm_access(void) herr_t ret; /* generic return value */ const char *filename; - filename = GetTestParameters(); + filename = (const char *)GetTestParameters(); if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); @@ -53,7 +53,7 @@ test_split_comm_access(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); is_old = mpi_rank%2; - mrc = MPI_Comm_split (MPI_COMM_WORLD, is_old, mpi_rank, &comm); + mrc = MPI_Comm_split(MPI_COMM_WORLD, is_old, mpi_rank, &comm); VRFY((mrc==MPI_SUCCESS), ""); MPI_Comm_size(comm,&newprocs); MPI_Comm_rank(comm,&newrank); @@ -89,6 +89,8 @@ test_split_comm_access(void) /*VRFY((mrc==MPI_SUCCESS), ""); */ } } + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free succeeded"); mrc = MPI_Barrier(MPI_COMM_WORLD); VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded"); } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 9a6856d..8fc739e 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -2336,6 +2336,9 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); + + mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); mem_start[0] = (hsize_t)(0); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 9033e70..c3e04de 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1137,6 +1137,14 @@ main(int argc, char **argv) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); if (parse_options(argc, argv) != 0){ if (MAINPROCESS) diff --git a/testpar/t_rank_projection.c b/testpar/t_shapesame.c index 16d8c53..a62e4f9 100644 --- a/testpar/t_rank_projection.c +++ b/testpar/t_shapesame.c @@ -1,7 +1,5 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -123,12 +121,13 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, const char *filename; hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hbool_t mis_match = FALSE; - int i, j, k, l, n; + int i, j, k, l; + size_t n; int mrc; int mpi_size = -1; int mpi_rank = -1; - int start_index; - int stop_index; + size_t start_index; + size_t stop_index; const int test_max_rank = 5; /* must update code if this changes */ uint32_t expected_value; uint32_t * small_ds_buf_0 = NULL; @@ -141,7 +140,6 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, uint32_t * large_ds_slice_buf = NULL; uint32_t * ptr_0; uint32_t * ptr_1; - uint32_t * ptr_2; MPI_Comm mpi_comm = MPI_COMM_NULL; MPI_Info mpi_info = MPI_INFO_NULL; hid_t fid; /* HDF5 file ID */ @@ -249,50 +247,20 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* initialize the buffers */ ptr_0 = small_ds_buf_0; - ptr_1 = small_ds_buf_1; - ptr_2 = small_ds_buf_2; - - for ( i = 0; i < (int)small_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { + for(i = 0; i < (int)small_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); + HDmemset(small_ds_buf_2, 0, sizeof(uint32_t) * small_ds_size); - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); ptr_0 = large_ds_buf_0; - ptr_1 = large_ds_buf_1; - ptr_2 = large_ds_buf_2; - - for ( i = 0; i < (int)large_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = large_ds_slice_buf; - - for ( i = 0; i < (int)large_ds_slice_size; i++ ) { + for(i = 0; i < (int)large_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); + HDmemset(large_ds_buf_2, 0, sizeof(uint32_t) * large_ds_size); - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_slice_buf, 0, sizeof(uint32_t) * large_ds_slice_size); filename = (const char *)GetTestParameters(); HDassert( filename != NULL ); @@ -340,8 +308,8 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* setup dims: */ - dims[0] = (int)(mpi_size + 1); - dims[1] = dims[2] = dims[3] = dims[4] = edge_size; + dims[0] = (hsize_t)(mpi_size + 1); + dims[1] = dims[2] = dims[3] = dims[4] = (hsize_t)edge_size; /* Create small ds dataspaces */ @@ -397,28 +365,6 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, "H5Screate_simple() large_ds_slice_sid succeeded"); - /* Select the entire extent of the full small ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_small_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_small_ds_sid) succeeded"); - - ret = H5Sselect_all(small_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(small_ds_slice_sid) succeeded"); - - - /* Select the entire extent of the full large ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_large_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_large_ds_sid) succeeded"); - - ret = H5Sselect_all(large_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(large_ds_slice_sid) succeeded"); - - /* if chunk edge size is greater than zero, set up the small and * large data set creation property lists to specify chunked * datasets. @@ -451,7 +397,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, chunk_dims[0] = 1; } chunk_dims[1] = chunk_dims[2] = - chunk_dims[3] = chunk_dims[4] = chunk_edge_size; + chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded"); @@ -491,28 +437,23 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, xfer_plist = H5Pcreate(H5P_DATASET_XFER); VRFY((xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - if ( ! use_collective_io ) { - - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, - H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded"); + if(use_collective_io) { + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } /* setup selection to write initial data to the small and large data sets */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } /* setup selections for writing initial data to the small data set */ @@ -534,7 +475,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_OR, @@ -562,9 +503,11 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + if ( ! use_collective_io ) { + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + } /* read the small data set back to verify that it contains the * expected data. Note that each process reads in the entire @@ -600,7 +543,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* setup selections for writing initial data to the large data set */ - start[0] = mpi_rank; + start[0] = (hsize_t)mpi_rank; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_SET, @@ -640,7 +583,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_OR, @@ -668,8 +611,11 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + } /* read the small data set back to verify that it contains the @@ -685,7 +631,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((ret >= 0), "H5Dread() large_dataset initial read succeeded"); - /* verify that the correct data was written to the small data set */ + /* verify that the correct data was written to the large data set */ expected_value = 0; mis_match = FALSE; ptr_1 = large_ds_buf_1; @@ -703,6 +649,15 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY( (mis_match == FALSE), "large ds init data good."); + /* sync with the other processes before changing data */ + + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync initial values check"); + } + + /* first, verify that we can read from disk correctly using selections * of different rank that H5S_select_shape_same() views as being of the * same shape. @@ -722,7 +677,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -730,18 +685,12 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } /* zero out the buffer we will be reading into */ - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -806,10 +755,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * large_rank > small_rank by the assertions at the head * of this function. Thus no need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(file_large_ds_sid, @@ -847,20 +796,20 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_sid, xfer_plist, small_ds_slice_buf); - VRFY((ret >= 0), "H5Sread() slice from large ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from large ds succeeded."); /* verify that expected data is retrieved */ mis_match = FALSE; ptr_1 = small_ds_slice_buf; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - for ( n = 0; n < (int)small_ds_slice_size; n++ ) { + for ( n = 0; n < small_ds_slice_size; n++ ) { if ( *ptr_1 != expected_value ) { @@ -895,17 +844,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * data (and only the correct data) is read. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid, @@ -924,12 +873,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, #endif /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); /* set up start, stride, count, and block -- note that we will * change start[] so as to read slices of the large cube. @@ -937,7 +881,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -945,7 +889,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -1011,10 +955,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * by the assertions at the head of this function. Thus no * need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(mem_large_ds_sid, @@ -1052,25 +996,24 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_small_ds_sid, xfer_plist, large_ds_buf_1); - VRFY((ret >= 0), "H5Sread() slice from small ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from small ds succeeded."); /* verify that the expected data and only the * expected data was read. */ ptr_1 = large_ds_buf_1; - expected_value = mpi_rank * small_ds_slice_size; - start_index = + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); + start_index = (size_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)large_ds_size ); + HDassert( stop_index <= large_ds_size ); - for ( n = 0; n < (int)large_ds_size; n++ ) { + for ( n = 0; n < large_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1122,17 +1065,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * the memory and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid, @@ -1158,7 +1101,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -1166,17 +1109,12 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } /* zero out the in memory small ds */ - ptr_1 = small_ds_buf_1; - for ( n = 0; n < (int)small_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG @@ -1260,10 +1198,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the portion of the in memory large cube from which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(mem_large_ds_sid, @@ -1321,20 +1259,19 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, mis_match = FALSE; ptr_1 = small_ds_buf_1; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - start_index = mpi_rank * small_ds_slice_size; + start_index = (size_t)mpi_rank * small_ds_slice_size; stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)small_ds_size ); + HDassert( stop_index <= small_ds_size ); - for ( n = 0; n < (int)small_ds_size; n++ ) { + for ( n = 0; n < small_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1386,17 +1323,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the slice of the in memory small data set associated with * the process's mpi rank. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(mem_small_ds_sid, @@ -1415,7 +1352,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -1423,17 +1360,12 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -1509,10 +1441,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the portion of the in memory large cube to which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(file_large_ds_sid, @@ -1576,20 +1508,18 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * expected data was read. */ ptr_1 = large_ds_buf_1; - expected_value = (uint32_t)(mpi_rank) * small_ds_slice_size; + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); - - start_index = (i * edge_size * edge_size * edge_size * edge_size) + + start_index = (size_t)((i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index < (int)large_ds_size ); + HDassert( stop_index < large_ds_size ); - for ( n = 0; n < (int)large_ds_size; n++ ) { + for ( n = 0; n < large_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1699,7 +1629,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /*------------------------------------------------------------------------- - * Function: contig_hyperslab_dr_pio_test() + * Function: contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) * * Purpose: Test I/O to/from hyperslab selections of different rank in * the parallel case. @@ -1718,12 +1648,15 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * if two or more processes are banging on the same * block of memory. * JRM -- 9/10/10 + * Break this one big test into 4 smaller tests according + * to {independent,collective}x{contigous,chunked} datasets. + * AKC -- 2010/01/14 * *------------------------------------------------------------------------- */ void -contig_hyperslab_dr_pio_test(void) +contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { int test_num = 0; int edge_size = 10; @@ -1734,7 +1667,7 @@ contig_hyperslab_dr_pio_test(void) int skip_counters[4] = {0, 0, 0, 0}; int tests_skiped[4] = {0, 0, 0, 0}; int mpi_result; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY hbool_t time_tests = TRUE; hbool_t display_skips = FALSE; @@ -1755,11 +1688,10 @@ contig_hyperslab_dr_pio_test(void) long long sample_times[4] = {0, 0, 0, 0}; struct timeval timeval_a; struct timeval timeval_b; - - MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); #endif /* H5_HAVE_GETTIMEOFDAY */ + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); + local_express_test = GetTestExpress(); mpi_result = MPI_Allreduce((void *)&local_express_test, @@ -1774,15 +1706,15 @@ contig_hyperslab_dr_pio_test(void) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - - chunk_edge_size = 0; - + switch(sstest_type){ + case IND_CONTIG: /* contiguous data set, independent I/O */ + chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -1799,13 +1731,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[col_contig_idx]); } test_num++; + break; + /* end of case IND_CONTIG */ + case COL_CONTIG: /* contiguous data set, collective I/O */ + chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -1822,15 +1758,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[ind_contig_idx]); } test_num++; + break; + /* end of case COL_CONTIG */ - chunk_edge_size = 5; - + case IND_CHUNKED: /* chunked data set, independent I/O */ + chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -1847,13 +1785,17 @@ contig_hyperslab_dr_pio_test(void) sample_times[col_chunked_idx]); } test_num++; + break; + /* end of case IND_CHUNKED */ + case COL_CHUNKED: /* chunked data set, collective I/O */ + chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -1870,6 +1812,9 @@ contig_hyperslab_dr_pio_test(void) sample_times[ind_chunked_idx]); } test_num++; + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -2037,14 +1982,14 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( * pre-C99 compilers again. */ - base_count = edge_size / (checker_edge_size * 2); + base_count = (hsize_t)(edge_size / (checker_edge_size * 2)); if ( (edge_size % (checker_edge_size * 2)) > 0 ) { base_count++; } - offset_count = (edge_size - checker_edge_size) / (checker_edge_size * 2); + offset_count = (hsize_t)((edge_size - checker_edge_size) / (checker_edge_size * 2)); if ( ((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0 ) { @@ -2070,7 +2015,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( while ( i < sel_offset ) { start[i] = sel_start[i]; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; block[i] = 1; @@ -2079,8 +2024,8 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( while ( i < test_max_rank ) { - stride[i] = 2 * checker_edge_size; - block[i] = checker_edge_size; + stride[i] = (hsize_t)(2 * checker_edge_size); + block[i] = (hsize_t)checker_edge_size; i++; } @@ -2096,7 +2041,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[0] = checker_edge_size; + start[0] = (hsize_t)checker_edge_size; count[0] = offset_count; } @@ -2113,7 +2058,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[1] = checker_edge_size; + start[1] = (hsize_t)checker_edge_size; count[1] = offset_count; } @@ -2130,7 +2075,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[2] = checker_edge_size; + start[2] = (hsize_t)checker_edge_size; count[2] = offset_count; } @@ -2147,7 +2092,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[3] = checker_edge_size; + start[3] = (hsize_t)checker_edge_size; count[3] = offset_count; } @@ -2164,7 +2109,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[4] = checker_edge_size; + start[4] = (hsize_t)checker_edge_size; count[4] = offset_count; } @@ -2269,9 +2214,9 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( for ( i = 0; i < test_max_rank; i++ ) { start[i] = 0; - stride[i] = edge_size; + stride[i] = (hsize_t)edge_size; count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND, @@ -2548,10 +2493,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hbool_t data_ok = FALSE; hbool_t mis_match = FALSE; - int i, j, k, l, n; + int i, j, k, l; + size_t u; int mrc; - int start_index; - int stop_index; + size_t start_index; + size_t stop_index; int small_ds_offset; int large_ds_offset; const int test_max_rank = 5; /* must update code if this changes */ @@ -2566,7 +2512,6 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, uint32_t * large_ds_slice_buf = NULL; uint32_t * ptr_0; uint32_t * ptr_1; - uint32_t * ptr_2; int mpi_rank; int mpi_size; MPI_Comm mpi_comm = MPI_COMM_NULL; @@ -2678,50 +2623,20 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* initialize the buffers */ ptr_0 = small_ds_buf_0; - ptr_1 = small_ds_buf_1; - ptr_2 = small_ds_buf_2; - - for ( i = 0; i < (int)small_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } + for(i = 0; i < (int)small_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); + HDmemset(small_ds_buf_2, 0, sizeof(uint32_t) * small_ds_size); - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)i; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); ptr_0 = large_ds_buf_0; - ptr_1 = large_ds_buf_1; - ptr_2 = large_ds_buf_2; + for(i = 0; i < (int)large_ds_size; i++) + *ptr_0++ = (uint32_t)i; + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); + HDmemset(large_ds_buf_2, 0, sizeof(uint32_t) * large_ds_size); - for ( i = 0; i < (int)large_ds_size; i++ ) { - - *ptr_0 = (uint32_t)i; - *ptr_1 = 0; - *ptr_2 = 0; - - ptr_0++; - ptr_1++; - ptr_2++; - } - - ptr_0 = large_ds_slice_buf; - - for ( i = 0; i < (int)large_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_slice_buf, 0, sizeof(uint32_t) * large_ds_slice_size); filename = (const char *)GetTestParameters(); HDassert( filename != NULL ); @@ -2773,8 +2688,8 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* setup dims: */ - dims[0] = (int)(mpi_size + 1); - dims[1] = dims[2] = dims[3] = dims[4] = edge_size; + dims[0] = (hsize_t)(mpi_size + 1); + dims[1] = dims[2] = dims[3] = dims[4] = (hsize_t)edge_size; /* Create small ds dataspaces */ @@ -2838,28 +2753,6 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, "H5Screate_simple() large_ds_slice_sid succeeded"); - /* Select the entire extent of the full small ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_small_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_small_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_small_ds_sid) succeeded"); - - ret = H5Sselect_all(small_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(small_ds_slice_sid) succeeded"); - - - /* Select the entire extent of the full large ds, and ds slice dataspaces */ - ret = H5Sselect_all(full_mem_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_mem_large_ds_sid) succeeded"); - - ret = H5Sselect_all(full_file_large_ds_sid); - VRFY((ret != FAIL), "H5Sselect_all(full_file_large_ds_sid) succeeded"); - - ret = H5Sselect_all(large_ds_slice_sid); - VRFY((ret != FAIL), "H5Sselect_all(large_ds_slice_sid) succeeded"); - - /* if chunk edge size is greater than zero, set up the small and * large data set creation property lists to specify chunked * datasets. @@ -2893,7 +2786,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } chunk_dims[1] = chunk_dims[2] = - chunk_dims[3] = chunk_dims[4] = chunk_edge_size; + chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded"); @@ -2928,33 +2821,28 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((ret != FAIL), "H5Dcreate2() large_dataset succeeded"); - /* setup xfer property list */ xfer_plist = H5Pcreate(H5P_DATASET_XFER); VRFY((xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - if ( ! use_collective_io ) { - - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, - H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded"); + if(use_collective_io) { + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } + /* setup selection to write initial data to the small and large data sets */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } /* setup selections for writing initial data to the small data set */ @@ -2976,7 +2864,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_OR, @@ -3003,9 +2891,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + if ( ! use_collective_io ) { + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes"); + } /* read the small data set back to verify that it contains the * expected data. Note that each process reads in the entire @@ -3041,7 +2931,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* setup selections for writing initial data to the large data set */ - start[0] = mpi_rank; + start[0] = (hsize_t)mpi_rank; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_SET, @@ -3081,7 +2971,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_OR, @@ -3109,8 +2999,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* sync with the other processes before checking data */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes"); + } /* read the small data set back to verify that it contains the @@ -3142,6 +3035,15 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, expected_value++; } VRFY( (mis_match == FALSE), "large ds init data good."); + + /* sync with the other processes before changing data */ + + if ( ! use_collective_io ) { + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after initial values check"); + } + /***********************************/ /***** INITIALIZATION COMPLETE *****/ @@ -3161,7 +3063,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, small_ds_slice_sid, @@ -3172,14 +3074,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, sel_start); /* zero out the buffer we will be reading into */ - - ptr_0 = small_ds_slice_buf; - - for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(small_ds_slice_buf, 0, sizeof(uint32_t) * small_ds_slice_size); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, "%s:%d: initial small_ds_slice_buf = ", @@ -3198,7 +3093,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3206,7 +3101,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3273,10 +3168,10 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, * large_rank > small_rank by the assertions at the head * of this function. Thus no need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3321,7 +3216,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_sid_0, xfer_plist, small_ds_slice_buf); - VRFY((ret >= 0), "H5Sread() slice from large ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from large ds succeeded."); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", @@ -3369,7 +3264,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, file_small_ds_sid_0, @@ -3386,12 +3281,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, #endif /* zero out the buffer we will be reading into */ - ptr_0 = large_ds_buf_1; - for ( i = 0; i < (int)large_ds_size; i++ ) { - - *ptr_0 = (uint32_t)0; - ptr_0++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); /* set up start, stride, count, and block -- note that we will * change start[] so as to read the slice of the small data set @@ -3401,7 +3291,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3409,7 +3299,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3475,10 +3365,10 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, * by the assertions at the head of this function. Thus no * need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3523,24 +3413,25 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, file_small_ds_sid_0, xfer_plist, large_ds_buf_1); - VRFY((ret >= 0), "H5Sread() slice from small ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from small ds succeeded."); /* verify that the expected data and only the * expected data was read. */ data_ok = TRUE; ptr_1 = large_ds_buf_1; - expected_value = mpi_rank * small_ds_slice_size; - start_index = + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); + start_index = (size_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG { -int m; +int m, n; + HDfprintf(stdout, "%s:%d: expected_value = %d.\n", fcnName, mpi_rank, expected_value); HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n", @@ -3561,11 +3452,10 @@ int m; } #endif - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)large_ds_size ); + HDassert( stop_index <= large_ds_size ); - for ( n = 0; n < (int)start_index; n++ ) { + for ( u = 0; u < start_index; u++ ) { if ( *ptr_1 != 0 ) { @@ -3597,7 +3487,7 @@ int m; ptr_1 = large_ds_buf_1 + stop_index + 1; - for ( n = stop_index + 1; n < large_ds_size; n++ ) { + for ( u = stop_index + 1; u < large_ds_size; u++ ) { if ( *ptr_1 != 0 ) { @@ -3639,17 +3529,17 @@ int m; * the memory and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid_0, @@ -3670,7 +3560,7 @@ int m; sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, file_small_ds_sid_1, @@ -3687,7 +3577,7 @@ int m; for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3695,17 +3585,12 @@ int m; } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } /* zero out the in memory small ds */ - ptr_1 = small_ds_buf_1; - for ( n = 0; n < (int)small_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(small_ds_buf_1, 0, sizeof(uint32_t) * small_ds_size); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG @@ -3789,10 +3674,10 @@ int m; /* select the portion of the in memory large cube from which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3858,35 +3743,34 @@ int m; /* verify that expected data is retrieved */ mis_match = FALSE; - ptr_1 = small_ds_buf_1; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - start_index = mpi_rank * small_ds_slice_size; + start_index = (size_t)mpi_rank * small_ds_slice_size; stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)small_ds_size ); + HDassert( stop_index <= small_ds_size ); data_ok = TRUE; - for ( n = 0; n < start_index; n++ ) { + ptr_1 = small_ds_buf_1; + for ( u = 0; u < start_index; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } data_ok &= checker_board_hyperslab_dr_pio_test__verify_data ( - ptr_1 + start_index, + small_ds_buf_1 + start_index, small_rank - 1, edge_size, checker_edge_size, @@ -3895,12 +3779,13 @@ int m; ); - for ( n = stop_index; n < small_ds_size; n++ ) { + ptr_1 = small_ds_buf_1; + for ( u = stop_index; u < small_ds_size; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } @@ -3930,17 +3815,17 @@ int m; * and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_large_ds_sid_0, @@ -3964,7 +3849,7 @@ int m; */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, mem_small_ds_sid, @@ -3981,7 +3866,7 @@ int m; for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3989,17 +3874,12 @@ int m; } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } /* zero out the in memory large ds */ - ptr_1 = large_ds_buf_1; - for ( n = 0; n < (int)large_ds_size; n++ ) { - - *ptr_1 = 0; - ptr_1++; - } + HDmemset(large_ds_buf_1, 0, sizeof(uint32_t) * large_ds_size); #if CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG HDfprintf(stdout, @@ -4075,10 +3955,10 @@ int m; /* select the portion of the in memory large cube to which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -4148,37 +4028,35 @@ int m; /* verify that the expected data and only the * expected data was read. */ - ptr_1 = large_ds_buf_1; - expected_value = (uint32_t)(mpi_rank) * small_ds_slice_size; + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); - - start_index = (i * edge_size * edge_size * edge_size * edge_size) + + start_index = (size_t)((i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index < (int)large_ds_size ); + HDassert( stop_index < large_ds_size ); mis_match = FALSE; data_ok = TRUE; - for ( n = 0; n < start_index; n++ ) { + ptr_1 = large_ds_buf_1; + for ( u = 0; u < start_index; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } data_ok &= checker_board_hyperslab_dr_pio_test__verify_data ( - ptr_1 + start_index, + large_ds_buf_1 + start_index, small_rank - 1, edge_size, checker_edge_size, @@ -4187,12 +4065,13 @@ int m; ); - for ( n = stop_index; n < small_ds_size; n++ ) { + ptr_1 = large_ds_buf_1; + for ( u = stop_index; u < small_ds_size; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } @@ -4307,12 +4186,15 @@ int m; * if two or more processes are banging on the same * block of memory. * JRM -- 9/10/10 + * Break this one big test into 4 smaller tests according + * to {independent,collective}x{contigous,chunked} datasets. + * AKC -- 2010/01/17 * *------------------------------------------------------------------------- */ void -checker_board_hyperslab_dr_pio_test(void) +checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { int test_num = 0; int edge_size = 10; @@ -4324,7 +4206,7 @@ checker_board_hyperslab_dr_pio_test(void) int skip_counters[4] = {0, 0, 0, 0}; int tests_skiped[4] = {0, 0, 0, 0}; int mpi_result; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY hbool_t time_tests = TRUE; hbool_t display_skips = FALSE; @@ -4352,6 +4234,8 @@ checker_board_hyperslab_dr_pio_test(void) local_express_test = GetTestExpress(); + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); + mpi_result = MPI_Allreduce((void *)&local_express_test, (void *)&express_test, 1, @@ -4372,15 +4256,15 @@ checker_board_hyperslab_dr_pio_test(void) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - - chunk_edge_size = 0; - + switch(sstest_type){ + case IND_CONTIG: /* contiguous data set, independent I/O */ + chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -4400,13 +4284,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case IND_CONTIG */ + case COL_CONTIG: /* contiguous data set, collective I/O */ + chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -4426,15 +4314,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case COL_CONTIG */ - chunk_edge_size = 5; - + case IND_CHUNKED: /* chunked data set, independent I/O */ + chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -4454,14 +4344,17 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case IND_CHUNKED */ - + case COL_CHUNKED: /* chunked data set, collective I/O */ + chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -4481,6 +4374,9 @@ checker_board_hyperslab_dr_pio_test(void) } test_num++; + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -4556,3 +4452,484 @@ checker_board_hyperslab_dr_pio_test(void) } /* checker_board_hyperslab_dr_pio_test() */ +/* Main Body. Here for now, may have to move them to a separated file later. */ + +/* + * Main driver of the Parallel HDF5 tests + */ + +#include "testphdf5.h" + +#ifndef PATH_MAX +#define PATH_MAX 512 +#endif /* !PATH_MAX */ + +/* global variables */ +int dim0; +int dim1; +int chunkdim0; +int chunkdim1; +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ +int ngroups = 512; /* number of groups to create in root + * group. */ +int facc_type = FACC_MPIO; /*Test file access type */ +int dxfer_coll_type = DXFER_COLLECTIVE_IO; + +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ + +/* other option flags */ + +/* FILENAME and filenames must have the same number of names. + * Use PARATESTFILE in general and use a separated filename only if the file + * created in one test is accessed by a different test. + * filenames[0] is reserved as the file name for PARATESTFILE. + */ +#define NFILENAME 2 +#define PARATESTFILE filenames[0] +const char *FILENAME[NFILENAME]={ + "ShapeSameTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ + +#ifdef USE_PAUSE +/* pause the process for a moment to allow debugger to attach if desired. */ +/* Will pause more if greenlight file is not persent but will eventually */ +/* continue. */ +#include <sys/types.h> +#include <sys/stat.h> + +void pause_proc(void) +{ + + int pid; + h5_stat_t statbuf; + char greenlight[] = "go"; + int maxloop = 10; + int loops = 0; + int time_int = 10; + + /* mpi variables */ + int mpi_size, mpi_rank; + int mpi_namelen; + char mpi_name[MPI_MAX_PROCESSOR_NAME]; + + pid = getpid(); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Get_processor_name(mpi_name, &mpi_namelen); + + if (MAINPROCESS) + while ((stat(greenlight, &statbuf) == -1) && loops < maxloop){ + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } + MPI_Barrier(MPI_COMM_WORLD); +} + +/* Use the Profile feature of MPI to call the pause_proc() */ +int MPI_Init(int *argc, char ***argv) +{ + int ret_code; + ret_code=PMPI_Init(argc, argv); + pause_proc(); + return (ret_code); +} +#endif /* USE_PAUSE */ + + +/* + * Show command usage + */ +static void +usage(void) +{ + printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] " + "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); + printf("\t-m<n_datasets>" + "\tset number of datasets for the multiple dataset test\n"); + printf("\t-n<n_groups>" + "\tset number of groups for the multiple group test\n"); + printf("\t-f <prefix>\tfilename prefix\n"); + printf("\t-2\t\tuse Split-file together with MPIO\n"); + printf("\t-p\t\tuse combo MPI-POSIX driver\n"); + printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", + ROW_FACTOR, COL_FACTOR); + printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + printf("\n"); +} + + +/* + * parse the command line options + */ +static int +parse_options(int argc, char **argv) +{ + int mpi_size, mpi_rank; /* mpi variables */ + + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup default chunk-size. Make sure sizes are > 0 */ + + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + + while (--argc){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ + nerrors++; + return(1); + } + break; + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'p': /* Use the MPI-POSIX driver access */ + facc_type = FACC_MPIPOSIX; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + case '2': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } + } /*while*/ + + /* check validity of dimension and chunk sizes */ + if (dim0 <= 0 || dim1 <= 0){ + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); + } + if (chunkdim0 <= 0 || chunkdim1 <= 0){ + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); + } + + /* Make sure datasets can be divided into equal portions by the processes */ + if ((dim0 % mpi_size) || (dim1 % mpi_size)){ + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); + } + + /* compose the test filenames */ + { + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); + } + + return(0); +} + + +/* + * Create the appropriate File access property list + */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, + hbool_t use_gpfs) +{ + hid_t ret_pl = -1; + herr_t ret; /* generic return value */ + int mpi_rank; /* mpi variables */ + + /* need the rank for error checking macros */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); + + if (l_facc_type == FACC_DEFAULT) + return (ret_pl); + + if (l_facc_type == FACC_MPIO){ + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); + } + + if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); + } + + if (l_facc_type == FACC_MPIPOSIX) { + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); + VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); + return(ret_pl); + } + + /* unknown file access types */ + return (ret_pl); +} + + +/* Shape Same test using contigous hyperslab using independent IO on contigous datasets */ +static void +sscontig1(void) +{ + contig_hyperslab_dr_pio_test(IND_CONTIG); +} + +/* Shape Same test using contigous hyperslab using collective IO on contigous datasets */ +static void +sscontig2(void) +{ + contig_hyperslab_dr_pio_test(COL_CONTIG); +} + +/* Shape Same test using contigous hyperslab using independent IO on chunked datasets */ +static void +sscontig3(void) +{ + contig_hyperslab_dr_pio_test(IND_CHUNKED); +} + +/* Shape Same test using contigous hyperslab using collective IO on chunked datasets */ +static void +sscontig4(void) +{ + contig_hyperslab_dr_pio_test(COL_CHUNKED); +} + + +/* Shape Same test using checker hyperslab using independent IO on contigous datasets */ +static void +sschecker1(void) +{ + checker_board_hyperslab_dr_pio_test(IND_CONTIG); +} + +/* Shape Same test using checker hyperslab using collective IO on contigous datasets */ +static void +sschecker2(void) +{ + checker_board_hyperslab_dr_pio_test(COL_CONTIG); +} + +/* Shape Same test using checker hyperslab using independent IO on chunked datasets */ +static void +sschecker3(void) +{ + checker_board_hyperslab_dr_pio_test(IND_CHUNKED); +} + +/* Shape Same test using checker hyperslab using collective IO on chunked datasets */ +static void +sschecker4(void) +{ + checker_board_hyperslab_dr_pio_test(COL_CHUNKED); +} + + +int main(int argc, char **argv) +{ + int mpi_size, mpi_rank; /* mpi variables */ + H5Ptest_param_t ndsets_params, ngroups_params; + H5Ptest_param_t collngroups_params; + H5Ptest_param_t io_mode_confusion_params; + H5Ptest_param_t rr_obj_flush_confusion_params; + + /* Un-buffer the stdout and stderr */ + setbuf(stderr, NULL); + setbuf(stdout, NULL); + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + dim0 = ROW_FACTOR*mpi_size; + dim1 = COL_FACTOR*mpi_size; + + if (MAINPROCESS){ + printf("===================================\n"); + printf("Shape Same Tests Start\n"); + printf("===================================\n"); + } + + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; + H5open(); + h5_show_hostname(); + + /* Initialize testing framework */ + TestInit(argv[0], usage, parse_options); + + /* Shape Same tests using contigous hyperslab */ + AddTest("sscontig1", sscontig1, NULL, + "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE); + AddTest("sscontig2", sscontig2, NULL, + "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE); + AddTest("sscontig3", sscontig3, NULL, + "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE); + AddTest("sscontig4", sscontig4, NULL, + "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE); + + /* Shape Same tests using checker board hyperslab */ + AddTest("sschecker1", sschecker1, NULL, + "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE); + AddTest("sschecker2", sschecker2, NULL, + "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE); + AddTest("sschecker3", sschecker3, NULL, + "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE); + AddTest("sschecker4", sschecker4, NULL, + "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE); + + /* Display testing information */ + TestInfo(argv[0]); + + /* setup file access property list */ + fapl = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); + + /* Parse command line arguments */ + TestParseCmdLine(argc, argv); + + if (facc_type == FACC_MPIPOSIX && MAINPROCESS){ + printf("===================================\n" + " Using MPIPOSIX driver\n" + "===================================\n"); + } + + if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); + } + + + /* Perform requested testing */ + PerformTests(); + + /* make sure all processes are finished before final report, cleanup + * and exit. + */ + MPI_Barrier(MPI_COMM_WORLD); + + /* Display test summary, if requested */ + if (MAINPROCESS && GetTestSummary()) + TestSummary(); + + /* Clean up test files */ + h5_cleanup(FILENAME, fapl); + + nerrors += GetTestNumErrs(); + + /* Gather errors from all processes */ + { + int temp; + MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); + nerrors=temp; + } + + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); + } + /* close HDF5 library */ + H5close(); + + /* MPI_Finalize must be called AFTER H5close which may use MPI calls */ + MPI_Finalize(); + + /* cannot just return (nerrors) because exit code is limited to 1byte */ + return(nerrors!=0); +} diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index e54d0a8..2730ea2 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -2616,10 +2616,11 @@ lower_dim_size_comp_test(void) /* const char *fcnName = "lower_dim_size_comp_test()"; */ int chunk_edge_size = 0; int use_collective_io = 1; - hid_t dset_type = H5T_STD_U32LE; + hid_t dset_type = H5T_NATIVE_UINT; #if 0 sleep(60); #endif + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); for ( use_collective_io = (hbool_t)0; (int)use_collective_io <= 1; (hbool_t)(use_collective_io++) ) { diff --git a/testpar/testpar.h b/testpar/testpar.h index 02fc915..ce11204 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -26,25 +26,36 @@ /* Define some handy debugging shorthands, routines, ... */ /* debugging tools */ -#define MESG(x) \ - if (VERBOSE_MED) printf("%s\n", x); \ +/* Print message mesg if verbose level is at least medium and + * mesg is not an empty string. + */ +#define MESG(mesg) \ + if (VERBOSE_MED && *mesg != '\0') \ + printf("%s\n", mesg) +/* + * VRFY: Verify if the condition val is true. + * If it is true, then call MESG to print mesg, depending on the verbose + * level. + * If val is not true, it prints error messages and if the verbose + * level is lower than medium, it calls MPI_Abort to abort the program. + * If verbose level is at least medium, it will not abort. + * This will allow program to continue and can be used for debugging. + * (The "do {...} while(0)" is to group all the statements as one unit.) + */ #define VRFY(val, mesg) do { \ if (val) { \ - if (*mesg != '\0') { \ - MESG(mesg); \ - } \ + MESG(mesg); \ } else { \ printf("Proc %d: ", mpi_rank); \ - printf("*** PHDF5 ERROR ***\n"); \ - printf(" Assertion (%s) failed at line %4d in %s\n", \ + printf("*** Parallel ERROR ***\n"); \ + printf(" VRFY (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ ++nerrors; \ fflush(stdout); \ - if (!VERBOSE_MED) { \ - printf("aborting MPI process\n"); \ - MPI_Finalize(); \ - exit(nerrors); \ + if (!VERBOSE_MED) { \ + printf("aborting MPI processes\n"); \ + MPI_Abort(MPI_COMM_WORLD, 1); \ } \ } \ } while(0) @@ -56,9 +67,7 @@ */ #define INFO(val, mesg) do { \ if (val) { \ - if (*mesg != '\0') { \ - MESG(mesg); \ - } \ + MESG(mesg); \ } else { \ printf("Proc %d: ", mpi_rank); \ printf("*** PHDF5 REMARK (not an error) ***\n"); \ diff --git a/testpar/testph5.sh.in b/testpar/testph5.sh.in index 11a6e7e..f78cfac 100644 --- a/testpar/testph5.sh.in +++ b/testpar/testph5.sh.in @@ -60,6 +60,17 @@ TOOLTEST() { # testphdf5 test using the MPI-POSIX VFL driver TOOLTEST -p +# Temporary patch: +# Run t_shapesame this way. Need more permanent solution. +echo $RUNPARALLEL ./t_shapesame -p +eval $RUNPARALLEL ./t_shapesame -p + +# Check if the command failed and increment nerrors if so. +if test $? -ne 0 ; then + nerrors="`expr $nerrors + 1`" +fi +# Temporary patch ended. + # Emit message about testing status if test $nerrors -eq 0 ; then echo "All $TEST_APP tests passed." diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 44415e4..8b24f87 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -335,6 +335,15 @@ int main(int argc, char **argv) printf("PHDF5 TESTS START\n"); printf("===================================\n"); } + + /* Attempt to turn off atexit post processing so that in case errors + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0){ + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + }; H5open(); h5_show_hostname(); @@ -489,15 +498,6 @@ int main(int argc, char **argv) "test mpi derived type management", PARATESTFILE); - /* rank projections / shape same tests */ - - AddTest("chsssdrpio", - contig_hyperslab_dr_pio_test, NULL, - "contiguous hyperslab shape same different rank PIO",PARATESTFILE); - - AddTest("cbhsssdrpio", - checker_board_hyperslab_dr_pio_test, NULL, - "checker board hyperslab shape same different rank PIO",PARATESTFILE); /* Display testing information */ TestInfo(argv[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 555f137..2b83047 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -186,6 +186,14 @@ typedef struct H5Ptest_param_t /* holds extra test parameters */ /* Dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; +/* Shape Same Tests Definitions */ +typedef enum { + IND_CONTIG, /* Independent IO on contigous datasets */ + COL_CONTIG, /* Collective IO on contigous datasets */ + IND_CHUNKED, /* Independent IO on chunked datasets */ + COL_CHUNKED /* Collective IO on chunked datasets */ +} ShapeSameTestMethods; + /* Shared global variables */ extern int dim0, dim1; /*Dataset dimensions */ extern int chunkdim0, chunkdim1; /*Chunk dimensions */ @@ -242,8 +250,8 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm); void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm); void lower_dim_size_comp_test(void); void link_chunk_collective_io_test(void); -void contig_hyperslab_dr_pio_test(void); -void checker_board_hyperslab_dr_pio_test(void); +void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); +void checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); #ifdef H5_HAVE_FILTER_DEFLATE void compress_readAll(void); #endif /* H5_HAVE_FILTER_DEFLATE */ |