Skip to content

Commit

Permalink
Fortran: Restore debug interface and deprecate for supported compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Atkins committed Jun 21, 2022
1 parent 75b52c7 commit d477f14
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 10 deletions.
48 changes: 38 additions & 10 deletions bindings/Fortran/modules/adios2_adios_init_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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( &
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions bindings/Fortran/modules/adios2_adios_init_serial_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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( &
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions bindings/Fortran/modules/adios2_parameters_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d477f14

Please sign in to comment.