[petsc-users] Trying to run ex11 (complex example) in $PETSC_DIR/src/ksp/ksp/examples/tutorials

Satish Balay balay at mcs.anl.gov
Mon Oct 29 16:16:30 CDT 2012


The attached patch [which is in petsc-dev] would fix the issue for petsc-3.3 aswell.

cd petsc-3.3
patch -Np1 < ex11.diff

Satish

On Mon, 29 Oct 2012, Moore, Brian (SDSU) wrote:

> 
> Apologies--probably should have done this before I posted the question.
> I just downloaded and compiled the latest development version this afternoon and was successfully able to run this example.
> 
> --
> Brian Moore, Research High Performance Computing Specialist
> SDSU UNSS
> SAD 119, Box 2201, Brookings, SD  57007-1598
> 605.688.4679 (wk) / 605.521.3062 (cell)
> 
> 
> 
> 
> On Oct 29, 2012, at 3:29 PM, Moore, Brian (SDSU) wrote:
> 
> 
> I am trying to make a build of petsc that will enable complex numbers.  As per the manual in Sec. 13.7, I did a ./configure as:
> 
> ./configure --download-f-blas-lapack=1 --with-shared-libraries=1 --download-mpich --with-scalar-type=complex
> 
> and then tried to compile and make the ex11 example program from $PETSC_DIR/src/ksp/ksp/examples/tutorials
> 
> The error I am seeing is listed below.  Does anyone have an idea what the problem is?  I was able to run several of the other example programs in this folder (ex1, ex2, ex23) and was able to run the fortran program ex11f.
> Thanks.
> 
> --
> Brian Moore, Research High Performance Computing Specialist
> SDSU UNSS
> SAD 119, Box 2201, Brookings, SD  57007-1598
> 605.688.4679 (wk) / 605.521.3062 (cell)
> 
> 
> moore at moore-pc2:~/petsc-3.3-p4/src/ksp/ksp/examples/tutorials> make runex11
> 1,8c1,20
> <   0 KSP Residual norm 4.62271
> <   1 KSP Residual norm 1.58711
> <   2 KSP Residual norm 0.767563
> <   3 KSP Residual norm 0.472102
> <   4 KSP Residual norm 0.435655
> <   5 KSP Residual norm 0.154866
> <   6 KSP Residual norm < 1.e-11
> < Norm of error < 1.e-12 iterations 6
> ---
> > 1+1i
> > [0]PETSC ERROR: --------------------- Error Message ------------------------------------
> > [0]PETSC ERROR: Object is in wrong state!
> > [0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatGetOwnershipRange()!
> > [0]PETSC ERROR: ------------------------------------------------------------------------
> > [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 4, Fri Oct 26 10:46:51 CDT 2012
> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> > [0]PETSC ERROR: See docs/index.html for manual pages.
> > [0]PETSC ERROR: ------------------------------------------------------------------------
> > [0]PETSC ERROR: ./ex11 on a arch-linu named moore-pc2 by moore Mon Oct 29 15:27:59 2012
> > [0]PETSC ERROR: Libraries linked from /home/moore/petsc-3.3-p4/arch-linux2-c-debug/lib
> > [0]PETSC ERROR: Configure run at Mon Oct 29 15:00:29 2012
> > [0]PETSC ERROR: Configure options --download-f-blas-lapack=1 --with-shared-libraries=1 --download-mpich --with-scalar-type=complex
> > [0]PETSC ERROR: ------------------------------------------------------------------------
> > [0]PETSC ERROR: MatGetOwnershipRange() line 5992 in /home/moore/petsc-3.3-p4/src/mat/interface/matrix.c
> > [0]PETSC ERROR: main() line 83 in src/ksp/ksp/examples/tutorials/ex11.c
> > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
> > [cli_0]: aborting job:
> > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
> /home/moore/petsc-3.3-p4/src/ksp/ksp/examples/tutorials
> Possible problem with with ex11_1, diffs above \n=========================================
> 
> 
> 
> 
> 
-------------- next part --------------
diff --git a/src/ksp/ksp/examples/tutorials/ex11.c b/src/ksp/ksp/examples/tutorials/ex11.c
--- a/src/ksp/ksp/examples/tutorials/ex11.c
+++ b/src/ksp/ksp/examples/tutorials/ex11.c
@@ -74,6 +74,7 @@
   ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
   ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,dim,dim);CHKERRQ(ierr);
   ierr = MatSetFromOptions(A);CHKERRQ(ierr);
+  ierr = MatSetUp(A);CHKERRQ(ierr);
 
   /* 
      Currently, all PETSc parallel matrix formats are partitioned by


More information about the petsc-users mailing list