Fortran writing to `/dev/null` or `NUL`

Writing to /dev/null can save significant time on legacy Fortran programs that dump unneeded data to disk. This is lower risk than making modifications to non-standard compliant code, and certainly less programmer time consuming. We have seen 10x speedup from programs that had unneeded intensive file writing. It’s also particularly useful for Fortran code called from Python via f2py.

The null filename per OS is:

  • non-Windows: /dev/null
  • native Windows: NUL

Example: null-writing Fortran: devnull.f90

/dev/null is 3..5x faster than scratch file, even with fast SSD.