diff options
Diffstat (limited to 'fortran/testpar')
-rw-r--r-- | fortran/testpar/Makefile.am | 10 | ||||
-rw-r--r-- | fortran/testpar/Makefile.in | 39 | ||||
-rw-r--r-- | fortran/testpar/hyper.f90 | 204 | ||||
-rw-r--r-- | fortran/testpar/ptest.f90 | 107 | ||||
-rw-r--r-- | fortran/testpar/ptesthdf5_fortran.f90 | 86 | ||||
-rw-r--r-- | fortran/testpar/thdf5.f90 | 25 | ||||
-rw-r--r-- | fortran/testpar/thyperslab_wr.f90 | 253 |
7 files changed, 335 insertions, 389 deletions
diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am index ed1e4bc..b6b6b3f 100644 --- a/fortran/testpar/Makefile.am +++ b/fortran/testpar/Makefile.am @@ -26,7 +26,7 @@ AM_FCFLAGS=-I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFLAG AM_LDFLAGS=-static # These are our main targets -TEST_PROG_PARA=ptesthdf5_fortran +TEST_PROG_PARA=parallel_test check_PROGRAMS=$(TEST_PROG_PARA) # Temporary files @@ -34,7 +34,7 @@ MOSTLYCLEAN=ParaEg[123].h5f DISTCLEAN=go # Test source files -ptesthdf5_fortran_SOURCES=thdf5.f90 ptesthdf5_fortran.f90 thyperslab_wr.f90 +parallel_test_SOURCES=ptest.f90 hyper.f90 # The tests depend on several libraries. LDADD=$(LIBH5FTEST) $(LIBH5TEST) $(LIBH5F) $(LIBHDF5) @@ -67,8 +67,8 @@ uninstall-local: # Put in dependencies to the THDF5 module so that things will be built # in the correct order. -thdf5.lo: thdf5.o -thyperslab_wr.o: $(srcdir)/thyperslab_wr.f90 thdf5.lo -ptesthdf5_fortran.o: $(srcdir)/ptesthdf5_fortran.f90 thdf5.lo +#thdf5.lo: thdf5.o +#thyperslab_wr.o: $(srcdir)/thyperslab_wr.f90 thdf5.lo +#ptesthdf5_fortran.o: $(srcdir)/ptesthdf5_fortran.f90 thdf5.lo include $(top_srcdir)/config/conclude.am diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 1b69551..32b3f69 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -29,7 +29,7 @@ # # HDF5 Fortran Parallel Library Test Makefile(.in) # -SOURCES = $(ptesthdf5_fortran_SOURCES) +SOURCES = $(parallel_test_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -65,17 +65,16 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = -am__EXEEXT_1 = ptesthdf5_fortran$(EXEEXT) -am_ptesthdf5_fortran_OBJECTS = thdf5.$(OBJEXT) \ - ptesthdf5_fortran.$(OBJEXT) thyperslab_wr.$(OBJEXT) -ptesthdf5_fortran_OBJECTS = $(am_ptesthdf5_fortran_OBJECTS) -ptesthdf5_fortran_LDADD = $(LDADD) +am__EXEEXT_1 = parallel_test$(EXEEXT) +am_parallel_test_OBJECTS = ptest.$(OBJEXT) hyper.$(OBJEXT) +parallel_test_OBJECTS = $(am_parallel_test_OBJECTS) +parallel_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = \ $(top_builddir)/fortran/test/libh5test_fortran.la am__DEPENDENCIES_2 = $(top_builddir)/test/libh5test.la am__DEPENDENCIES_3 = $(top_builddir)/fortran/src/libhdf5_fortran.la am__DEPENDENCIES_4 = $(top_builddir)/src/libhdf5.la -ptesthdf5_fortran_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +parallel_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ $(am__DEPENDENCIES_4) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src @@ -84,8 +83,8 @@ LTFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) FCLD = $(FC) FCLINK = $(LIBTOOL) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(ptesthdf5_fortran_SOURCES) -DIST_SOURCES = $(ptesthdf5_fortran_SOURCES) +SOURCES = $(parallel_test_SOURCES) +DIST_SOURCES = $(parallel_test_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -303,14 +302,14 @@ AM_FCFLAGS = -I$(top_srcdir)/fortran/src -I$(top_srcdir)/fortran/test $(F9XMODFL AM_LDFLAGS = -static # These are our main targets -TEST_PROG_PARA = ptesthdf5_fortran +TEST_PROG_PARA = parallel_test # Temporary files MOSTLYCLEAN = ParaEg[123].h5f DISTCLEAN = go # Test source files -ptesthdf5_fortran_SOURCES = thdf5.f90 ptesthdf5_fortran.f90 thyperslab_wr.f90 +parallel_test_SOURCES = ptest.f90 hyper.f90 # The tests depend on several libraries. LDADD = $(LIBH5FTEST) $(LIBH5TEST) $(LIBH5F) $(LIBHDF5) @@ -370,9 +369,9 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -ptesthdf5_fortran$(EXEEXT): $(ptesthdf5_fortran_OBJECTS) $(ptesthdf5_fortran_DEPENDENCIES) - @rm -f ptesthdf5_fortran$(EXEEXT) - $(FCLINK) $(ptesthdf5_fortran_LDFLAGS) $(ptesthdf5_fortran_OBJECTS) $(ptesthdf5_fortran_LDADD) $(LIBS) +parallel_test$(EXEEXT): $(parallel_test_OBJECTS) $(parallel_test_DEPENDENCIES) + @rm -f parallel_test$(EXEEXT) + $(FCLINK) $(parallel_test_LDFLAGS) $(parallel_test_OBJECTS) $(parallel_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -593,12 +592,6 @@ uninstall-local: fi; \ fi -# Put in dependencies to the THDF5 module so that things will be built -# in the correct order. -thdf5.lo: thdf5.o -thyperslab_wr.o: $(srcdir)/thyperslab_wr.f90 thdf5.lo -ptesthdf5_fortran.o: $(srcdir)/ptesthdf5_fortran.f90 thdf5.lo - # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) @@ -719,6 +712,12 @@ check-vfd: HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check; \ fi; \ done + +# Put in dependencies to the THDF5 module so that things will be built +# in the correct order. +#thdf5.lo: thdf5.o +#thyperslab_wr.o: $(srcdir)/thyperslab_wr.f90 thdf5.lo +#ptesthdf5_fortran.o: $(srcdir)/ptesthdf5_fortran.f90 thdf5.lo # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 new file mode 100644 index 0000000..79ede6a --- /dev/null +++ b/fortran/testpar/hyper.f90 @@ -0,0 +1,204 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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 * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + +!////////////////////////////////////////////////////////// +! writes/reads dataset by hyperslabs +!////////////////////////////////////////////////////////// + +subroutine hyper(lenght,do_collective,do_chunk,nerrors) +use hdf5 +implicit none +include 'mpif.h' + +integer, intent(in) :: lenght ! array lenght +logical, intent(in) :: do_collective ! use collective I/O +logical, intent(in) :: do_chunk ! use chunking +integer, intent(inout) :: nerrors ! number of errors +integer :: mpierror ! MPI hdferror flag +integer :: hdferror ! HDF hdferror flag +integer :: mpi_size ! number of processes in the group of communicator +integer :: mpi_rank ! rank of the calling process in the communicator +integer(hsize_t), dimension(1) :: dims ! dataset dimensions +integer(hsize_t), dimension(1) :: cdims ! chunk dimensions +integer, allocatable :: wbuf(:) ! write buffer +integer, allocatable :: rbuf(:) ! read buffer +integer(hsize_t), dimension(1) :: counti ! hyperslab selection +integer(hsize_t), dimension(1) :: start ! hyperslab selection +integer(hid_t) :: fapl_id ! file access identifier +integer(hid_t) :: dxpl_id ! dataset transfer property list +integer(hid_t) :: dcpl_id ! dataset creation property list +integer(hid_t) :: file_id ! file identifier +integer(hid_t) :: dset_id ! dataset identifier +integer(hid_t) :: fspace_id ! file space identifier +integer(hid_t) :: mspace_id ! memory space identifier +integer :: istart ! start position in array +integer :: iend ! end position in array +integer :: icount ! number of elements in array +integer :: i + + +call mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror ) +call mpi_comm_size( MPI_COMM_WORLD, mpi_size, mpierror ) + +!////////////////////////////////////////////////////////// +! initialize the array data between the processes (3) +! for the 12 size array we get +! p0 = 1,2,3,4 +! p1 = 5,6,7,8 +! p2 = 9,10,11,12 +!////////////////////////////////////////////////////////// + +allocate(wbuf(0:lenght-1)) +allocate(rbuf(0:lenght-1)) + +icount = lenght/mpi_size ! divide the array by the number of processes +istart = mpi_rank*icount ! start position +iend = istart + icount ! end position + +do i = istart, iend-1 + wbuf(i) = i +enddo + +!////////////////////////////////////////////////////////// +! HDF5 I/O +!////////////////////////////////////////////////////////// + +dims(1) = lenght +cdims(1) = lenght/mpi_size ! define chunks as the number of processes + +call h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) +call h5pset_fapl_mpio_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) +call h5fcreate_f("parf.h5", H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + +call h5screate_simple_f(1, dims, fspace_id, hdferror) +call h5screate_simple_f(1, dims, mspace_id, hdferror) + +!////////////////////////////////////////////////////////// +! modify dataset creation properties to enable chunking +!////////////////////////////////////////////////////////// + +call h5pcreate_f(H5P_DATASET_CREATE_F, dcpl_id, hdferror) +if (do_chunk) call h5pset_chunk_f(dcpl_id, 1, cdims, hdferror) + +!////////////////////////////////////////////////////////// +! create the dataset +!////////////////////////////////////////////////////////// + +call h5dcreate_f(file_id, "dset", H5T_NATIVE_INTEGER, fspace_id, dset_id, hdferror, dcpl_id) + +!////////////////////////////////////////////////////////// +! define hyperslab +!////////////////////////////////////////////////////////// + +counti(1) = icount +start(1) = istart + +!////////////////////////////////////////////////////////// +! select hyperslab in memory +!////////////////////////////////////////////////////////// + +call h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) + +!////////////////////////////////////////////////////////// +! select hyperslab in the file +!////////////////////////////////////////////////////////// + +call h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) + +!////////////////////////////////////////////////////////// +! create a property list for collective dataset write +!////////////////////////////////////////////////////////// + +call h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) +if (do_collective) call h5pset_dxpl_mpio_f(dxpl_id, H5FD_MPIO_COLLECTIVE_F, hdferror) + +!////////////////////////////////////////////////////////// +! write dataset +!////////////////////////////////////////////////////////// + +call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wbuf, dims, hdferror, file_space_id = fspace_id, mem_space_id = mspace_id, xfer_prp = dxpl_id) + +!////////////////////////////////////////////////////////// +! close HDF5 I/O +!////////////////////////////////////////////////////////// + +call h5sclose_f(fspace_id, hdferror) +call h5dclose_f(dset_id, hdferror) +call h5pclose_f(fapl_id, hdferror) +call h5fclose_f(file_id, hdferror) + +!////////////////////////////////////////////////////////// +! reopen file with read access +!////////////////////////////////////////////////////////// + +call h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) +call h5pset_fapl_mpio_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) +call h5fopen_f("parf.h5", H5F_ACC_RDWR_F, file_id, hdferror, access_prp = fapl_id) + +call h5screate_simple_f(1, dims, fspace_id, hdferror) +call h5screate_simple_f(1, dims, mspace_id, hdferror) +call h5dopen_f(file_id, "dset", dset_id, hdferror) + +!////////////////////////////////////////////////////////// +! select hyperslab in memory +!////////////////////////////////////////////////////////// + +call h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) + +!////////////////////////////////////////////////////////// +! select hyperslab in the file +!////////////////////////////////////////////////////////// + +call h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) + +!////////////////////////////////////////////////////////// +! create a property list for collective dataset write +!////////////////////////////////////////////////////////// + +call h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) +if (do_collective) call h5pset_dxpl_mpio_f(dxpl_id, H5FD_MPIO_COLLECTIVE_F, hdferror) + +!////////////////////////////////////////////////////////// +! read dataset +!////////////////////////////////////////////////////////// + +call h5dread_f(dset_id, H5T_NATIVE_INTEGER, rbuf, dims, hdferror, file_space_id = fspace_id, mem_space_id = mspace_id, xfer_prp = dxpl_id) + +!////////////////////////////////////////////////////////// +! close HDF5 I/O +!////////////////////////////////////////////////////////// + +call h5sclose_f(fspace_id, hdferror) +call h5dclose_f(dset_id, hdferror) +call h5pclose_f(fapl_id, hdferror) +call h5fclose_f(file_id, hdferror) + + +!////////////////////////////////////////////////////////// +! compare read and write data. each process compares a subset of the array +!////////////////////////////////////////////////////////// + +do i = istart, iend-1 + if( wbuf(i) /= rbuf(i)) then + write(*,*) 'buffers differs at ', i, rbuf(i), wbuf(i) + nerrors = nerrors + 1 + endif +enddo + +deallocate(wbuf) +deallocate(rbuf) + +end subroutine hyper + diff --git a/fortran/testpar/ptest.f90 b/fortran/testpar/ptest.f90 new file mode 100644 index 0000000..21948795 --- /dev/null +++ b/fortran/testpar/ptest.f90 @@ -0,0 +1,107 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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 * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +!////////////////////////////////////////////////////////// +! main program for parallel HDF5 Fortran tests +!////////////////////////////////////////////////////////// + +program parallel_test +use hdf5 +implicit none +include 'mpif.h' + +integer :: mpierror ! MPI hdferror flag +integer :: hdferror ! HDF hdferror flag +logical :: do_collective ! use collective MPI I/O +logical :: do_chunk ! use chunking +integer :: nerrors = 0 ! number of errors +integer :: mpi_rank ! rank of the calling process in the communicator +integer :: lenght = 12000 ! lenght of array + +!////////////////////////////////////////////////////////// +! initialize MPI +!////////////////////////////////////////////////////////// + +call mpi_init(mpierror) +call mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror ) + +!////////////////////////////////////////////////////////// +! initialize the HDF5 fortran interface +!////////////////////////////////////////////////////////// + +call h5open_f(hdferror) + +!////////////////////////////////////////////////////////// +! test write/read dataset by hyperslabs with independent MPI I/O +!////////////////////////////////////////////////////////// + +if (mpi_rank == 0) write(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, independent MPI I/O)' + +do_collective = .false. +do_chunk = .false. +call hyper(lenght,do_collective,do_chunk,nerrors) + +!////////////////////////////////////////////////////////// +! test write/read dataset by hyperslabs with collective MPI I/O +!////////////////////////////////////////////////////////// + +if (mpi_rank == 0) write(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, collective MPI I/O)' + +do_collective = .true. +do_chunk = .false. +call hyper(lenght,do_collective,do_chunk,nerrors) + +!////////////////////////////////////////////////////////// +! test write/read dataset by hyperslabs with independent MPI I/O +!////////////////////////////////////////////////////////// + +if (mpi_rank == 0) write(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, independent MPI I/O)' + +do_collective = .false. +do_chunk = .true. +call hyper(lenght,do_collective,do_chunk,nerrors) + +!////////////////////////////////////////////////////////// +! test write/read dataset by hyperslabs with collective MPI I/O +!////////////////////////////////////////////////////////// + +if (mpi_rank == 0) write(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, collective MPI I/O)' + +do_collective = .true. +do_chunk = .true. +call hyper(lenght,do_collective,do_chunk,nerrors) + +!////////////////////////////////////////////////////////// +! close HDF5 interface +!////////////////////////////////////////////////////////// + +call h5close_f(hdferror) + +!////////////////////////////////////////////////////////// +! close MPI +!////////////////////////////////////////////////////////// + +if (nerrors == 0) then + call mpi_finalize(mpierror) +else + write(*,*) 'Errors detected in process ', mpi_rank + call mpi_abort(MPI_COMM_WORLD, 1, mpierror) +endif + +!////////////////////////////////////////////////////////// +! end main program +!////////////////////////////////////////////////////////// + +end program parallel_test + diff --git a/fortran/testpar/ptesthdf5_fortran.f90 b/fortran/testpar/ptesthdf5_fortran.f90 deleted file mode 100644 index 0edb0ff..0000000 --- a/fortran/testpar/ptesthdf5_fortran.f90 +++ /dev/null @@ -1,86 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! 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 * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! Main program for parallel HDF5 Fortran tests. - - PROGRAM PHDF5F90TEST - - USE HDF5 ! This module contains all necessary modules - USE THDF5 -! USE MPI - - IMPLICIT NONE - INTEGER :: h5retcode ! HDF5 call return code - INTEGER :: nerrors = 0 ! Error flags - ! - ! MPI definitions and calls. - ! - INTEGER :: mpiretcode ! MPI calls return code - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank - LOGICAL :: cleanup = .TRUE. -! LOGICAL :: cleanup = .FALSE. - comm = MPI_COMM_WORLD - info = MPI_INFO_NULL - CALL MPI_INIT(mpiretcode) - CALL MPI_COMM_SIZE(comm, mpi_size, mpiretcode) - CALL MPI_COMM_RANK(comm, mpi_rank, mpiretcode) - ! - ! Check that datasets can be divided into equal parts by the processes. - ! - if ( (mod(DIM1, mpi_size) .ne. 0) .or. (mod(DIM2, mpi_size) .ne. 0)) then - if (mpi_rank .eq. 0) then - write(*,*) "Number of processors is", mpi_size - write(*,*) "It must be a factor of ", DIM1, " and ", DIM2 - write(*,*) "Exiting..." - endif - nerrors = nerrors + 1 - goto 1000 - endif - ! - ! Initialize FORTRAN predefined datatypes - ! - CALL h5open_f(h5retcode) - if (mpi_rank .eq. 0) then - write(*,*) '===========================================' - write(*,*) ' Parallel Fortran Tests ' - write(*,*) '===========================================' - write(*,*) - endif - if (mpi_rank .eq. 0) then - write(*,*) 'Writing/reading dataset by hyperslabs' - endif - CALL dataset_wr_by_hyperslabs(cleanup, nerrors) - if (nerrors .ne. 0 ) write(*,*) 'Process ', mpi_rank, 'reports failure' - if (mpi_rank .eq. 0) then - write(*,*) - write(*,*) '===========================================' - write(*,*) ' Parallel Fortran Tests finished ' - write(*,*) '===========================================' - endif - ! - ! Close FORTRAN predefined datatypes. - ! - CALL h5close_f(h5retcode) - -1000 continue - - if (nerrors .eq. 0) then - CALL MPI_FINALIZE(mpiretcode) - else - CALL MPI_ABORT(MPI_COMM_WORLD, 1, mpiretcode) - endif - - END PROGRAM PHDF5F90TEST diff --git a/fortran/testpar/thdf5.f90 b/fortran/testpar/thdf5.f90 deleted file mode 100644 index 9dc6cab..0000000 --- a/fortran/testpar/thdf5.f90 +++ /dev/null @@ -1,25 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! 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 * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! - MODULE THDF5 - USE HDF5 - include 'mpif.h' -! USE MPI - -! Dataset dimensions - - INTEGER, PARAMETER :: DIM1 = 120, & - DIM2 = 240 - - END MODULE THDF5 diff --git a/fortran/testpar/thyperslab_wr.f90 b/fortran/testpar/thyperslab_wr.f90 deleted file mode 100644 index a9f6f06..0000000 --- a/fortran/testpar/thyperslab_wr.f90 +++ /dev/null @@ -1,253 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! 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 * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! This test writes/reads dataset by hyperslabs collectively. - - SUBROUTINE dataset_wr_by_hyperslabs(cleanup, total_error) - USE THDF5 - IMPLICIT NONE - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(OUT) :: total_error - - CHARACTER(LEN=8), PARAMETER :: filename = "par_sdsf" ! File name - CHARACTER(LEN=80) :: fix_filename - CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: filespace ! Dataspace identifier in file - INTEGER(HID_T) :: memspace ! Dataspace identifier in memory - INTEGER(HID_T) :: plac_id ! Property list identifier - INTEGER(HID_T) :: plxfer_id ! Property list identifier - - INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/DIM1,DIM2/) ! Dataset dimensions. - - INTEGER(HSIZE_T), DIMENSION(2) :: count - INTEGER(HSIZE_T), DIMENSION(2) :: offset - INTEGER, ALLOCATABLE :: data (:,:) ! Data to write - INTEGER, ALLOCATABLE :: data_out (:,:) ! Buffer to store data - INTEGER :: rank = 2 ! Dataset rank - INTEGER :: i, j - INTEGER(HSIZE_T), DIMENSION(2) :: dims - INTEGER(HID_T) :: driver - - INTEGER :: error ! Error flag - ! - ! MPI definitions and calls. - ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank - comm = MPI_COMM_WORLD - info = MPI_INFO_NULL - CALL MPI_COMM_SIZE(comm, mpi_size, mpierror) - CALL MPI_COMM_RANK(comm, mpi_rank, mpierror) - ! - ! Setup file access property list with parallel I/O access. - ! - CALL h5pcreate_f(H5P_FILE_ACCESS_F, plac_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_mpio_f(plac_id, comm, info, error) - CALL check("h5pset_fapl_mpio_f", error, total_error) - CALL h5pget_driver_f(plac_id, driver, error) - CALL check("h5pget_driver_f", error, total_error) - if( driver .ne. H5FD_MPIO_F) then - write(*,*) "Wrong driver information returned" - endif - CALL h5_fixname_f(filename, fix_filename, plac_id, error) - - ! - ! Create the file collectively. - ! - CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plac_id) - CALL check("h5fcreate_f", error, total_error) - CALL h5pclose_f(plac_id, error) - CALL check("h5pclose_f", error, total_error) - ! - ! Create the data space for the dataset. - ! - CALL h5screate_simple_f(rank, dimsf, filespace, error) - CALL check("h5screate_simple_f", error, total_error) - - ! - ! Create the dataset with default properties. - ! - CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, filespace, & - dset_id, error) - CALL check("h5dcreate_f", error, total_error) - CALL h5sclose_f(filespace, error) - CALL check("h5sclose_f", error, total_error) - ! - ! Each process defines dataset in memory and writes it to the hyperslab - ! in the file. - ! - count(1) = dimsf(1) - count(2) = dimsf(2)/mpi_size - offset(1) = 0 - offset(2) = mpi_rank * count(2) - CALL h5screate_simple_f(rank, count, memspace, error) - CALL check("h5screate_simple_f", error, total_error) - ! - ! Select hyperslab in the file. - ! - CALL h5dget_space_f(dset_id, filespace, error) - CALL check("h5dget_space_f", error, total_error) - CALL h5sselect_hyperslab_f (filespace, H5S_SELECT_SET_F, offset, count, error) - CALL check("h5sselect_hyperslab_f", error, total_error) - ! - ! Initialize data buffer with trivial data. - ! - ALLOCATE ( data(count(1),count(2))) - dims(1) = count(1) - dims(2) = count(2) - data = mpi_rank + 10 - ! - ! Create property list for collective dataset write - ! - CALL h5pcreate_f(H5P_DATASET_XFER_F, plxfer_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_dxpl_mpio_f(plxfer_id, H5FD_MPIO_COLLECTIVE_F, error) - CALL check("h5pset_dxpl_mpio_f", error, total_error) - - ! - ! Write the dataset collectively. - ! - CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, dims, error, & - file_space_id = filespace, mem_space_id = memspace, xfer_prp = plxfer_id) - CALL check("h5dwrite_f", error, total_error) - ! - ! Deallocate data buffer. - ! - DEALLOCATE(data) - - ! - ! Close dataspaces. - ! - CALL h5sclose_f(filespace, error) - CALL check("h5sclose_f", error, total_error) - CALL h5sclose_f(memspace, error) - CALL check("h5sclose_f", error, total_error) - - ! - ! Close the dataset. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - - CALL h5pclose_f(plxfer_id, error) - CALL check("h5pclose_f", error, total_error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - ! - ! Reopen the file with || access. - ! - CALL h5pcreate_f(H5P_FILE_ACCESS_F, plac_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_mpio_f(plac_id, comm, info, error) - CALL check("h5pset_fapl_mpio_f", error, total_error) - CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error, plac_id) - CALL check("h5fopen_f", error, total_error) - ! - ! Open dataset. - ! - CALL h5dopen_f(file_id, dsetname, dset_id, error) - CALL check("h5dopen_f", error, total_error) - - ! - ! Each process defines dataset in memory and reads hyperslab - ! from the file. - ! - count(1) = dimsf(1) - count(2) = dimsf(2)/mpi_size - offset(1) = 0 - offset(2) = mpi_rank * count(2) - CALL h5screate_simple_f(rank, count, memspace, error) - CALL check("h5screate_simple_f", error, total_error) - ! - ! Select hyperslab in the file. - ! - CALL h5dget_space_f(dset_id, filespace, error) - CALL check("h5dget_space_f", error, total_error) - CALL h5sselect_hyperslab_f (filespace, H5S_SELECT_SET_F, offset, count, error) - CALL check("h5sselect_hyperslab_f", error, total_error) - ! - ! Allocate data buffer. - ! - ALLOCATE ( data(count(1),count(2))) - ALLOCATE ( data_out(count(1),count(2))) - data = mpi_rank + 10 - ! - ! Create property list for collective dataset write - ! - CALL h5pcreate_f(H5P_DATASET_XFER_F, plxfer_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_dxpl_mpio_f(plxfer_id, H5FD_MPIO_COLLECTIVE_F, error) - CALL check("h5pset_dxpl_mpio_f", error, total_error) - - ! - ! Write the dataset collectively. - ! - CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, dims, error, & - file_space_id = filespace, mem_space_id = memspace, xfer_prp = plxfer_id) - CALL check("h5dread_f", error, total_error) - do j = 1, count(2) - do i = 1, count(1) - if( data(i,j) .ne. data_out(i,j)) then - total_error = total_error + 1 - goto 100 - endif - enddo - enddo - 100 continue - ! - ! Deallocate data buffer. - ! - DEALLOCATE(data) - DEALLOCATE(data_out) - ! - ! Close dataspaces. - ! - CALL h5sclose_f(filespace, error) - CALL check("h5sclose_f", error, total_error) - CALL h5sclose_f(memspace, error) - CALL check("h5sclose_f", error, total_error) - ! - ! Close property list. - ! - CALL h5pclose_f(plxfer_id, error) - CALL check("h5pclose_f", error, total_error) - ! - ! Close dataset. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - - if(cleanup) CALL h5_cleanup_f(filename, plac_id, error) - CALL check("h5_cleanup_f", error, total_error) - - CALL h5pclose_f(plac_id, error) - CALL check("h5pclose_f", error, total_error) - - RETURN - END SUBROUTINE dataset_wr_by_hyperslabs |