"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nf_test/ftst_parallel.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.F  (netcdf-fortran-4.4.4):ftst_parallel.F  (netcdf-fortran-4.4.5)
skipping to change at line 14 skipping to change at line 14
! This program tests netCDF-4 variable functions from fortran. ! This program tests netCDF-4 variable functions from fortran.
! $Id: ftst_parallel.F,v 1.5 2010/05/25 13:53:04 ed Exp $ ! $Id: ftst_parallel.F,v 1.5 2010/05/25 13:53:04 ed Exp $
program ftst_parallel program ftst_parallel
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 Fortran 77.'
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
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.nc') parameter (FILE_NAME = 'ftst_parallel.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
integer data_out(NY / 2, NX / 2), data_in(NY / 2, NX / 2) integer 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 Fortran 77.'
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) = my_rank data_out(y, x) = my_rank
end do end do
end do end do
! Create the netCDF file. ! Create the netCDF file.
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) = y_dimid dimids(1) = y_dimid
skipping to change at line 133 skipping to change at line 160
do x = 1, NX / 2 do x = 1, NX / 2
do y = 1, NY / 2 do y = 1, NY / 2
if (data_in(y, x) .ne. my_rank) stop 13 if (data_in(y, x) .ne. my_rank) stop 13
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
call MPI_Finalize(ierr) end subroutine parallel_io
if (my_rank .eq. 0) print *,'*** SUCCESS!'
end program ftst_parallel
 End of changes. 7 change blocks. 
17 lines changed or deleted 44 lines changed or added

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