From d477f14134995257528cb20d22358b2afe99e526 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 21 Jun 2022 12:17:56 -0400 Subject: [PATCH] Fortran: Restore debug interface and deprecate for supported compilers --- .../Fortran/modules/adios2_adios_init_mod.F90 | 48 +++++++++++++++---- .../modules/adios2_adios_init_mpi_smod.F90 | 25 ++++++++++ .../modules/adios2_adios_init_serial_smod.F90 | 21 ++++++++ .../Fortran/modules/adios2_parameters_mod.f90 | 4 ++ 4 files changed, 88 insertions(+), 10 deletions(-) diff --git a/bindings/Fortran/modules/adios2_adios_init_mod.F90 b/bindings/Fortran/modules/adios2_adios_init_mod.F90 index 2c2d80d143..012568d597 100644 --- a/bindings/Fortran/modules/adios2_adios_init_mod.F90 +++ b/bindings/Fortran/modules/adios2_adios_init_mod.F90 @@ -7,47 +7,75 @@ ! module adios2_adios_init_mod - #ifdef ADIOS2_HAVE_FORTRAN_SUBMODULES use adios2_parameters_mod implicit none interface adios2_init - module subroutine adios2_init_serial(adios, ierr) type(adios2_adios), intent(out) :: adios integer, intent(out) :: ierr end subroutine + module subroutine adios2_init_debug_serial(adios, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + end subroutine module subroutine adios2_init_config_serial(adios, config_file, ierr) type(adios2_adios), intent(out) :: adios character*(*), intent(in) :: config_file integer, intent(out) :: ierr end subroutine + module subroutine adios2_init_config_debug_serial(adios, config_file, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + character*(*), intent(in) :: config_file + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + end subroutine -# ifdef ADIOS2_HAVE_MPI_F - +#ifdef ADIOS2_HAVE_MPI_F module subroutine adios2_init_mpi(adios, comm, ierr) type(adios2_adios), intent(out) :: adios integer, intent(in) :: comm integer, intent(out) :: ierr end subroutine + module subroutine adios2_init_debug_mpi(adios, comm, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + integer, intent(in) :: comm + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + end subroutine module subroutine adios2_init_config_mpi(adios, config_file, comm, ierr) type(adios2_adios), intent(out) :: adios character*(*), intent(in) :: config_file integer, intent(in) :: comm integer, intent(out) :: ierr end subroutine -# endif - + module subroutine adios2_init_config_debug_mpi(adios, config_file, comm, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + character*(*), intent(in) :: config_file + integer, intent(in) :: comm + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + end subroutine +#endif end interface - #else use adios2_adios_init_serial_mod -# ifdef ADIOS2_HAVE_MPI_F + +#ifdef ADIOS2_HAVE_MPI_F use adios2_adios_init_mpi_mod -# endif +#endif /*ADIOS2_HAVE_MPI_F*/ +#endif /*ADIOS2_HAVE_FORTRAN_SUBMODULES*/ -#endif +#if defined(__GFORTRAN__) && defined(__GNUC__) && (__GNUC__ >= 11) +!GCC$ ATTRIBUTES DEPRECATED :: adios2_init_debug_serial, adios2_init_config_debug_serial +#endif /*DEPRECATED*/ +#ifdef ADIOS2_HAVE_MPI_F +#if defined(__GFORTRAN__) && defined(__GNUC__) && (__GNUC__ >= 11) +!GCC$ ATTRIBUTES DEPRECATED :: adios2_init_debug_mpi, adios2_init_config_debug_mpi +#endif /*DEPRECATED*/ +#endif /*ADIOS2_HAVE_MPI_F*/ end module diff --git a/bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90 b/bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90 index 642c8a5f42..07e49cf5cd 100644 --- a/bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90 +++ b/bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90 @@ -12,6 +12,8 @@ # define ADIOS2_MODULE_PROCEDURE #endif +#define UNUSED_ARG(x) if (.false.) print*,loc(x) + #ifdef ADIOS2_HAVE_FORTRAN_SUBMODULES submodule ( adios2_adios_init_mod ) adios2_adios_init_mpi_smod #else @@ -25,7 +27,9 @@ module adios2_adios_init_mpi_mod #ifndef ADIOS2_HAVE_FORTRAN_SUBMODULES interface adios2_init module procedure adios2_init_mpi + module procedure adios2_init_debug_mpi module procedure adios2_init_config_mpi + module procedure adios2_init_config_debug_mpi end interface #endif external adios2_init_config_mpi_f2c @@ -39,7 +43,17 @@ ADIOS2_MODULE_PROCEDURE subroutine adios2_init_mpi( & integer, intent(out) :: ierr call adios2_init_config_mpi(adios, char(0), comm, ierr) + end subroutine + + ADIOS2_MODULE_PROCEDURE subroutine adios2_init_debug_mpi( & + adios, comm, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + integer, intent(in) :: comm + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + UNUSED_ARG(adios2_debug_mode) + call adios2_init_mpi(adios, comm, ierr) end subroutine ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_mpi( & @@ -54,7 +68,18 @@ ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_mpi( & TRIM(ADJUSTL(config_file))//char(0), & comm, ierr) if( ierr == 0 ) adios%valid = .true. + end subroutine + + ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_debug_mpi( & + adios, config_file, comm, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + character*(*), intent(in) :: config_file + integer, intent(in) :: comm + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + UNUSED_ARG(adios2_debug_mode) + call adios2_init_config_mpi(adios, config_file, comm, ierr) end subroutine #ifdef ADIOS2_HAVE_FORTRAN_SUBMODULES diff --git a/bindings/Fortran/modules/adios2_adios_init_serial_smod.F90 b/bindings/Fortran/modules/adios2_adios_init_serial_smod.F90 index a88b6c6dcc..baf00403fd 100644 --- a/bindings/Fortran/modules/adios2_adios_init_serial_smod.F90 +++ b/bindings/Fortran/modules/adios2_adios_init_serial_smod.F90 @@ -12,6 +12,8 @@ # define ADIOS2_MODULE_PROCEDURE #endif +#define UNUSED_ARG(x) if (.false.) print*,loc(x) + #ifdef ADIOS2_HAVE_FORTRAN_SUBMODULES submodule ( adios2_adios_init_mod ) adios2_adios_init_serial_smod #else @@ -40,7 +42,16 @@ ADIOS2_MODULE_PROCEDURE subroutine adios2_init_serial( & integer, intent(out) :: ierr call adios2_init_config_serial(adios, char(0), ierr) + end subroutine + + ADIOS2_MODULE_PROCEDURE subroutine adios2_init_debug_serial( & + adios, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + UNUSED_ARG(adios2_debug_mode) + call adios2_init_serial(adios, ierr) end subroutine ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_serial( & @@ -52,7 +63,17 @@ ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_serial( & call adios2_init_config_serial_f2c(adios%f2c, config_file, ierr) if( ierr == 0 ) adios%valid = .true. + end subroutine + + ADIOS2_MODULE_PROCEDURE subroutine adios2_init_config_debug_serial( & + adios, config_file, adios2_debug_mode, ierr) + type(adios2_adios), intent(out) :: adios + character*(*), intent(in) :: config_file + logical, intent(in) :: adios2_debug_mode + integer, intent(out) :: ierr + UNUSED_ARG(adios2_debug_mode) + call adios2_init_config_serial(adios, config_file, ierr) end subroutine #ifdef ADIOS2_HAVE_FORTRAN_SUBMODULES diff --git a/bindings/Fortran/modules/adios2_parameters_mod.f90 b/bindings/Fortran/modules/adios2_parameters_mod.f90 index ac89b4f1ed..dbdccfe669 100644 --- a/bindings/Fortran/modules/adios2_parameters_mod.f90 +++ b/bindings/Fortran/modules/adios2_parameters_mod.f90 @@ -11,6 +11,10 @@ module adios2_parameters_mod implicit none + ! DEPRECATED Debug mode + logical, parameter :: adios2_debug_mode_on = .true. + logical, parameter :: adios2_debug_mode_off = .false. + ! Types integer, parameter :: adios2_type_unknown = -1