Skip to content

Commit

Permalink
CI: Enable & adapt the code Wall fortran
Browse files Browse the repository at this point in the history
This commit removes multiple unused variables and makes explicit
multiple integer/real casts.

- Removes several trailing whitespaces

Signed-off-by: Vicente Adolfo Bolea Sanchez <[email protected]>
  • Loading branch information
vicentebolea committed Aug 20, 2021
1 parent ac70b0d commit d9bb667
Show file tree
Hide file tree
Showing 59 changed files with 254 additions and 159 deletions.
1 change: 1 addition & 0 deletions bindings/Fortran/modules/adios2_adios_init_mpi_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module adios2_adios_init_mpi_mod
module procedure adios2_init_config_debug_mpi
end interface
#endif
external adios2_init_config_mpi_f2c

contains

Expand Down
1 change: 1 addition & 0 deletions bindings/Fortran/modules/adios2_adios_init_serial_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module adios2_adios_init_serial_mod
module procedure adios2_init_config_debug_serial
end interface
#endif
external adios2_init_config_serial_f2c

contains

Expand Down
12 changes: 12 additions & 0 deletions bindings/Fortran/modules/adios2_adios_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ module adios2_adios_mod
use adios2_adios_init_mod
implicit none

external adios2_declare_io_f2c
external adios2_io_engine_type_length_f2c
external adios2_io_engine_type_f2c
external adios2_at_io_f2c
external adios2_define_operator_f2c
external adios2_inquire_operator_f2c
external adios2_operator_type_length_f2c
external adios2_operator_type_f2c
external adios2_flush_all_f2c
external adios2_remove_io_f2c
external adios2_remove_all_ios_f2c
external adios2_finalize_f2c
contains

subroutine adios2_declare_io(io, adios, io_name, ierr)
Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_attribute_data_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module adios2_attribute_data_mod

end interface

external adios2_attribute_data_f2c
external adios2_attribute_value_f2c
contains

! Single value
Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_attribute_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ subroutine adios2_attribute_name(name, attribute, ierr)
character(len=:), allocatable, intent(out) :: name
type(adios2_attribute), intent(in) :: attribute
integer, intent(out) :: ierr
external adios2_attribute_name_length_f2c
external adios2_attribute_name_f2c

!local
integer :: length
Expand Down
1 change: 1 addition & 0 deletions bindings/Fortran/modules/adios2_engine_begin_step_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module adios2_engine_begin_step_mod
module procedure adios2_begin_step_default

end interface
external adios2_begin_step_f2c

contains

Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_engine_get_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ module adios2_engine_get_mod


end interface
external adios2_get_f2c
external adios2_get_by_name_f2c

contains

Expand Down
9 changes: 9 additions & 0 deletions bindings/Fortran/modules/adios2_engine_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ module adios2_engine_mod
use adios2_engine_put_mod
use adios2_engine_get_mod
implicit none
external adios2_close_f2c
external adios2_current_step_f2c
external adios2_end_step_f2c
external adios2_flush_f2c
external adios2_lock_reader_selections_f2c
external adios2_lock_writer_definitions_f2c
external adios2_perform_gets_f2c
external adios2_perform_puts_f2c
external adios2_steps_f2c

contains

Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_engine_put_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ module adios2_engine_put_mod
module procedure adios2_put_deferred_by_name_integer8_6d

end interface
external adios2_put_f2c
external adios2_put_by_name_f2c

contains

Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_io_define_attribute_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ module adios2_io_define_attribute_mod
module procedure adios2_def_var_att_sep_integer8_1d

end interface
external adios2_define_vattr_f2c
external adios2_define_vattr_array_f2c

contains

Expand Down
3 changes: 3 additions & 0 deletions bindings/Fortran/modules/adios2_io_define_variable_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module adios2_io_define_variable_mod

end interface

external adios2_define_global_variable_f2c
external adios2_define_variable_f2c

contains

subroutine adios2_define_variable_value(variable, io, name, adios2_type, &
Expand Down
24 changes: 23 additions & 1 deletion bindings/Fortran/modules/adios2_io_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ module adios2_io_mod
use adios2_variable_mod
implicit none

external adios2_add_transport_f2c
external adios2_attribute_is_value_f2c
external adios2_attribute_length_f2c
external adios2_attribute_type_f2c
external adios2_clear_parameters_f2c
external adios2_flush_all_engines_f2c
external adios2_get_parameter_f2c
external adios2_get_parameter_length_f2c
external adios2_in_config_file_f2c
external adios2_inquire_attribute_f2c
external adios2_inquire_variable_f2c
external adios2_io_engine_type_f2c
external adios2_io_engine_type_length_f2c
external adios2_remove_all_attributes_f2c
external adios2_remove_all_variables_f2c
external adios2_remove_attribute_f2c
external adios2_remove_variable_f2c
external adios2_set_engine_f2c
external adios2_set_parameter_f2c
external adios2_set_parameters_f2c
external adios2_set_transport_parameter_f2c

contains

subroutine adios2_in_config_file(result, io, ierr)
Expand Down Expand Up @@ -230,8 +252,8 @@ subroutine adios2_remove_attribute(result, io, name, ierr)
character*(*), intent(in) :: name
logical, intent(out) :: result
integer, intent(out) :: ierr

! Local
type(adios2_attribute):: attribute
integer :: resultInt

call adios2_remove_attribute_f2c(resultInt, io%f2c, &
Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_io_open_mpi_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module adios2_io_open_mpi_mod
module procedure adios2_open_new_comm
end interface
#endif
external adios2_open_new_comm_f2c
external adios2_engine_get_type_f2c

contains

Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_io_open_serial_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ ADIOS2_MODULE_PROCEDURE subroutine adios2_open_old_comm( &
character*(*), intent(in) :: name
integer, intent(in) :: adios2_mode
integer, intent(out) :: ierr
external adios2_open_f2c
external adios2_engine_get_type_f2c

call adios2_open_f2c(engine%f2c, io%f2c, TRIM(ADJUSTL(name))//char(0), &
adios2_mode, ierr)
Expand Down
2 changes: 2 additions & 0 deletions bindings/Fortran/modules/adios2_operator_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ subroutine adios2_operator_type(type, op, ierr)
character(len=:), allocatable, intent(out) :: type
type(adios2_operator), intent(in) :: op
integer, intent(out) :: ierr
external adios2_operator_type_f2c
external adios2_operator_type_length_f2c

!local
integer :: length
Expand Down
1 change: 1 addition & 0 deletions bindings/Fortran/modules/adios2_variable_max_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module adios2_variable_max_mod

end interface

external adios2_variable_max_f2c
contains

subroutine adios2_variable_max_real(maximum, variable, ierr)
Expand Down
1 change: 1 addition & 0 deletions bindings/Fortran/modules/adios2_variable_min_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module adios2_variable_min_mod
module procedure adios2_variable_min_integer8

end interface
external adios2_variable_min_f2c

contains

Expand Down
14 changes: 13 additions & 1 deletion bindings/Fortran/modules/adios2_variable_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@
module adios2_variable_mod
use adios2_functions_mod
implicit none

external adios2_add_operation_f2c
external adios2_set_block_selection_f2c
external adios2_set_memory_selection_f2c
external adios2_set_operation_parameter_f2c
external adios2_set_selection_f2c
external adios2_set_shape_f2c
external adios2_set_step_selection_f2c
external adios2_variable_name_f2c
external adios2_variable_name_length_f2c
external adios2_variable_ndims_f2c
external adios2_variable_shape_f2c
external adios2_variable_steps_f2c
external adios2_variable_type_f2c
contains

subroutine adios2_variable_name(name, variable, ierr)
Expand Down
3 changes: 2 additions & 1 deletion examples/hello/bpFWriteCRead/FReader.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ program FReader

integer(kind=8), dimension(2) :: sel_start, sel_count
real, dimension(:,:), allocatable :: data
integer :: i, j, inx, iny, irank, isize, ierr
integer(kind=8) :: i, j
integer :: irank, isize, ierr

! adios2 handlers
type(adios2_adios):: adios
Expand Down
7 changes: 4 additions & 3 deletions examples/hello/bpReader/helloBPReaderHeatMap3D.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ program helloBPReaderHeatMap3D
integer, dimension(:,:,:), allocatable :: temperatures, sel_temperatures
integer(kind=8), dimension(3) :: ishape, istart, icount
integer(kind=8), dimension(3) :: sel_start, sel_count
integer :: ierr, irank, isize, inx, iny, inz
integer :: i, j, k, iglobal, value, ilinear, icounter
integer(kind=8) :: iglobal, value
integer(kind=8) :: i, j, k
integer(kind=4) :: ierr, irank, isize, inx, iny, inz

#if ADIOS2_USE_MPI
call MPI_INIT(ierr)
Expand All @@ -42,7 +43,7 @@ program helloBPReaderHeatMap3D
iglobal = istart(1) + i
value = (k-1) * ishape(1) * ishape(2) + (j-1) * ishape(1) + &
& (iglobal-1)
temperatures(i,j,k) = value
temperatures(i,j,k) = INT(value)
end do
end do
end do
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/bpWriter/helloBPWriter.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program helloBPWriter

integer(kind=8), dimension(1) :: shape_dims, start_dims, count_dims
real, dimension(:), allocatable :: myArray
integer :: inx, irank, isize, ierr, i, var1_type
integer :: inx, irank, isize, ierr, i
type(adios2_adios) :: adios
type(adios2_io) :: io
type(adios2_variable) :: var1
Expand Down
33 changes: 15 additions & 18 deletions examples/hello/insituMPI/helloInsituArgs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ module helloInsituArgs
integer(kind=8) :: offx, offy ! Offsets of local array in this process
integer :: steps ! number of steps to write
integer :: sleeptime ! wait time between steps in seconds

contains

!!***************************
subroutine usage(isWriter)
logical, intent(in) :: isWriter
if (isWriter) then
logical, intent(in) :: isWriter
if (isWriter) then
print *, "Usage: helloInsituMPIWriter config N M nx ny steps sleeptime"
else
print *, "Usage: helloInsituMPIReader config N M"
Expand All @@ -24,16 +24,16 @@ subroutine usage(isWriter)
print *, "config: path of XML config file"
print *, "N: number of processes in X dimension"
print *, "M: number of processes in Y dimension"
if (isWriter) then
if (isWriter) then
print *, "nx: local array size in X dimension per processor"
print *, "ny: local array size in Y dimension per processor"
print *, "steps: the total number of steps to output"
print *, "steps: the total number of steps to output"
print *, "sleeptime: wait time between steps in seconds"
endif
end subroutine usage
end subroutine usage

!!***************************
subroutine processArgs(rank, nproc, isWriter)
subroutine processArgs(nproc, isWriter)

#if defined(ADIOS2_HAVE_FORTRAN_F03_ARGS)
# define ADIOS2_ARGC() command_argument_count()
Expand All @@ -46,17 +46,16 @@ subroutine processArgs(rank, nproc, isWriter)
# define ADIOS2_ARGV(i, v)
#endif

integer, intent(in) :: rank
integer, intent(in) :: nproc
logical, intent(in) :: isWriter
logical, intent(in) :: isWriter
character(len=256) :: npx_str, npy_str, ndx_str, ndy_str
character(len=256) :: steps_str,time_str
integer :: numargs, expargs

!! expected number of arguments
if (isWriter) then
if (isWriter) then
expargs = 7
else
else
expargs = 3
endif

Expand All @@ -70,15 +69,15 @@ subroutine processArgs(rank, nproc, isWriter)
ADIOS2_ARGV(1, xmlfile)
ADIOS2_ARGV(2, npx_str)
ADIOS2_ARGV(3, npy_str)
if (isWriter) then
if (isWriter) then
ADIOS2_ARGV(4, ndx_str)
ADIOS2_ARGV(5, ndy_str)
ADIOS2_ARGV(6, steps_str)
ADIOS2_ARGV(7, time_str)
endif
read (npx_str,'(i5)') npx
read (npy_str,'(i5)') npy
if (isWriter) then
if (isWriter) then
read (ndx_str,'(i6)') ndx
read (ndy_str,'(i6)') ndy
read (steps_str,'(i6)') steps
Expand All @@ -94,11 +93,10 @@ subroutine processArgs(rank, nproc, isWriter)
end subroutine processArgs

!!******************************************************
subroutine DecomposeArray(gndx, gndy, rank, nproc)
subroutine DecomposeArray(gndx, gndy, rank)
integer(kind=8), intent(in) :: gndx
integer(kind=8), intent(in) :: gndy
integer, intent(in) :: rank
integer, intent(in) :: nproc

posx = mod(rank, npx);
posy = rank / npx;
Expand All @@ -119,6 +117,5 @@ subroutine DecomposeArray(gndx, gndy, rank, nproc)
endif
end subroutine DecomposeArray


end module helloInsituArgs

end module helloInsituArgs
6 changes: 3 additions & 3 deletions examples/hello/insituMPI/helloInsituMPIReader.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ program helloInsituMPIReader
integer(kind=8), dimension(:), allocatable :: shape_dims
integer(kind=8), dimension(:), allocatable :: sel_start, sel_count
integer :: ierr
integer :: i, j, step
integer :: step
integer :: comm, color


Expand All @@ -31,7 +31,7 @@ program helloInsituMPIReader
call MPI_Comm_rank(comm, rank, ierr)
call MPI_Comm_size(comm, nproc, ierr)

call ProcessArgs(rank, nproc, .false.)
call ProcessArgs(nproc, .false.)

! Start adios2
call adios2_init( adios, xmlfile, comm, adios2_debug_mode_on, ierr )
Expand All @@ -55,7 +55,7 @@ program helloInsituMPIReader
if (step == 0) then
call adios2_variable_shape( shape_dims, ndims, varArray, ierr)
! ndims is assumed to be 2 here
call DecomposeArray( shape_dims(1), shape_dims(2), rank, nproc)
call DecomposeArray( shape_dims(1), shape_dims(2), rank)
allocate (sel_start(2), sel_count(2))
sel_start = (/ offx, offy /)
sel_count = (/ ndx, ndy /)
Expand Down
Loading

0 comments on commit d9bb667

Please sign in to comment.