2017-04-18 03:32:16 +08:00
|
|
|
! COPYRIGHT
|
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
! Copyright by The HDF Group. *
|
|
|
|
! 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 COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:36 +08:00
|
|
|
! distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
! If you do not have access to either file, you may request a copy from *
|
|
|
|
! help@hdfgroup.org. *
|
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
!
|
2020-04-21 07:12:00 +08:00
|
|
|
! This file contains all the configure test programs
|
2016-07-19 03:07:51 +08:00
|
|
|
! used by autotools and cmake. This avoids having to
|
|
|
|
! duplicate code for both cmake and autotool tests.
|
|
|
|
! For autotools, a program below is chosen via a
|
|
|
|
! sed command in aclocal_fc.m4. For cmake, a program
|
2020-04-21 07:12:00 +08:00
|
|
|
! below is chosen via the macro READ_SOURCE in
|
2016-07-19 03:07:51 +08:00
|
|
|
! HDF5UseFortran.cmake
|
|
|
|
!
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_ISO_FORTRAN_ENV
|
|
|
|
USE, INTRINSIC :: ISO_FORTRAN_ENV
|
|
|
|
END PROGRAM PROG_FC_ISO_FORTRAN_ENV
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_SIZEOF
|
|
|
|
i = sizeof(x)
|
|
|
|
END PROGRAM PROG_FC_SIZEOF
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_C_SIZEOF
|
|
|
|
USE ISO_C_BINDING
|
|
|
|
INTEGER(C_INT) :: a
|
|
|
|
INTEGER(C_SIZE_T) :: RESULT
|
|
|
|
RESULT = C_SIZEOF(a)
|
|
|
|
END PROGRAM PROG_FC_C_SIZEOF
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_STORAGE_SIZE
|
|
|
|
INTEGER :: a
|
|
|
|
INTEGER :: RESULT
|
|
|
|
RESULT = STORAGE_SIZE(a)
|
|
|
|
END PROGRAM PROG_FC_STORAGE_SIZE
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE
|
|
|
|
USE ISO_C_BINDING
|
|
|
|
REAL(KIND=C_LONG_DOUBLE) :: d
|
|
|
|
END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE
|
|
|
|
|
|
|
|
PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS
|
|
|
|
USE iso_c_binding
|
|
|
|
IMPLICIT NONE
|
|
|
|
TYPE(C_PTR) :: ptr
|
|
|
|
TYPE(C_FUNPTR) :: funptr
|
|
|
|
CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr
|
|
|
|
ptr = C_LOC(ichr(1:1))
|
|
|
|
END PROGRAM PROG_FC_HAVE_F2003_REQUIREMENTS
|
|
|
|
|
|
|
|
!---- START ----- Check to see C_LONG_DOUBLE is different from C_DOUBLE
|
|
|
|
MODULE type_mod
|
|
|
|
USE ISO_C_BINDING
|
2017-06-29 08:30:45 +08:00
|
|
|
INTERFACE h5t
|
2016-07-19 03:07:51 +08:00
|
|
|
MODULE PROCEDURE h5t_c_double
|
|
|
|
MODULE PROCEDURE h5t_c_long_double
|
|
|
|
END INTERFACE
|
|
|
|
CONTAINS
|
|
|
|
SUBROUTINE h5t_c_double(r)
|
|
|
|
REAL(KIND=C_DOUBLE) :: r
|
|
|
|
END SUBROUTINE h5t_c_double
|
|
|
|
SUBROUTINE h5t_c_long_double(d)
|
|
|
|
REAL(KIND=C_LONG_DOUBLE) :: d
|
|
|
|
END SUBROUTINE h5t_c_long_double
|
|
|
|
END MODULE type_mod
|
|
|
|
PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
|
|
|
|
USE ISO_C_BINDING
|
|
|
|
USE type_mod
|
|
|
|
REAL(KIND=C_DOUBLE) :: r
|
|
|
|
REAL(KIND=C_LONG_DOUBLE) :: d
|
|
|
|
CALL h5t(r)
|
|
|
|
CALL h5t(d)
|
|
|
|
END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
|
|
|
|
!---- END ------- Check to see C_LONG_DOUBLE is different from C_DOUBLE
|
|
|
|
|
|
|
|
!---- START ----- Determine the available KINDs for REALs and INTEGERs
|
|
|
|
PROGRAM FC_AVAIL_KINDS
|
2023-04-12 03:28:32 +08:00
|
|
|
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT
|
2016-07-19 03:07:51 +08:00
|
|
|
IMPLICIT NONE
|
2020-02-28 02:19:29 +08:00
|
|
|
INTEGER :: ik, jk, k, kk, max_decimal_prec
|
|
|
|
INTEGER :: prev_rkind, num_rkinds = 1, num_ikinds = 1
|
2016-07-19 03:07:51 +08:00
|
|
|
INTEGER, DIMENSION(1:10) :: list_ikinds = -1
|
|
|
|
INTEGER, DIMENSION(1:10) :: list_rkinds = -1
|
2020-02-28 02:19:29 +08:00
|
|
|
LOGICAL :: new_kind
|
2020-04-21 07:12:00 +08:00
|
|
|
|
2016-07-19 03:07:51 +08:00
|
|
|
! Find integer KINDs
|
|
|
|
list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
|
|
|
|
DO ik = 2, 36
|
|
|
|
k = SELECTED_INT_KIND(ik)
|
|
|
|
IF(k.LT.0) EXIT
|
|
|
|
IF(k.GT.list_ikinds(num_ikinds))THEN
|
|
|
|
num_ikinds = num_ikinds + 1
|
|
|
|
list_ikinds(num_ikinds) = k
|
|
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
|
|
|
|
DO k = 1, num_ikinds
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'(I0)', ADVANCE='NO') list_ikinds(k)
|
2016-07-19 03:07:51 +08:00
|
|
|
IF(k.NE.num_ikinds)THEN
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'(A)',ADVANCE='NO') ','
|
2016-07-19 03:07:51 +08:00
|
|
|
ELSE
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'()')
|
2016-07-19 03:07:51 +08:00
|
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
|
|
|
|
! Find real KINDs
|
|
|
|
list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
|
|
|
|
max_decimal_prec = 1
|
2020-02-28 02:19:29 +08:00
|
|
|
prev_rkind=list_rkinds(num_rkinds)
|
2016-07-19 03:07:51 +08:00
|
|
|
|
|
|
|
prec: DO ik = 2, 36
|
2020-02-28 02:19:29 +08:00
|
|
|
exp: DO jk = 1, 700
|
2016-07-19 03:07:51 +08:00
|
|
|
k = SELECTED_REAL_KIND(ik,jk)
|
|
|
|
IF(k.LT.0) EXIT exp
|
2020-02-28 02:19:29 +08:00
|
|
|
IF(k.NE.prev_rkind)THEN
|
2021-12-07 22:27:29 +08:00
|
|
|
! Check if we already have that kind
|
2020-02-28 02:19:29 +08:00
|
|
|
new_kind = .TRUE.
|
|
|
|
DO kk = 1, num_rkinds
|
|
|
|
IF(k.EQ.list_rkinds(kk))THEN
|
|
|
|
new_kind=.FALSE.
|
|
|
|
EXIT
|
|
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
IF(new_kind)THEN
|
|
|
|
num_rkinds = num_rkinds + 1
|
|
|
|
list_rkinds(num_rkinds) = k
|
|
|
|
prev_rkind=list_rkinds(num_rkinds)
|
|
|
|
ENDIF
|
2016-07-19 03:07:51 +08:00
|
|
|
ENDIF
|
|
|
|
max_decimal_prec = ik
|
|
|
|
ENDDO exp
|
|
|
|
ENDDO prec
|
|
|
|
|
|
|
|
DO k = 1, num_rkinds
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'(I0)', ADVANCE='NO') list_rkinds(k)
|
2016-07-19 03:07:51 +08:00
|
|
|
IF(k.NE.num_rkinds)THEN
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'(A)',ADVANCE='NO') ','
|
2016-07-19 03:07:51 +08:00
|
|
|
ELSE
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'()')
|
2016-07-19 03:07:51 +08:00
|
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
|
2023-04-12 03:28:32 +08:00
|
|
|
WRITE(stdout,'(I0)') max_decimal_prec
|
|
|
|
WRITE(stdout,'(I0)') num_ikinds
|
|
|
|
WRITE(stdout,'(I0)') num_rkinds
|
2016-07-19 03:07:51 +08:00
|
|
|
END PROGRAM FC_AVAIL_KINDS
|
|
|
|
!---- END ----- Determine the available KINDs for REALs and INTEGERs
|
|
|
|
|
|
|
|
PROGRAM FC_MPI_CHECK
|
|
|
|
INCLUDE 'mpif.h'
|
|
|
|
INTEGER :: comm, amode, info, fh, ierror
|
2020-04-21 07:12:00 +08:00
|
|
|
CHARACTER(LEN=1) :: filename
|
2016-07-19 03:07:51 +08:00
|
|
|
CALL MPI_File_open( comm, filename, amode, info, fh, ierror)
|
|
|
|
END PROGRAM FC_MPI_CHECK
|