2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-08 01:55:01 +08:00
|
|
|
! Copyright by The HDF Group. *
|
2005-05-04 00:12:39 +08:00
|
|
|
! 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 *
|
2007-02-08 01:55:01 +08:00
|
|
|
! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
! access to either file, you may request a copy from help@hdfgroup.org. *
|
2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2005-05-04 00:12:39 +08:00
|
|
|
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2005-05-04 00:12:39 +08:00
|
|
|
! main program for parallel HDF5 Fortran tests
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2005-05-04 00:12:39 +08:00
|
|
|
|
2008-05-22 03:55:50 +08:00
|
|
|
PROGRAM parallel_test
|
|
|
|
USE hdf5
|
2016-02-19 22:24:11 +08:00
|
|
|
USE MPI
|
|
|
|
USE TH5_MISC
|
2015-02-20 21:59:18 +08:00
|
|
|
|
2008-05-22 03:55:50 +08:00
|
|
|
IMPLICIT NONE
|
|
|
|
|
|
|
|
INTEGER :: mpierror ! MPI hdferror flag
|
|
|
|
INTEGER :: hdferror ! HDF hdferror flag
|
2016-02-19 22:24:11 +08:00
|
|
|
INTEGER :: ret_total_error = 0 ! number of errors in subroutine
|
|
|
|
INTEGER :: total_error = 0 ! sum of the number of errors
|
2010-01-30 12:29:13 +08:00
|
|
|
INTEGER :: mpi_size ! number of processes in the group of communicator
|
|
|
|
INTEGER :: mpi_rank ! rank of the calling process in the communicator
|
2008-05-22 03:55:50 +08:00
|
|
|
INTEGER :: length = 12000 ! length of array
|
2016-02-19 22:24:11 +08:00
|
|
|
INTEGER :: i,j
|
|
|
|
! use collective MPI I/O
|
|
|
|
LOGICAL, DIMENSION(1:2) :: do_collective = (/.FALSE.,.TRUE./)
|
|
|
|
CHARACTER(LEN=11), DIMENSION(1:2) :: chr_collective =(/"independent", "collective "/)
|
|
|
|
! use chunking
|
|
|
|
LOGICAL, DIMENSION(1:2) :: do_chunk = (/.FALSE.,.TRUE./)
|
|
|
|
CHARACTER(LEN=10), DIMENSION(1:2) :: chr_chunk =(/"contiguous", "chunk "/)
|
|
|
|
|
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
! initialize MPI
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
CALL mpi_init(mpierror)
|
|
|
|
IF (mpierror .NE. MPI_SUCCESS) THEN
|
|
|
|
WRITE(*,*) "MPI_INIT *FAILED*"
|
|
|
|
ENDIF
|
|
|
|
CALL mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror )
|
|
|
|
IF (mpierror .NE. MPI_SUCCESS) THEN
|
|
|
|
WRITE(*,*) "MPI_COMM_RANK *FAILED* Process = ", mpi_rank
|
|
|
|
ENDIF
|
|
|
|
CALL mpi_comm_size( MPI_COMM_WORLD, mpi_size, mpierror )
|
|
|
|
IF (mpierror .NE. MPI_SUCCESS) THEN
|
|
|
|
WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank
|
|
|
|
ENDIF
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
! initialize the HDF5 fortran interface
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
CALL h5open_f(hdferror)
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
|
|
|
! test write/read dataset by hyperslabs (contiguous/chunk) with independent/collective MPI I/O
|
|
|
|
!
|
|
|
|
DO i = 1, 2
|
|
|
|
DO j = 1, 2
|
|
|
|
ret_total_error = 0
|
|
|
|
CALL hyper(length, do_collective(j), do_chunk(i), mpi_size, mpi_rank, ret_total_error)
|
|
|
|
IF(mpi_rank==0) CALL write_test_status(ret_total_error, &
|
|
|
|
"Writing/reading dataset by hyperslabs ("//TRIM(chr_chunk(i))//" layout, "//TRIM(chr_collective(j))//" MPI I/O)", &
|
|
|
|
total_error)
|
|
|
|
ENDDO
|
|
|
|
ENDDO
|
|
|
|
|
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
! test write/read several datasets (independent MPI I/O)
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
|
|
|
ret_total_error = 0
|
|
|
|
CALL multiple_dset_write(length, do_collective(1), do_chunk(1), mpi_size, mpi_rank, ret_total_error)
|
|
|
|
IF(mpi_rank==0) CALL write_test_status(ret_total_error, &
|
|
|
|
'Writing/reading several datasets (contiguous layout, independent MPI I/O)', total_error)
|
2008-05-22 03:55:50 +08:00
|
|
|
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
! close HDF5 interface
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
CALL h5close_f(hdferror)
|
|
|
|
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
! close MPI
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
|
|
|
IF (total_error == 0) THEN
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL mpi_finalize(mpierror)
|
2008-05-22 03:55:50 +08:00
|
|
|
IF (mpierror .NE. MPI_SUCCESS) THEN
|
|
|
|
WRITE(*,*) "MPI_FINALIZE *FAILED* Process = ", mpi_rank
|
|
|
|
ENDIF
|
|
|
|
ELSE
|
|
|
|
WRITE(*,*) 'Errors detected in process ', mpi_rank
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror)
|
2008-05-22 03:55:50 +08:00
|
|
|
IF (mpierror .NE. MPI_SUCCESS) THEN
|
|
|
|
WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank
|
|
|
|
ENDIF
|
|
|
|
ENDIF
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! end main program
|
2016-02-19 22:24:11 +08:00
|
|
|
!
|
2008-05-22 03:55:50 +08:00
|
|
|
END PROGRAM parallel_test
|