From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lxmtout1.gsi.de (lxmtout1.gsi.de [140.181.3.111]) by sourceware.org (Postfix) with ESMTPS id 7D0DB3858C2D for ; Wed, 23 Feb 2022 20:28:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D0DB3858C2D Received: from localhost (localhost [127.0.0.1]) by lxmtout1.gsi.de (Postfix) with ESMTP id CCC102051045; Wed, 23 Feb 2022 21:28:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lxmtout1.gsi.de Received: from lxmtout1.gsi.de ([127.0.0.1]) by localhost (lxmtout1.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4XMo8_VmkM0Q; Wed, 23 Feb 2022 21:28:13 +0100 (CET) Received: from srvex4.campus.gsi.de (unknown [10.10.4.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by lxmtout1.gsi.de (Postfix) with ESMTPS id AECDB2051043; Wed, 23 Feb 2022 21:28:13 +0100 (CET) Received: from srvex1.Campus.gsi.de (10.10.4.11) by srvex4.campus.gsi.de (10.10.4.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.18; Wed, 23 Feb 2022 21:28:13 +0100 Received: from srvex1.Campus.gsi.de ([fe80::d6d:62f8:8c5f:1743]) by srvex1.campus.gsi.de ([fe80::d6d:62f8:8c5f:1743%21]) with mapi id 15.01.2375.018; Wed, 23 Feb 2022 21:28:13 +0100 From: "Bertini, Denis Dr." To: Harald Anlauf , "fortran@gcc.gnu.org" Subject: Re: Problem setting buffer size for gfortran ( v 11.2) Thread-Topic: Problem setting buffer size for gfortran ( v 11.2) Thread-Index: AQHYKOLdPl2KSeF2m0iQ/yc4UvrsIayhlNc7 Date: Wed, 23 Feb 2022 20:28:13 +0000 Message-ID: References: , <2916ad84-bfbe-757b-290e-61d9c5805367@gmx.de> In-Reply-To: <2916ad84-bfbe-757b-290e-61d9c5805367@gmx.de> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [140.181.3.12] MIME-Version: 1.0 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, HTML_MESSAGE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2022 20:28:18 -0000 Hi Harald, In attachment you will find a typical strace output when running with gfortran8 on lustre filsystem. As i said for gfortran version 8.x, 10.x, 11.2 setting the runtime env. variable to change buffer size did not work for me as you could see in the strace output. You could also see that "mmap" is used by the lustre client. The optimal blocksize given back by the STAT() routine indeed favor a 4 MiB buffer size. Best Denis ________________________________ From: Harald Anlauf Sent: Wednesday, February 23, 2022 7:26 PM To: Bertini, Denis Dr.; fortran@gcc.gnu.org Subject: Re: Problem setting buffer size for gfortran ( v 11.2) 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 o= ur Lustre > shared file system, we realized that the buffer size used as default by t= he 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=3D > GFORTRAN_UNBUFFERED_ALL=3Dn > > 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=3D"bigfile") write(10,*) "data" close(10) end Compile, link, and run under strace with GFORTRAN_FORMATTED_BUFFER_SIZE=3D4194304 strace ./a.out [...] openat(AT_FDCWD, "bigfile", O_RDWR|O_CREAT|O_CLOEXEC, 0666) =3D 3 fstat(3, {st_mode=3DS_IFREG|0644, st_size=3D6, ...}) =3D 0 mmap(NULL, 4198400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0x146b69b1c000 write(3, " data\n", 6) =3D 6 ftruncate(3, 6) =3D 0 munmap(0x146b69b1c000, 4198400) =3D 0 close(3) =3D 0 > Unfortunately isetting these variables does not change the default buff= er 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 =3D 8192; > static const int UNFORMATTED_BUFFER_SIZE_DEFAULT =3D 128*1024; > > Of course, changing the default value and recompiling works and change ac= cordingly the buffer size > It should nevertheless be possible to change these values without recompi= ling. > 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=FCr Schwerionenforschung GmbH > Planckstra=DFe 1, 64291 Darmstadt, Germany, www.gsi.de > > Commercial Register / Handelsregister: Amtsgericht Darmstadt, HRB 1528 > Managing Directors / Gesch=E4ftsf=FChrung: > Professor Dr. Paolo Giubellino, Dr. Ulrich Breuer, J=F6rg Blaurock > Chairman of the GSI Supervisory Board / Vorsitzender des GSI-Aufsichtsrat= s: > Ministerialdirigent Dr. Volkmar Dietz >