You can call 

  PCSetType(pc,PCILU); 
  KSPSetFromOptions(ksp);
  PCFactorSetMatOrderingType(pc,....);

  This reproduces the old behavior in PETSc.

   You can still pass -pc_type somethingelse at runtime to use a different PC.


> On Aug 18, 2024, at 6:19 PM, Zou, Ling <l...@anl.gov> wrote:
> 
> Thank you, Barry. You must be right in this case. I am defaulting to ILU.
> I did an additional test to confirm, with ‘-pc_type ilu’ in the command line, 
> it works fine.
>  
> If I am defaulting to ILU, when should I call PCFactorSetMatOrderingType?
>  
> -Ling
>  
>  
> From: Barry Smith <bsm...@petsc.dev <mailto:bsm...@petsc.dev>>
> Date: Sunday, August 18, 2024 at 12:22 PM
> To: Zou, Ling <l...@anl.gov <mailto:l...@anl.gov>>
> Cc: petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> 
> <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>>
> Subject: Re: [petsc-users] PCFactorSetMatOrderingType not working with 3.21
> 
> Are you using -pc_type ilu at the command line in your test? Or just letting 
> it default to using ILU? This could explain the difference, the decision of 
> what preconditioner to default to has moved until later in code, not when the 
> PC is created 
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>  
> ZjQcmQRYFpfptBannerEnd
>  
>    Are you using -pc_type ilu  at the command line in your test? Or just 
> letting it default to using ILU?
>  
>     This could explain the difference, the decision of what preconditioner to 
> default to has moved until later in code, not when the PC is created or the 
> matrix supplied but when it starts to build the preconditioner. Hence when 
> you call PCFactorSetMatOrderingType() in the code the PC may not yet be set 
> to ILU (or anything) hence the PCFactorSetMatOrderingType() is ignored,
>  
>  
> 
> 
> On Aug 17, 2024, at 3:44 PM, Zou, Ling <l...@anl.gov <mailto:l...@anl.gov>> 
> wrote:
>  
> Barry, thanks.
> I am accessing PETSc through MOOSE. I need to figure out if the versions are 
> consistent and how to test it.
> -Ling
>  
> From: Barry Smith <bsm...@petsc.dev <mailto:bsm...@petsc.dev>>
> Date: Saturday, August 17, 2024 at 12:08 PM
> To: Zou, Ling <l...@anl.gov <mailto:l...@anl.gov>>
> Cc: petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> 
> <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>>
> Subject: Re: [petsc-users] PCFactorSetMatOrderingType not working with 3.21
> 
> I have attached src/snes/tutorials/ex5. c in which I tried to reproduce your 
> problem by inserting the code you've indicated. However I am not getting the 
> problem you see, I am seeing, type: ilu out-of-place factorization 0 levels 
> of fill tolerance
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>  
> ZjQcmQRYFpfptBannerEnd
>  
>    I have attached src/snes/tutorials/ex5.c in which I tried to reproduce 
> your problem by inserting the code you've indicated.
>  
>    However I am not getting the problem you see, I am seeing,
>  
>     type: ilu
>       out-of-place factorization
>       0 levels of fill
>       tolerance for zero pivot 2.22045e-14
>       matrix ordering: rcm
>  
> 
> when I run with -pc_type ilu -snes_view
>  
>  Can you please confirm you get the same problem with the attached ex5.c ?  
> You could send your code to see if I can reproduce the problem.
>  
>   I am using the release branch of PETSc 
>  
>   Barry
>  
>  
>  
>  
> 
>  
> 
>  
> 
> On Aug 17, 2024, at 12:35 PM, Zou, Ling via petsc-users 
> <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>> wrote:
>  
> Hi all,
>  
> The following codes are how I used to setup PC mat ordering:
>  
>   // Setup KSP/PC (at this moment, user-input options and commandline options 
> are available)
>   SNESGetKSP(snes, &ksp);
>   KSPSetFromOptions(ksp);
>   PC pc;
>   KSPGetPC(ksp, &pc);
>   PCFactorSetMatOrderingType(pc, MATORDERINGRCM);
>   // PCFactorSetLevels(pc, 5);
>   SNESSetFromOptions(snes);
>  
> After switching to PETSc 3.21, this no longer works, and can be confirmed 
> from ‘-snes_view’ output:
>  
>   PC Object: 1 MPI process
>     type: ilu
>       out-of-place factorization
>       0 levels of fill
>       tolerance for zero pivot 2.22045e-14
>       using diagonal shift to prevent zero pivot [NONZERO]
>       matrix ordering: natural
>  
> The command line option still works, i.e., ‘-pc_factor_mat_ordering_type rcm’ 
> gives me the correct behavior.
>  
> Questions:
> Is this a bug introduced in the new version, or
> With the new version, I should call this function at a different time?
>  
> Best,
>  
> -Ling

Reply via email to