[petsc-users] MatGetDiagonal

Uwe Schlifkowitz uwe.schlifkowitz at uibk.ac.at
Sun Dec 11 08:16:28 CST 2011


On 11.12.2011, at 13:45, Uwe Schlifkowitz wrote:
> Dear list,
> 
> as explained in the last thread (see http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009706.html ) about MatGetDiagonal, the fix for a bug was pushed to petsc-dev.
> 
> My results from running example 52 from ~petsc-dev/src/ksp/ksp/examples/tutorials/ex52.c are attached below. Are these the correct results? 
> I ran the example on Max OS X 10.6.8 as well as on CentOS with both petsc-3.2-p5 and petsc-dev (pulled from hg yesterday) and obtained the same results. Please let me know if you need the full output.
> 
> (I recently started working on Clemens' project, i think he left in August.)
> 
> Regards,
> Uwe
> 
> $ ./ex52 -use_petsc_ch
> Matrix Object: 1 MPI processes
>  type: seqaij
> row 0: (0, 4)  (5, -1)  (28, -1)  (29, -1) 
> row 1: (1, 4)  (5, -1)  (12, -1)  (13, -1) 
> ...
> Vector Object: 1 MPI processes
>  type: seq
> 4
> 4
> 4
> 4
> 4
> 3.25
> 4
> 3.5
> 4
> 4
> 3.75
> 3.46548
> 3.1138
> 2.70534
> ...
> 3.10993
> 2.55974
> 2.38793
> 2.32336
> 2.34087
> 2.5002
> 3.30916
> Norm of error < 1.e-12 iterations 1

I just realized i somehow had an outdated ex52.c and makefile. Now i obtain the correct results as shown in http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009706.html .

However, i'm wondering how come there's such a difference in the results. The output of diff -u $NEWFILE $OLDFILE is the following:

$ diff -u ex52.c ex52.c.old 
--- ex52.c	2011-12-02 07:02:05.000000000 +0100
+++ ex52.c.old	2011-12-10 13:12:22.046776194 +0100
@@ -165,7 +165,7 @@
       ierr = PCSetType(pc,PCCHOLESKY);CHKERRQ(ierr);
     }
     ierr = PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS);CHKERRQ(ierr);
-    ierr = PCFactorSetUpMatSolverPackage(pc);CHKERRQ(ierr); /* call MatGetFactor() to create F */
+    ierr = PCFactorSetUpMatSolverPackage(pc);CHKERRQ(ierr);
     ierr = PCFactorGetMatrix(pc,&F);CHKERRQ(ierr);
     icntl=7; ival = 2;
     ierr = MatMumpsSetIcntl(F,icntl,ival);CHKERRQ(ierr);
@@ -262,7 +264,7 @@
      print statement from all processes that share a communicator.
      An alternative is PetscFPrintf(), which prints to a file.
   */
-  ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %G iterations %D\n",
+  ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %A iterations %D\n",
                      norm,its);CHKERRQ(ierr);
 
   /*
 
The diff output for the makefiles is here: http://dl.dropbox.com/u/32772/diff-u-makefile-makefile.old.txt

So the question is, what other parameters have been changed to produce said results?

Regards,
Uwe


More information about the petsc-users mailing list