diff -r 5a7bcf3b6a25 src/ksp/ksp/examples/tutorials/ex2.c --- a/src/ksp/ksp/examples/tutorials/ex2.c Thu Jan 26 23:31:23 2012 -0600 +++ b/src/ksp/ksp/examples/tutorials/ex2.c Sat Jan 28 18:42:33 2012 +0100 @@ -56,26 +56,28 @@ int main(int argc,char **args) determined by PETSc at runtime. Performance tuning note: For problems of substantial size, preallocation of matrix memory is crucial for attaining good performance. See the matrix chapter of the users manual for details. */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n);CHKERRQ(ierr); - ierr = MatSetFromOptions(A);CHKERRQ(ierr); - ierr = MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL);CHKERRQ(ierr); - ierr = MatSeqAIJSetPreallocation(A,5,PETSC_NULL);CHKERRQ(ierr); + //ierr = MatSetFromOptions(A);CHKERRQ(ierr); + //ierr = MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL);CHKERRQ(ierr); + //ierr = MatSeqAIJSetPreallocation(A,5,PETSC_NULL);CHKERRQ(ierr); + ierr = MatSetType(A,MATSEQDENSE);CHKERRQ(ierr); /* Currently, all PETSc parallel matrix formats are partitioned by contiguous chunks of rows across the processors. Determine which rows of the matrix are locally owned. */ - ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); + //ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); + Istart=0; Iend=m*n; /* Set matrix elements for the 2-D, five-point stencil in parallel. - Each processor needs to insert only elements that it owns locally (but any non-local elements will be sent to the appropriate processor during matrix assembly). - Always specify global rows and columns of matrix entries.