|
Packit |
0848f5 |
<fheader/>
|
|
Packit |
0848f5 |
program main
|
|
Packit |
0848f5 |
implicit none
|
|
Packit |
0848f5 |
include 'mpif.h'
|
|
Packit |
0848f5 |
integer maxfparm
|
|
Packit |
0848f5 |
parameter (maxfparm=5)
|
|
Packit |
0848f5 |
integer max_buffer
|
|
Packit |
0848f5 |
parameter (max_buffer=65536)
|
|
Packit |
0848f5 |
integer maxftype
|
|
Packit |
0848f5 |
parameter (maxftype=3)
|
|
Packit |
0848f5 |
C
|
|
Packit |
0848f5 |
integer comm, fh, ftype, itmp, fparm, n, b, i, k, r, s
|
|
Packit |
0848f5 |
integer intsize
|
|
Packit |
0848f5 |
integer errs, toterrs, err, ierr
|
|
Packit |
0848f5 |
integer wrank, wsize
|
|
Packit |
0848f5 |
integer fparms(2,maxfparm)
|
|
Packit |
0848f5 |
character *(100) filename
|
|
Packit |
0848f5 |
<writefiledecl/>
|
|
Packit |
0848f5 |
<readfiledecl/>
|
|
Packit |
0848f5 |
data fparms/1,4000, 4000,8, 4096,8, 64000,8, 65536,8 /
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
errs = 0
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
call MTest_Init( ierr )
|
|
Packit |
0848f5 |
call mpi_comm_rank( MPI_COMM_WORLD, wrank, ierr )
|
|
Packit |
0848f5 |
call mpi_comm_size( MPI_COMM_WORLD, wsize, ierr )
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
call mpi_type_size( MPI_INTEGER, intsize, ierr )
|
|
Packit |
0848f5 |
do ftype = 1, maxftype
|
|
Packit |
0848f5 |
filename = "iotest.txt"
|
|
Packit |
0848f5 |
if (ftype .eq. 1) then
|
|
Packit |
0848f5 |
comm = MPI_COMM_WORLD
|
|
Packit |
0848f5 |
elseif (ftype .eq. 2) then
|
|
Packit |
0848f5 |
call mpi_comm_split( MPI_COMM_WORLD, 0, wsize - wrank, comm, ierr )
|
|
Packit |
0848f5 |
<checkErr/>
|
|
Packit |
0848f5 |
else
|
|
Packit |
0848f5 |
itmp = 1
|
|
Packit |
0848f5 |
if (wrank .eq. 0) itmp = 0
|
|
Packit |
0848f5 |
call mpi_comm_split( MPI_COMM_WORLD, itmp, wrank, comm, ierr )
|
|
Packit |
0848f5 |
<checkErr/>
|
|
Packit |
0848f5 |
if (wrank .eq. 0) then
|
|
Packit |
0848f5 |
goto 10
|
|
Packit |
0848f5 |
endif
|
|
Packit |
0848f5 |
endif
|
|
Packit |
0848f5 |
call mpi_comm_size( comm, s, ierr )
|
|
Packit |
0848f5 |
call mpi_comm_rank( comm, r, ierr )
|
|
Packit |
0848f5 |
do fparm=1, maxfparm
|
|
Packit |
0848f5 |
n = fparms(1,fparm)
|
|
Packit |
0848f5 |
b = fparms(2,fparm)
|
|
Packit |
0848f5 |
C Try writing the file, then check it
|
|
Packit |
0848f5 |
<openfile/>
|
|
Packit |
0848f5 |
<writefile/>
|
|
Packit |
0848f5 |
<closefile/>
|
|
Packit |
0848f5 |
<checkfile/>
|
|
Packit |
0848f5 |
C Now, open the same file for reading
|
|
Packit |
0848f5 |
<openfile/>
|
|
Packit |
0848f5 |
<readfile/>
|
|
Packit |
0848f5 |
<closefile/>
|
|
Packit |
0848f5 |
<deletefile/>
|
|
Packit |
0848f5 |
enddo
|
|
Packit |
0848f5 |
10 continue
|
|
Packit |
0848f5 |
C
|
|
Packit |
0848f5 |
C Jump to 111 on a failure to open
|
|
Packit |
0848f5 |
111 continue
|
|
Packit |
0848f5 |
if (comm .ne. MPI_COMM_WORLD) then
|
|
Packit |
0848f5 |
call mpi_comm_free( comm, ierr )
|
|
Packit |
0848f5 |
endif
|
|
Packit |
0848f5 |
enddo
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
call MTest_Finalize( errs )
|
|
Packit |
0848f5 |
call mpi_finalize( ierr )
|
|
Packit |
0848f5 |
end
|