On Tue, Nov 17, 2026 at 4:33 AM Suvarchal K Cheedela
<[email protected]> wrote:
>
>    Hi Janne, Harald,
>
>   One more thought on below part, which I think after thought I did not
> answer properly:

>    The cost of an asynchronous WRITE for a conforming program already
>    depends on the file system, and a copy is usually made anyway, only
>    not by libgfortran:
>
>    - On a local file system, write() copies the data into the page cache
>      and returns, so even the current asynchronous WRITE (with the bugs
>      fixed) costs one copy and the same amount of memory, held by the
>      kernel.  On a workstation (ext4), a synchronous WRITE of a 24 MB
>      array took about 4-5 ms, about the same as a copy in user space.
>      The opt-in copy adds a second copy of the same size: more, but of
>      the same order as what the program pays already.
>
>    - On a parallel file system such as Lustre, the client caches dirty
>      pages up to a per-target limit and the servers cache as well. When
>      a write() blocks, and for how long, depends on those limits and on
>      the load from other jobs, none of which the program can see. The
>      run-to-run spread  (4.9-17.5 s synchronous) most likely comes from
> that.
>
>    So in both cases the program pays for buffering already; the question
>    is only who holds the buffer and whether the program can control when
>    it waits.

No? If you add an extra layer of buffering, it's yet another layer of
buffers that have to be copied. It does not replace the page cache,
which is still there. Unless your patch uses O_DIRECT (I haven't
looked) which is its own huge can of worms and will likely not work
well as a general purpose solution.

>    I also assume that HPC is of interest to Fortran/gfortran, given the
> work on
>    OpenMP, OpenACC and coarrays.  For HPC codes an opt-in copy makes
>    buffering a performance trade-off the user can select for their file
>    system and memory budget, rather than a cost imposed on every program
>    or something each application has to build itself.

The extra buffering is something a conforming program must do anyway,
if they want to keep accessing data which is in-progress for
asynchronous I/O. Either by implementing it in the application itself
or by using some library.

In general Fortran has a long and sordid history of vendors trying to
entice users by adding all kinds of extensions to their compilers,
creating a legacy of portability quagmires. Luckily that is mostly
behind us, but let's not go there again please. The very small
development community has enough troubles in implementing the
standardized features as it is. (With the caveat that I haven't been
an active GFortran developer for several years, so my comments in this
thread are more from the perspective of an interested bystander than
an official position of the development team!)


-- 
Janne Blomqvist

Reply via email to