pgi, mpich, fortran direct access files

I am using fortran direct access files to write data from multiple CPUs into a single file. I have recently found that with the PGI compilers, that I need have the root cpu open the file as ‘new’ and all other cpus open the file as ‘old’. This I can work with. My problem is that I have also found that I can’t have multiple files open like this at one time. On no other compiler that I’ve used have I found this to be the case.

So basically, I am forced to open a file, write to it, close the file, and then do the same for the second file (open, write, close).

If I do things such that I open two files, write to them both at separate times, and then close the files, then only the first file is correct. The second file contains garbage.

Is there some reason why I can’t have two direct access files open at once?


Hi Joeschmoe369,

There should be no reason why you can’t open two direct access files at once. Is it possible for you to send an example to so we can try and recreate the problem here?