public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bertini, Denis Dr." <D.Bertini@gsi.de>
To: Thomas Koenig <tkoenig@netcologne.de>, Harald Anlauf <anlauf@gmx.de>
Cc: Tobias Burnus <tobias@codesourcery.com>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: Problem setting buffer size for gfortran ( v 11.2)
Date: Sat, 26 Feb 2022 15:37:50 +0000	[thread overview]
Message-ID: <c63d8824456047729db4e23924d36df2@gsi.de> (raw)
In-Reply-To: <691ce537-ff39-7410-327f-ef11d89e2419@netcologne.de>

Hi Thomas,

OK so i took your example ( exact copy) and compile it

with gfortran 11.2.

Then without setting the environment variable:

export GFORTRAN_UNFORMATTED_BUFFER_SIZE=200000
i got
dbertini@lxbk0596:/lustre/rz/dbertini/fio > strace -e write ./fio
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 +++

setting for example
dbertini@lxbk0596:/lustre/rz/dbertini/fio > export GFORTRAN_UNFORMATTED_BUFFER_SIZE=400000
dbertini@lxbk0596:/lustre/rz/dbertini/fio > strace -e write ./fio
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"..., 200328) = 200328
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"..., 200328) = 200328
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"..., 6936) = 6936
+++ exited with 0 +++

So it seems to work right?
But do you understand the strace output in both cases ?
What means the data buffer distribution?
Is there some data alignment alforithm working in the background here?
Cheers.
Denis






________________________________
From: Thomas Koenig <tkoenig@netcologne.de>
Sent: Saturday, February 26, 2022 10:20:25 AM
To: Bertini, Denis Dr.; Harald Anlauf
Cc: Tobias Burnus; fortran@gcc.gnu.org
Subject: Re: Problem setting buffer size for gfortran ( v 11.2)

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

      reply	other threads:[~2022-02-26 15:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 16:10 Bertini, Denis Dr.
2022-02-23 18:26 ` Harald Anlauf
2022-02-23 18:26   ` Harald Anlauf
2022-02-23 20:28   ` Bertini, Denis Dr.
2022-02-23 20:57     ` Harald Anlauf
2022-02-23 20:57       ` Harald Anlauf
2022-02-23 20:59     ` Bertini, Denis Dr.
     [not found]       ` <trinity-9bf94afe-e773-4366-b0b2-ae398de80664-1645651097363@3c-app-gmx-bs49>
2022-02-23 21:23         ` Bertini, Denis Dr.
2022-02-23 21:38           ` Harald Anlauf
2022-02-24  7:57             ` Bertini, Denis Dr.
2022-02-24  8:13               ` Tobias Burnus
2022-02-24  8:15                 ` Bertini, Denis Dr.
2022-02-24  8:20                   ` Tobias Burnus
2022-02-25 17:28                     ` Bertini, Denis Dr.
     [not found]                       ` <trinity-59001f50-077d-424e-a648-24645944dd0c-1645813711633@3c-app-gmx-bap28>
2022-02-25 20:01                         ` Bertini, Denis Dr.
2022-02-25 20:44                           ` Harald Anlauf
2022-02-25 20:44                             ` Harald Anlauf
2022-02-25 20:53                             ` Bertini, Denis Dr.
2022-02-26  9:20                               ` Thomas Koenig
2022-02-26 15:37                                 ` Bertini, Denis Dr. [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c63d8824456047729db4e23924d36df2@gsi.de \
    --to=d.bertini@gsi.de \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).