[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

Barry Smith bsmith at mcs.anl.gov
Thu Feb 21 13:31:36 CST 2013


On Feb 21, 2013, at 1:23 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 
> On Thu, Feb 21, 2013 at 1:10 PM, Matthew Knepley <knepley at gmail.com> wrote:
> Yes, he needs the local to global scatters. Rich, I think the easiest way to do this now may be
> to define your data layout as a PetscSection (these are all local) using DMSetDefaultSection(),
> and record who owns which point using a PetscSF with DMSetPointSF().
> 
> Using this information, the DM will automatically construct a scatter between local and global,
> and the CreateLocal/GlobalVector() functions will also work right. This is what its is designed for.
> 
> Does this make sense?
> 
> 
> Rich, this will work fine if you don't mind having PETSc do the communication. It will be done using PetscSFBcastBegin/End, which should have similar performance to VecScatterBegin/End. (I should do a performance test of that.) If you want to use your own internal communication routines, then we need to add the DMShell functions to get your functions called.

  I don't understand.  There is a DMGlobalToLocalBegin/End() which includes

  } else {
    ierr = (*dm->ops->globaltolocalbegin)(dm,g,mode == INSERT_ALL_VALUES ? INSERT_VALUES : (mode == ADD_ALL_VALUES ? ADD_VALUES : mode),l);CHKERRQ(ierr);
  }

 For Shell, Richard should be able to provide his own begin/end functions. Which in his case he is already calling the VecScatterBegin/End() directly in his code so he should just be able to keep the scatter context he is already creating and use it in shell.  No reason to mess with sections or SF, he already has the scatter and just needs to get it into the DMShell and shell should have it as a matter of course. Just because everyone was to lazy to add DMSetGlobalToLocalBegin/End() doesn't mean it should exist. Rich can add it himself trivially and then use (even from Fortran).


   Barry




More information about the petsc-dev mailing list