fortran: wait to open a file until closed by another application

后端 未结 2 1206
情歌与酒
情歌与酒 2021-01-14 19:07

I have a fortran code which needs to read a series of ascii data files (which all together are about 25 Gb). Basically the code opens a given ascii file, reads the informati

2条回答
  •  猫巷女王i
    2021-01-14 19:50

    Two processes should be able to read the same file. Perhaps action="read" on the open statement might help. Must the files be human readable? The I/O would very likely be much faster with unformatted (sometimes call binary) files.

    P.S. If your OS doesn't support multiple-read access, you might have to create your own lock system. Create a master file that a process opens to check which files are in use or not, and to update said list. Immediately closing after a check or update. To handle collisions on this read/write file, use iostat on the open statement and retry after a delay if there is an error.

提交回复
热议问题