[petsc-users] Some possible bugs with PETSC_VIEWER_BINARY_?

Sun, Hui hus003 at ucsd.edu
Sat Aug 2 01:03:29 CDT 2014


Hello,

The PETSC_VIEWER_BINARY_ command is supposed to create a binary Petsc Viewer, then MatView VecView suppose to add matrices and vectors to the binary output file. However, it seems that the viewer gives different output if you use different number of processors. Below is a more detailed description of the problem from an example.

In test example snes/examples/tutorial/ex70.c, I add the following command to the StokesWriteSolution function:

    PetscViewer viewer = PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD);

    MatView(s->subA[0],viewer);

    MatView(s->subA[1],viewer);

    MatView(s->subA[2],viewer);

    MatView(s->subA[3],viewer);

    VecView(s->x,viewer);

    VecView(s->b,viewer);

    VecView(s->y,viewer);


Now I run make ex70 to compile the code, and run the code with the options

-@${MPIEXEC} -n 4 ./ex70 -nx 100 -ny 100 -pc_type fieldsplit -fieldsplit_0_pc_type jacobi -fieldsplit_1_pc_type jacobi  -pc_fieldsplit_type SCHUR -ksp_monitor_short -ksp_converged_reason -ksp_rtol 1e1 -fieldsplit_1_ksp_rtol 1e-2 -fieldsplit_0_ksp_rtol 1e-4 -fieldsplit_1_ksp_max_it 100  -fieldsplit_0_ksp_max_it 1000 -ksp_type fgmres


Here you can see I have 4 processors running at the same time. I read in the output from MATLAB using the

command [A,B,C,D,x,b,y] = PetscBinaryRead('binaryoutput').


And I visualize the variable y by the commands:

mesh(reshape(y(20001:30000),100,100))

mesh(reshape(y(10001:20000),100,100))

mesh(reshape(y(1:10000),100,100))


The output plots are different from what I get if I use 1 processor.


Best,

Hui

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140802/997826f9/attachment.html>


More information about the petsc-users mailing list