On Sep 25, 2005, at 8:38 AM, L WK wrote:
> I am looking for a code to read/write file as a pure text format. In
> C,
> one can use fprintf to output a text in given format. Can MPI_File_xxx
> do that?
Yes and no.
> Again, how can I read the formatted text file like
>
> data_name value
> A 12.3
> B 10.0
> C 0.2
>
> With C, one can read the file with fscanf(fp, "%s%f", &s, &v); How can
> MPI do that?
If you require the use of pure text files, MPI IO cannot provide that
guarantee. MPI says that and files written by MPI IO functionality can
only be guaranteed to be read by MPI IO functionality. That is, it
*might* be pure text, but it might not.
> In 8-node network, I try to use fscanf/fprintf to read/write from/to
> the
> same file located in NFS, but the program will work only if not more
> than six processes running at the same time. I wonder if MPI ban the IO
> operation
No, MPI does not ban this. You didn't provide any details about what
exactly was failing, but I'm guessing that your NFS server is not
handling the number of clients very well (6 is a pretty low number of
clients for server overload to occur, though... is your file very
large?).
What *might* be an acceptable solution is to have one process read in
the file and MPI_Bcast() the data out to all the other processes (or
perhaps have a small number of processes read -- in your case,
something less than 6 -- and broadcast to respective subsets of
processes so that the end effect is the same: that all processes get
the data). You might want to experiment with this concept to see if it
will work with your particular setup and deliver reasonable efficiency.
Hope this helps.
--
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/
|