"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nf_test/ftst_parallel_nasa.F" between
netcdf-fortran-4.4.4.tar.gz and netcdf-fortran-4.4.5.tar.gz

About: NetCDF (network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data (Fortran library).

ftst_parallel_nasa.F  (netcdf-fortran-4.4.4):ftst_parallel_nasa.F  (netcdf-fortran-4.4.5)
skipping to change at line 13 skipping to change at line 13
! for conditions of use. ! for conditions of use.
! This program tests netCDF-4 parallel I/O from fortran. This ! This program tests netCDF-4 parallel I/O from fortran. This
! variation of the test was contributed by Dan at NASA. Thanks Dan! ! variation of the test was contributed by Dan at NASA. Thanks Dan!
program ftst_parallel_nasa program ftst_parallel_nasa
implicit none implicit none
include 'netcdf.inc' include 'netcdf.inc'
include 'mpif.h' include 'mpif.h'
integer mode_flag ! file create mode
integer p, my_rank, ierr
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, p, ierr)
if (my_rank .eq. 0) then
print *, ' '
print *, '*** Testing netCDF-4 parallel I/O from F77 again.'
endif
! There must be 4 procs for this test.
if (p .ne. 4) then
print *, 'This test program must be run on 4 processors.'
stop 2
endif
#ifdef NF_HAS_PNETCDF
mode_flag = IOR(nf_clobber, nf_mpiio)
call parallel_io(mode_flag)
#endif
#ifdef NF_HAS_PARALLEL4
mode_flag = IOR(nf_netcdf4, nf_classic_model)
mode_flag = IOR(mode_flag, nf_clobber)
mode_flag = IOR(mode_flag, nf_mpiio)
call parallel_io(mode_flag)
#endif
call MPI_Finalize(ierr)
if (my_rank .eq. 0) print *,'*** SUCCESS!'
end program ftst_parallel_nasa
subroutine parallel_io(mode_flag)
implicit none
include 'netcdf.inc'
include 'mpif.h'
integer mode_flag ! file create mode
character*(*) FILE_NAME character*(*) FILE_NAME
parameter (FILE_NAME = 'ftst_parallel_nasa.nc') parameter (FILE_NAME = 'ftst_parallel_nasa.nc')
integer MAX_DIMS integer MAX_DIMS
parameter (MAX_DIMS = 2) parameter (MAX_DIMS = 2)
integer NX, NY integer NX, NY
parameter (NX = 16) parameter (NX = 16)
parameter (NY = 16) parameter (NY = 16)
integer NUM_PROC integer NUM_PROC
parameter (NUM_PROC = 4) parameter (NUM_PROC = 4)
integer ncid, varid, dimids(MAX_DIMS) integer ncid, varid, dimids(MAX_DIMS)
integer x_dimid, y_dimid integer x_dimid, y_dimid
real data_out(NY / 2, NX / 2), data_in(NY / 2, NX / 2) real data_out(NY / 2, NX / 2), data_in(NY / 2, NX / 2)
integer mode_flag
integer x, y, retval integer x, y, retval
integer p, my_rank, ierr integer my_rank, ierr
integer start(MAX_DIMS), count(MAX_DIMS) integer start(MAX_DIMS), count(MAX_DIMS)
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr) call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, p, ierr)
if (my_rank .eq. 0) then
print *, ' '
print *, '*** Testing netCDF-4 parallel I/O from F77 again.'
endif
! There must be 4 procs for this test.
if (p .ne. 4) then
print *, 'This test program must be run on 4 processors.'
stop 2
endif
! Create some pretend data. ! Create some pretend data.
do x = 1, NX / 2 do x = 1, NX / 2
do y = 1, NY / 2 do y = 1, NY / 2
data_out(y, x) = real(my_rank) data_out(y, x) = real(my_rank)
end do end do
end do end do
! Create the netCDF file. ! Create the netCDF file.
mode_flag = IOR(nf_netcdf4, nf_clobber)
! mode_flag = IOR(nf_netcdf4, nf_classic_model)
mode_flag = IOR(mode_flag, nf_mpiio)
retval = nf_create_par(FILE_NAME, mode_flag, MPI_COMM_WORLD, retval = nf_create_par(FILE_NAME, mode_flag, MPI_COMM_WORLD,
$ MPI_INFO_NULL, ncid) $ MPI_INFO_NULL, ncid)
if (retval .ne. nf_noerr) stop 3 if (retval .ne. nf_noerr) stop 3
! Define the dimensions. ! Define the dimensions.
retval = nf_def_dim(ncid, "x", NX, x_dimid) retval = nf_def_dim(ncid, "x", NX, x_dimid)
if (retval .ne. nf_noerr) stop 4 if (retval .ne. nf_noerr) stop 4
retval = nf_def_dim(ncid, "y", NY, y_dimid) retval = nf_def_dim(ncid, "y", NY, y_dimid)
if (retval .ne. nf_noerr) stop 5 if (retval .ne. nf_noerr) stop 5
dimids(1) = x_dimid dimids(1) = x_dimid
skipping to change at line 137 skipping to change at line 162
if (data_in(y, x) .ne. my_rank) then if (data_in(y, x) .ne. my_rank) then
print*,data_in(y, x), ' NE ', my_rank print*,data_in(y, x), ' NE ', my_rank
stop 13 stop 13
endif endif
end do end do
end do end do
! Close the file. ! Close the file.
retval = nf_close(ncid) retval = nf_close(ncid)
if (retval .ne. nf_noerr) stop 14 if (retval .ne. nf_noerr) stop 14
end subroutine parallel_io
call MPI_Finalize(ierr)
if (my_rank .eq. 0) print *,'*** SUCCESS!'
end program ftst_parallel_nasa
 End of changes. 7 change blocks. 
18 lines changed or deleted 43 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)