Direct LU solver

Amit.Itagi at Amit.Itagi at
Fri Feb 29 12:22:00 CST 2008

owner-petsc-users at wrote on 02/29/2008 10:14:20 AM:

> On Fri, Feb 29, 2008 at 8:23 AM,  <Amit.Itagi at> wrote:
> > Matt/Hong/Satish,
> >
> >  My toy-problem would run with the command line options. However, the
> >  in-code options were still giving a problem. I also found that I had a
> >  Petsc version compiled with the debugging flag off. On recompiling
Petsc by
> >  turning the debugging flag on, the in-code options worked. I am
> >  about the cause for this behavior.
> I am sure this is a misinterpretation. The code just does not work that
> Something you have not notices changed between those versions of your
> When you say "giving a problem", I assume you mean the option does not
> effect. The most common cause is a misunderstanding of the mechanism. If
> call a function to set something, but subsequently call
> SetFromOptions(), it will
> be overridden by command line arguments
>    Matt


My woes continue.  Based on the earlier discussions, I implemented the
matrix as


 //   Option 1
  ierr=MatCreate(PETSC_COMM_WORLD,&A); CHKERRQ(ierr);
  ierr=MatSetSizes(A,1,1,2,2); CHKERRQ(ierr);

  /*    Option 2
  PetscInt d_nnz=1, o_nnz=1;

  /*   Option 3


  ierr=MatSetType(A,MATSUPERLU_DIST); CHKERRQ(ierr);
  ierr=MatSetFromOptions(A); CHKERRQ(ierr);

  // (After this, I set the values and do the assembly). I then use the
direct LU solver.


Note: I have a simple 2 by 2 matrix (with non-zero values in all 4 places).
If I use "option 1" (based on Satish's email), the program executes
successfully. If instead of "option 1", I use "option 2" or "option 3", I
get a crash.
If I am not mistaken, options 1 and 3 are the same. Option 2, additionally,
does a pre-allocation. Am I correct ?



More information about the petsc-users mailing list