Skip to content

Commit

Permalink
Merge pull request ESMCI#1525 from NCAR/ejh_warn_3
Browse files Browse the repository at this point in the history
Fix more fortran warnings
  • Loading branch information
edhartnett authored Jun 25, 2019
2 parents 2928ce3 + 5f4769b commit 9a6b5eb
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 44 deletions.
16 changes: 0 additions & 16 deletions examples/c/darray_no_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ char dim_name[NDIM3][PIO_MAX_NAME + 1] = {"unlimted", "x", "y"};
#define DECOMP_TITLE "Example Decomposition from darray_no_async.c"
#define DECOMP_HISTORY "This file is created by the program darray_no_async in the PIO C library"

/* Handle MPI errors. This should only be used with MPI library
* function calls. */
#define MPIERR(e) do { \
MPI_Error_string(e, err_buffer, &resultlen); \
printf("MPI error, line %d, file %s: %s\n", __LINE__, __FILE__, err_buffer); \
MPI_Finalize(); \
return 2; \
} while (0)

/* Handle non-MPI errors by finalizing the MPI library and exiting
* with an exit code. */
#define ERR(e) do { \
MPI_Finalize(); \
return e; \
} while (0)

/* Global err buffer for MPI. When there is an MPI error, this buffer
* is used to store the error message that is associated with the MPI
* error. */
Expand Down
2 changes: 1 addition & 1 deletion src/clib/pio_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
MPI_Error_string(e, err_buffer, &resultlen); \
fprintf(stderr, "MPI error, line %d, file %s: %s\n", __LINE__, __FILE__, err_buffer); \
MPI_Finalize(); \
return ERR_AWFUL; \
return PIO_EIO; \
} while (0)

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/general/pio_decomp_frame_tests.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_4d_col_decomp
PIO_TF_FC_DATA_TYPE, dimension(:,:,:,:), allocatable :: rbuf, wbuf, exp_val
integer, dimension(NDIMS-1) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, k, tmp_idx, ierr, lsz, nrows, ncols, nhgts
integer :: i, j, k, tmp_idx, ierr, nrows, ncols, nhgts
integer(kind=pio_offset_kind) :: f
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
Expand Down Expand Up @@ -244,7 +244,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_reuse_3d_decomp
PIO_TF_FC_DATA_TYPE, dimension(:,:,:), allocatable :: rbuf3d, wbuf3d, exp_val3d
integer, dimension(NDIMS-1) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, k, tmp_idx, ierr, lsz, nrows, ncols, nhgts
integer :: i, j, k, tmp_idx, ierr, nrows, ncols, nhgts
integer(kind=pio_offset_kind) :: f
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
Expand Down Expand Up @@ -434,7 +434,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_test_limited_time_dim
PIO_TF_FC_DATA_TYPE, dimension(:,:,:,:), allocatable :: rbuf, wbuf, exp_val
integer, dimension(NDIMS-1) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, k, tmp_idx, ierr, lsz, nrows, ncols, nhgts
integer :: i, j, k, tmp_idx, ierr, nrows, ncols, nhgts
integer(kind=pio_offset_kind) :: f
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
Expand Down
8 changes: 4 additions & 4 deletions tests/general/pio_decomp_tests_2d.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_2d_col_decomp
PIO_TF_FC_DATA_TYPE, dimension(:,:), allocatable :: rbuf, wbuf, exp_val
integer, dimension(NDIMS) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, tmp_idx, ierr, lsz, nrows, ncols
integer :: i, j, tmp_idx, ierr, nrows, ncols
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
character(len=PIO_TF_MAX_STR_LEN), dimension(:), allocatable :: iotype_descs
Expand All @@ -184,7 +184,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_2d_col_decomp
do i=1,nrows
wbuf(i,j) = (start(2) - 1 + j - 1) * nrows + i
tmp_idx = (j - 1) * nrows + i
compdof(tmp_idx) = wbuf(i,j)
compdof(tmp_idx) = int(wbuf(i,j))
end do
end do

Expand Down Expand Up @@ -274,7 +274,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_2d_row_decomp
PIO_TF_FC_DATA_TYPE, dimension(:,:), allocatable :: rbuf, wbuf, exp_val
integer, dimension(NDIMS) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, tmp_idx, ierr, lsz, nrows, ncols
integer :: i, j, tmp_idx, ierr, nrows, ncols
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
character(len=PIO_TF_MAX_STR_LEN), dimension(:), allocatable :: iotype_descs
Expand All @@ -291,7 +291,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_2d_row_decomp
do i=1,nrows
wbuf(i,j) = (start(2) - 1 + j - 1) * dims(1) + start(1) + i - 1
tmp_idx = (j - 1) * nrows + i
compdof(tmp_idx) = wbuf(i,j)
compdof(tmp_idx) = int(wbuf(i,j))
end do
end do

Expand Down
4 changes: 2 additions & 2 deletions tests/general/pio_decomp_tests_3d.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_3d_col_decomp
PIO_TF_FC_DATA_TYPE, dimension(:,:,:), allocatable :: rbuf, wbuf, exp_val
integer, dimension(NDIMS) :: dims
integer, dimension(NDIMS) :: pio_dims
integer :: i, j, k, tmp_idx, ierr, lsz, nrows, ncols, nhgts
integer :: i, j, k, tmp_idx, ierr, nrows, ncols, nhgts
! iotypes = valid io types
integer, dimension(:), allocatable :: iotypes
character(len=PIO_TF_MAX_STR_LEN), dimension(:), allocatable :: iotype_descs
Expand All @@ -125,7 +125,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_read_3d_col_decomp
wbuf(i,j,k) = (start(3) - 1 + k - 1) * (dims(1) * dims(2)) +&
(start(2) - 1 + j - 1) * dims(1) + i
tmp_idx = (k - 1) * (ncols * nrows) + (j - 1) * nrows + i
compdof(tmp_idx) = wbuf(i,j,k)
compdof(tmp_idx) = int(wbuf(i,j,k))
end do
end do
end do
Expand Down
11 changes: 4 additions & 7 deletions tests/general/pio_iosystem_tests.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ END SUBROUTINE create_file
! Check the contents of file : Check the
! global attribute 'filename' (should be equal to the
! name of the file, fname)
SUBROUTINE check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
SUBROUTINE check_file(comm, pio_file, fname, attname, dimname, ret)
use pio_tutil
implicit none

integer, intent(in) :: comm
type(iosystem_desc_t), intent(inout) :: iosys
integer, intent(in) :: iotype
type(file_desc_t), intent(inout) :: pio_file
character(len=*), intent(in) :: fname
character(len=*), intent(in) :: attname
Expand Down Expand Up @@ -148,7 +146,7 @@ SUBROUTINE open_and_check_file(comm, iosys, iotype, pio_file, fname, &
ret = PIO_openfile(iosys, pio_file, iotype, fname, PIO_write)
PIO_TF_CHECK_ERR(ret, comm, "Failed to open:" // fname)

call check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
call check_file(comm, pio_file, fname, attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, comm, "Checking contents of file failed:" // fname)

if(.not. disable_fclose) then
Expand Down Expand Up @@ -227,7 +225,6 @@ PIO_TF_AUTO_TEST_SUB_BEGIN two_iosystems_even_all
character(len=PIO_TF_MAX_STR_LEN), target :: fname2 = "pio_iosys_test_file2.nc"
character(len=PIO_TF_MAX_STR_LEN), parameter :: attname = "filename"
character(len=PIO_TF_MAX_STR_LEN), parameter :: dimname = "filename_dim"
character(len=PIO_TF_MAX_STR_LEN), pointer :: fname
integer, dimension(:), allocatable :: iotypes
character(len=PIO_TF_MAX_STR_LEN), dimension(:), allocatable :: iotype_descs
integer :: i, num_iotypes = 0
Expand Down Expand Up @@ -280,13 +277,13 @@ PIO_TF_AUTO_TEST_SUB_BEGIN two_iosystems_even_all
! Check contents of the files again
! - PIO called from odd and even processes separately with odd_even_iosys
if(is_even) then
call check_file(odd_even_comm, odd_even_iosys, iotypes(i), pio_file1, &
call check_file(odd_even_comm, pio_file1, &
fname1, attname, dimname, ret)
!call PIO_closefile(pio_file1)
end if
PIO_TF_CHECK_ERR(ret, "Checking contents of file failed :" // fname1)

call check_file(pio_tf_comm_, pio_tf_iosystem_, iotypes(i), pio_file2, &
call check_file(pio_tf_comm_, pio_file2, &
fname2, attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, "Checking contents of file failed :" // fname2)

Expand Down
8 changes: 3 additions & 5 deletions tests/general/pio_iosystem_tests2.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ END SUBROUTINE create_file
! Check the contents of file : Check the
! global attribute 'filename' (should be equal to the
! name of the file, fname)
SUBROUTINE check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
SUBROUTINE check_file(comm, pio_file, fname, attname, dimname, ret)
use pio_tutil
implicit none

integer, intent(in) :: comm
type(iosystem_desc_t), intent(inout) :: iosys
integer, intent(in) :: iotype
type(file_desc_t), intent(inout) :: pio_file
character(len=*), intent(in) :: fname
character(len=*), intent(in) :: attname
Expand Down Expand Up @@ -148,7 +146,7 @@ SUBROUTINE open_and_check_file(comm, iosys, iotype, pio_file, fname, &
ret = PIO_openfile(iosys, pio_file, iotype, fname, PIO_write)
PIO_TF_CHECK_ERR(ret, comm, "Failed to open:" // fname)

call check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
call check_file(comm, pio_file, fname, attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, comm, "Checking contents of file failed:" // fname)

if(.not. disable_fclose) then
Expand Down Expand Up @@ -221,7 +219,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN three_files_two_iosystems_odd_even
PIO_TF_CHECK_ERR(ret, "Checking contents of file failed :" // fname)

! Make sure that we can still check the contents of the file
call check_file(odd_even_comm, odd_even_iosys, iotypes(i), pio_file, &
call check_file(odd_even_comm, pio_file, &
fname, attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, "Checking (second) contents of file failed :" // fname)

Expand Down
10 changes: 4 additions & 6 deletions tests/general/pio_iosystem_tests3.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,11 @@ END SUBROUTINE create_file
! Check the contents of file : Check the
! global attribute 'filename' (should be equal to the
! name of the file, fname)
SUBROUTINE check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
SUBROUTINE check_file(comm, pio_file, fname, attname, dimname, ret)
use pio_tutil
implicit none

integer, intent(in) :: comm
type(iosystem_desc_t), intent(inout) :: iosys
integer, intent(in) :: iotype
type(file_desc_t), intent(inout) :: pio_file
character(len=*), intent(in) :: fname
character(len=*), intent(in) :: attname
Expand Down Expand Up @@ -164,7 +162,7 @@ SUBROUTINE open_and_check_file(comm, iosys, iotype, pio_file, fname, &
ret = PIO_openfile(iosys, pio_file, iotype, fname, PIO_write)
PIO_TF_CHECK_ERR(ret, comm, "Failed to open:" // fname)

call check_file(comm, iosys, iotype, pio_file, fname, attname, dimname, ret)
call check_file(comm, pio_file, fname, attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, comm, "Checking contents of file failed:" // fname)

if(.not. disable_fclose) then
Expand Down Expand Up @@ -257,8 +255,8 @@ PIO_TF_AUTO_TEST_SUB_BEGIN three_files_two_iosystems_with_overlap
PIO_TF_CHECK_ERR(ret, overlapped_comms(j), "Checking contents of file failed :" // fname)

! Make sure that we can still check the contents of the file
call check_file(overlapped_comms(j), overlapped_iosys(j), iotypes(i), &
pio_files(j), fname, attname, dimname, ret)
call check_file(overlapped_comms(j), pio_files(j), fname, &
attname, dimname, ret)
PIO_TF_CHECK_ERR(ret, overlapped_comms(j), "Checking (second) contents of file failed :" // fname)
end if
end do
Expand Down

0 comments on commit 9a6b5eb

Please sign in to comment.