On 25.02.22 21:53, Bertini, Denis Dr. via Fortran wrote:
It seems that the value set in the foreseen environment variable is just
ignored.
And always a buffer size of 8kiB is used, which is the default values
for formatted I/O harcoded in libgfortran.
The only way to change this value is editing and recompiling the libgfortran.
This is really strange, I also cannot reproduce this.
With the Ubuntu-supplied gfortran 9.3.0 I get (just setting a few
semi-random numbers for the unformatted buffer size).
$ cat write.f90
program main
implicit none
integer, parameter :: n=100
integer, dimension(n) :: x
integer :: i
x = [(i,i=1,n)]
open (10,file="tst.dat",form="unformatted",action="write")
do i=1,1000
write (10) x
end do
end program main
$ gfortran write.f90
$ strace -e write ./a.out
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
408) = 408
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
65688) = 65688
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
13464) = 13464
+++ exited with 0 +++
$ GFORTRAN_UNFORMATTED_BUFFER_SIZE=200000 strace -e write ./a.out
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
408) = 408
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
100368) = 100368
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
100368) = 100368
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
100368) = 100368
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
100368) = 100368
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
6120) = 6120
+++ exited with 0 +++
$ GFORTRAN_UNFORMATTED_BUFFER_SIZE=210000 strace -e write ./a.out
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
408) = 408
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
105264) = 105264
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
105264) = 105264
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
105264) = 105264
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
91800) = 91800
+++ exited with 0 +++
$ GFORTRAN_UNFORMATTED_BUFFER_SIZE=2100000 strace -e write ./a.out
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
408) = 408
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
407592) = 407592
+++ exited with 0 +++
$ GFORTRAN_UNFORMATTED_BUFFER_SIZE=21000000 strace -e write ./a.out
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
408) = 408
write(3,
"\220\1\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0"...,
407592) = 407592