2 ! { dg-options "-fcoarray=single" }
7 logical, parameter :: debug
= .false
.
10 integer, allocatable
:: n1(:), n2(:), n3(:)
14 write(name
,'(A,I0)') 'dat', this_image()
15 open(newunit
=fd
, file
=name
)
18 call random_seed(size
=n
)
19 allocate(n1(n
), n2(n
), n3(n
))
21 ! Setup repeatable sequences (if co-arrays the seeds should be distinct
22 ! are different). Get the seeds.
24 call random_init(.true
., .true
.)
25 call random_seed(get
=n1
)
26 call random_number(x
) ! This changes internal state.
28 write(fd
,'(A,4F12.6)') 'x = ', x
31 call random_seed(get
=n2
) ! Grab current state.
33 ! Use the gotten seed to reseed PRNG and grab sequence.
34 ! It should be the same sequence.
36 call random_seed(put
=n1
)
39 write(fd
,'(A,4F12.6)') 'y = ', y
42 ! Setup repeatable sequences (if co-arrays the seeds should be distinct
43 ! are different). Get the seeds. It should be the same sequence.
45 call random_init(.true
., .true
.)
46 call random_seed(get
=n3
)
49 write(fd
,'(A,4F12.6)') 'z = ', z
52 x
= int(1e6
*x
) ! Convert to integer with at most 6 digits.
53 y
= int(1e6
*y
) ! Convert to integer with at most 6 digits.
54 z
= int(1e6
*z
) ! Convert to integer with at most 6 digits.
56 if (any(x
/= y
)) call abort
57 if (any(x
/= z
)) call abort
62 if (n1(i
) - n2(i
) /= 0) then
63 write(fd
,*) 'n1 /= n2', i
, n1(i
), n2(i
)
68 if (n1(i
) - n3(i
) /= 0) then
69 write(fd
,*) 'n1 /= n3', i
, n1(i
), n3(i
)