Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
27428 Discussions

Difference between COMMITQQ, PXFFFLUSH, and FSYNC


In rare cases when my code crashes soon after formatted IO, some data are not actually written to disk. I am currently calling `FLUSH` on all files (before the crash) but it is apparently insufficient. The disk is an HPC lustre storage system. My current understanding is that there are two possible problems:

  1. The flush operation hasn't fully completed. From here (, flush is nonblocking.
  2. The flush completed but the file isn't actually physically on disk yet. From here (, flush only affects the runtime IO buffer, not the actual disk.

Ideally, I would like a portable way to perform a blocking flush directly to the disk. I mostly use intel, though, and it seems there are many compiler-specific routines. I have found 3 possible solutions:

  1. Call the PXFFFLUSH routine (, which is an intel-specific flush directly to disk. Is this nonblocking like the regular flush?
  2. Call the COMMITQQ routine (, which is an intel-specific blocking flush. It also seems to force a direct write to disk
  3. Grab the POSIX file descriptor and call FSYNC, following this example ( Grabbing the POSIX descriptor appears to be compiler-specific, but the FSYNC call itself should be portable.

My question is: what are the differences between PXFFFLUSH, COMMITQQ, and FSYNC? Are they all blocking? Which (if any) would be appropriate for my issue?

0 Kudos
0 Replies