allow MPI parallel execution

This commit is contained in:
Martin Diehl 2023-11-26 08:15:40 +01:00
parent 57ee7e86e4
commit d1432e5bd8
1 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
module test_IO module test_IO
use prec use prec
use parallelization
use IO use IO
implicit none(type,external) implicit none(type,external)
@ -14,24 +15,25 @@ subroutine test_IO_run()
real, dimension(30) :: rnd_real real, dimension(30) :: rnd_real
character(len=size(rnd_real)) :: rnd_str character(len=size(rnd_real)) :: rnd_str
character(len=pSTRLEN), dimension(1) :: strarray_out character(len=pSTRLEN), dimension(1) :: strarray_out
character(len=:), allocatable :: str_out character(len=:), allocatable :: str_out, fname
integer :: u,i integer :: u,i
call IO_selfTest() call IO_selfTest()
call random_number(rnd_real) call random_number(rnd_real)
fname = 'test'//IO_intAsStr(worldrank)//'.txt'
do i = 1, size(rnd_real) do i = 1, size(rnd_real)
rnd_str(i:i) = char(32 + int(rnd_real(i)*(127.-32.))) rnd_str(i:i) = char(32 + int(rnd_real(i)*(127.-32.)))
end do end do
open(newunit=u,file='test.txt',status='replace',form='formatted') open(newunit=u,file=fname,status='replace',form='formatted')
write(u,'(a)') rnd_str write(u,'(a)') rnd_str
close(u) close(u)
str_out = IO_read('test.txt') str_out = IO_read(fname)
if (rnd_str//IO_EOL /= str_out) error stop 'IO_read' if (rnd_str//IO_EOL /= str_out) error stop 'IO_read'
strarray_out = IO_readlines('test.txt') strarray_out = IO_readlines(fname)
if (rnd_str /= strarray_out(1)) error stop 'IO_readlines' if (rnd_str /= strarray_out(1)) error stop 'IO_readlines'
end subroutine test_IO_run end subroutine test_IO_run