I'd like to generate a unique filename within an MPI application.
Reading "Advice to implementors" under MPI_FILE_OPEN
in version 2.2 of the the specification indicates that filenames like uriPrefix:foo/bar/baz
in addition to just the usual foo/bar/baz
are possible. As are filenames like baz/PASSWORD=SECRET
. The MPI implementation is expected to do the right thing with this additional information.
These additional filename elements will play havoc with mkstemp(3)
. In the former case, the uriPrefix
may indicate where the file should be housed. In the later case, bazXXXXXX/PASSWORD=SECRET
will screw up mkstemp(3)
's template conventions.
Does anyone have suggestions for how to safely combine mkstemp(3)
with MPI_FILE_OPEN
?