VecView and MPI IO

Shao-Ching Huang schuang at ats.ucla.edu
Sat Feb 7 12:39:51 CST 2009


Yes, it works.

So to suppress the .info file, I either replace

   PetscViewerBinaryOpen(comm, fn, FILE_MODE_WRITE, &viewer);

with

   PetscViewerCreate(comm, &viewer);
   PetscViewerSetType(viewer,PETSC_VIEWER_BINARY);
   PetscViewerBinarySkipInfo(viewer);
   PetscViewerFileSetMode(viewer, FILE_MODE_WRITE);
   PetscViewerFileSetName(viewer,fn);

in my code, or use "-viewer_binary_skip_info" at run time.

Thanks.

Shao-Ching


Barry Smith wrote:
> 
>   From the manual page
> 
> /*@
>     PetscViewerBinarySkipInfo - Binary file will not have .info file 
> created with it
> 
>     Not Collective
> 
>     Input Paramter:
> .   viewer - PetscViewer context, obtained from PetscViewerCreate()
> 
>     Options Database Key:
> .   -viewer_binary_skip_info
> 
>     Level: advanced
> 
>     Notes: This must be called after PetscViewerSetType() but before 
> PetscViewerFileSetName(). If you use PetscViewerBinaryOpen() then
>     you can only skip the info file with the -viewer_binary_skip_info 
> flag. To use the function you must open the
>     viewer with PetscViewerCreate(), PetscViewerSetType(), 
> PetscViewerFileSetName().
> 
>     The .info contains meta information about the data in the binary 
> file, for example the block size if it was
>     set for a vector or matrix.
> 
>    Concepts: PetscViewerBinary^accessing info file
> 
> .seealso: PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), 
> PetscViewerBinarySetSkipOptions(),
>           PetscViewerBinaryGetSkipOptions()
> @*/
> 
> On Feb 6, 2009, at 6:27 PM, Shao-Ching Huang wrote:
> 
>> Hi
>>
>> I am getting a zero-sized file "foo.info" when I write a vector, say
>> "my_vec", to disk file "foo":
>>
>>  MPI_Comm comm;
>>  PetscViewer viewer;
>>  Vec my_vec;
>>  ...
>>  PetscViewerBinaryOpen(comm, "foo", FILE_MODE_WRITE, &viewer);
>>  VecView(my_vec, viewer);
>>  PetscViewerDestroy(viewer);
>>
>> My questions are:
>> 1. Can I safely ignore the .info file? (Is it useful?)
>> 2. How can I prevent the .info file from being generated?
>>
>> Thanks,
>>
>> Shao-Ching
>>
>>
>> Matthew Knepley wrote:
>>> On Thu, Feb 5, 2009 at 7:48 PM, Shao-Ching Huang 
>>> <schuang at ats.ucla.edu> wrote:
>>>> Hi,
>>>>
>>>> I am trying to create restart/check-pointing files for a time-stepping
>>>> simulation (by writing out vectors to files).
>>>>
>>>> 1. Does VecView always use the MPI collective I/O?
>>>>
>>>>  The HTML documentation of PetscViewerBinaryOpen says: "For writing
>>>>  files it only opens the file on processor 0 in the communicator."
>>> You must run with -viewer_binary_mpiio. However, I recommend very very
>>> strongly that you profile this first. We have not need to use MPI/IO 
>>> below
>>> several thousand processors.
>>>> 2. Do I have to set anything to enable MPI I/O when configuring PETSc?
>>>>  (My MPI library has MPI I/O.)
>>> This should happen automatically.
>>>  Matt
>>>> Thank you.
>>>>
>>>> Shao-Ching
> 


More information about the petsc-users mailing list