[petsc-users] petsc viewer

Shaohao Chen shchen at www.phys.lsu.edu
Mon Jul 8 12:38:24 CDT 2013

Dear all,

I can use VecView(vec, viewer) and correctly output a distributed vector. But when I use it in an 
iteration, it doesn't work. My codes are like: 

PetscViewerCreate(PETSC_COMM_WORLD, &viewer1);
......  // modify values of vec
VecView(vec, viewer1) ;  // correct

PetscViewerCreate(PETSC_COMM_WORLD, &viewer2);
  ......  // modify values of vec
  VecView(vec, viewer2) ;  // incorrect

In viewer1, it outputs the whole correct vector. In viewer2, it just outputs part of the vector and 
then stop at the first step of the iteration. And it becomes much slower when I add the VecView line 
in the iteration. The same happens to MatView. What is the problem here? 

Thank you for your attention!

Shaohao Chen
Department of Physics & Astronomy, 
Louisiana State University, 
Baton Rouge, LA

More information about the petsc-users mailing list