Awesome. Thanks for doing this Jed. On Sat, Oct 20, 2012 at 5:38 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Fri, Oct 19, 2012 at 6:03 PM, Mohammad Mirzadeh <mirzadeh at > gmail.com>wrote: > >> Cool. Jed, could you please point me to an example/tutorial for this? I'm >> going to give it a shot. >> > > This works for SeqAIJ: > > ierr = MatGetOrdering(A,ordering,&rowperm,&colperm);CHKERRQ(ierr); > ierr = MatPermute(A,rowperm,colperm,&Aperm);CHKERRQ(ierr); > ierr = VecPermute(b,colperm,PETSC_FALSE);CHKERRQ(ierr); > > ierr = > KSPSetOperators(ksp,Aperm,Aperm,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr); > ierr = KSPSolve(ksp,b,x);CHKERRQ(ierr); > ierr = VecPermute(x,rowperm,PETSC_TRUE);CHKERRQ(ierr); > > Now x is the solution back in the original ordering. > > > There is an example in petsc-dev now. > > > https://bitbucket.org/petsc/petsc-dev/src/tip/src/ksp/ksp/examples/tutorials/ex18.c > > It should work with petsc-3.3 in serial, but you need petsc-dev for > parallel MatPermute. > > > >> >> Thanks >> >> >> On Fri, Oct 19, 2012 at 3:57 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote: >> >>> _You_ can compute a MatOrdering, MatPermute and VecPermute, solve, and >>> permute back. Profile and if the solve is faster, go ahead and lift the >>> ordering code back into your mesh. >>> >>> >>> On Fri, Oct 19, 2012 at 5:48 PM, Mohammad Mirzadeh <mirzadeh at >>> gmail.com>wrote: >>> >>>> Thanks Barry. I think I agree with you that right way to do it is >>>> through mesh setup. As a matter of fact I have done that for some of my >>>> problems. Yet, I can think of situations where that kind of support might >>>> be beneficial, especially if someone (a.k.a me in this case!) is looking >>>> for a 'dirty and fast' fix. >>>> >>>> Anyway, I still believe that in long term, one should do the >>>> partitioning in a pre-processing step anyways and so there may not be much >>>> incentive for adding such a support. >>>> >>>> Thanks again, >>>> Mohammad >>>> >>>> >>>> On Fri, Oct 19, 2012 at 3:00 PM, Barry Smith <bsmith at mcs.anl.gov>wrote: >>>> >>>>> >>>>> Mohammad, >>>>> >>>>> We've thought about adding this kind of support this over the >>>>> years but always came to the conclusion that "the right way to do it" is >>>>> during the mesh setup step. >>>>> >>>>> Barry >>>>> >>>>> >>>>> On Oct 19, 2012, at 4:16 PM, Mohammad Mirzadeh <mirzadeh at gmail.com> >>>>> wrote: >>>>> >>>>> > Hi guys, >>>>> > >>>>> > Quick question. *After* the matrix is setup, is it possible to ask >>>>> PETSc to renumber the nodes internally in the KSPSolve phase to minimize >>>>> communications for MatMul inside the solver? Can I use the MatPartitioning >>>>> object for this or is that only intended to partition the mesh as a >>>>> pre-processing step? >>>>> > >>>>> > Thanks >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121020/ee30dd89/attachment.html>