public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: fortran@gcc.gnu.org
Subject: Re: Problem setting buffer size for gfortran ( v 11.2)
Date: Wed, 23 Feb 2022 19:26:20 +0100	[thread overview]
Message-ID: <2916ad84-bfbe-757b-290e-61d9c5805367@gmx.de> (raw)
Message-ID: <20220223182620.cVC_f9LLWZ4epKhw220_OO2RhhgquNSAO2oBh8dX9FE@z> (raw)
In-Reply-To: <be294053be484a25ba1c4da57046e06f@gsi.de>

Hi Denis,

Am 23.02.22 um 17:10 schrieb Bertini, Denis Dr. via Fortran:
> Hi
> Investigating some sporadical performance drop when using Fortran IO on our Lustre
> shared file system, we realized that the buffer size used as default by the gnu fortran
> compiler is 8 kiB only.
> We wanted to change this default and according to the documentation, one has just to set
> the environment variables:
> 
>   GFORTRAN_UNFORMATTED_BUFFER_SIZE
>   GFORTRAN_FORMATTED_BUFFER_SIZE=
>   GFORTRAN_UNBUFFERED_ALL=n
> 
> to increase the buffer size  during runtime.

this works for me on gcc-12 development for the following
test program on Linux/x86:

open(10,file="bigfile")
write(10,*) "data"
close(10)
end

Compile, link, and run under strace with

GFORTRAN_FORMATTED_BUFFER_SIZE=4194304 strace ./a.out

[...]
openat(AT_FDCWD, "bigfile", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=6, ...}) = 0
mmap(NULL, 4198400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0x146b69b1c000
write(3, " data\n", 6)                  = 6
ftruncate(3, 6)                         = 0
munmap(0x146b69b1c000, 4198400)         = 0
close(3)                                = 0

> Unfortunately isetting these variables  does not  change the default buffer size.
> I tried with gfortran 8, 10, and the new 11.2.
> Looking a the code, i found in
>   io/unix.c
>   that the default is set to the following value,
> 
> static const int FORMATTED_BUFFER_SIZE_DEFAULT = 8192;
> static const int UNFORMATTED_BUFFER_SIZE_DEFAULT = 128*1024;
> 
> Of course, changing the default value and recompiling works and change accordingly the buffer size
> It should nevertheless be possible to change these values without recompiling.
> Is there something one should be aware of when setting these variables?

You said you're using Lustre.  I guess you use the default
blocksize (4MB).  Does your Lustre client support mmap?
What does strace report?

I remember I once saw a system where we had to disable the use
of mmap in a library.

Cheers,
Harald

> Best regards,
> Denis
> 
> ---------
> Denis Bertini
> Abteilung: CIT
> Ort: SB3 2.265a
> 
> Tel: +49 6159 71 2240
> Fax: +49 6159 71 2986
> E-Mail: d.bertini@gsi.de
> 
> GSI Helmholtzzentrum für Schwerionenforschung GmbH
> Planckstraße 1, 64291 Darmstadt, Germany, www.gsi.de
> 
> Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528
> Managing Directors / Geschäftsführung:
> Professor Dr. Paolo Giubellino, Dr. Ulrich Breuer, Jörg Blaurock
> Chairman of the GSI Supervisory Board / Vorsitzender des GSI-Aufsichtsrats:
> Ministerialdirigent Dr. Volkmar Dietz
> 



  reply	other threads:[~2022-02-23 18:26 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 [this message]
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.

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=2916ad84-bfbe-757b-290e-61d9c5805367@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    /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).