[petsc-users] MatSetOption bug?
Anton Popov
popov at uni-mainz.de
Wed Jun 20 04:05:04 CDT 2012
Thanks Matt, it's clear now
On 6/19/12 6:49 PM, Matthew Knepley wrote:
> On Tue, Jun 19, 2012 at 10:06 AM, Anton Popov <popov at uni-mainz.de
> <mailto:popov at uni-mainz.de>> wrote:
>
> Hi petsc team!
> I've recently upgraded to 3.3, and currently experience problems.
> One of them follows.
> If I compile this simple code:
>
>
> In 3.3, we now require that MatSetUp() is called before messing with
> the storage scheme.
> We should have been more specific in Changes. Moreover, this should be
> a better error
> message. Will fix, and see below.
>
> #include "petsc.h"
> #undef __FUNCT__
> #define __FUNCT__ "main"
> int main( int argc,char **argv )
> {
> Mat A;
> PetscErrorCode ierr;
> PetscInt n_rows_Local=100;
> PetscInt n_cols_Local=100;
> ierr = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
> CHKERRQ(ierr);
> ierr = MatCreate(PETSC_COMM_WORLD, &A); CHKERRQ(ierr);
> ierr = MatSetSizes(A, n_rows_Local, n_cols_Local,
> PETSC_DETERMINE, PETSC_DETERMINE); CHKERRQ(ierr);
> ierr = MatSetType(A, MATAIJ); CHKERRQ(ierr);
>
>
> ierr = MatSetUp(A);CHKERRQ(ierr);
>
> Matt
>
> ierr = MatSetOption(A, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE);
> CHKERRQ(ierr);
> ierr = PetscFinalize(); CHKERRQ(ierr);
> PetscFunctionReturn(0);
> }
>
> and run it in parallel (mpiexec -np 2 ./example) it gives me
> errors like this:
>
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Null argument, when expecting valid pointer!
> [0]PETSC ERROR: Null Object: Parameter # 1!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
>
> Commenting the line with "MatSetOption" removes the error, but
> doesn't solve the problem, because I actually need to
> KEEP_NONZERO_PATTERN
>
> Running the code sequentially, also vanishes the error.
>
> Please check whether it's a bug in petsc-3.3, or I should set this
> option in a different way.
>
> Thanks,
>
> Anton Popov
>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120620/451dc046/attachment-0001.html>
More information about the petsc-users
mailing list