Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Problem with MPI_File_read() (2)
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-04-14 20:25:14


In general, files written by MPI_File_write (and friends) are only
guaranteed to be readable by MPI_File_read (and friends). So if you
have an ASCII input file, or even a binary input file, you might need
to read it in with traditional/unix file read functions and then write
it out with MPI_File_write. Then your parallel application will be
able to use the various MPI_File_* functions to read the file at run-
time. Hence, there's no real generic <non-MPI-file> -> <MPI-file>
convertor; you'll need to write your own that is specific to your data.

Make sense?

On Apr 14, 2009, at 6:50 PM, Jovana Knezevic wrote:

> >
> > Hi Jovana,
> >
> > 825307441 is 0x31313131 in base 16 (hexadecimal), which is the
> string
> > `1111' in ASCII. MPI_File_read reads in binary values (not ASCII)
> just
> > as the standard functions read(2) and fread(3) do.
> >
> > So, your program is fine; however, your data file (first.dat) is
> not.
> >
> > Cheers,
> > Shaun
> >
>
> Thank you very much, Shaun! Ok, now I realise it's really stupid that
> I was trying so hard to get the result that I wanted :-)
> Well, it seems it's not a problem if I'm just reading with
> MPI_File_read and writing with MPI_File_write, but if I try to do some
> calculations with the data I read, it doesn't work... Do you maybe
> have some idea how one can deal with this ( I have an input file for
> my project - much larger code than the sample I gave last time -
> consisting of integers, doubles, characters and so on... Maybe it's a
> silly question, but can I convert my input file somehow into something
> so that it works? :-) Any ideas would help.
> Thanks again.
>
> Cheers,
> Jovana
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
Jeff Squyres
Cisco Systems