[petsc-users] question about VecScatter from one global vector to another

Barry Smith bsmith at mcs.anl.gov
Fri Feb 19 19:11:50 CST 2016


  How big are the scatters? If they are not large, say 100,000 or less then just gather the send and receive indices to one process and pass them all on that process while all other processes pass 0 indices (it doesn't matter from what process the indices are list in the VecScatterCreate()). 

  If they are huge then you don't want to gather them all to one process, you need to figure out how to gather a bunch to each process (the from and two of course have to be one the same process) and then call the VecScatterCreate().

  Barry

> On Feb 19, 2016, at 7:00 PM, Randall Mackie <rlmackie862 at gmail.com> wrote:
> 
> Yes, it makes perfect sense. 
> 
> The issue is that the global size of my ISs are the same, but it’s the local size that is different (because of different DMDAs)
> 
> Is there an easy way to put both IS’s on the same parallel layout. ISCopy doesn’t work in that case.
> 
> Randy
>  
>> On Feb 19, 2016, at 4:39 PM, Matthew Knepley <knepley at gmail.com> wrote:
>> 
>> On Fri, Feb 19, 2016 at 6:33 PM, Randall Mackie <rlmackie862 at gmail.com> wrote:
>> I am trying to do a VecScatter of a subset of elements from a global vector on one DMDA to a global vector on a different DMDA (different sized DMDAs).
>> 
>> I thought what made sense was to create a parallel IS using the local to global mapping obtained from the two DMDAs so that the local portion of each IS contained only the values on that processor.
>> 
>> This works fine as long as the local size of the two IS’s are the same.
>> 
>> But, say I have a situation like this:
>> 
>> DMDA 1:
>>   proc 1: 1 value to scatter
>>   proc 2: 7 values to scatter
>> 
>> 
>> DMDA 2:
>>   proc 1: 4 values to get
>>   proc 2: 4 values to get
>> 
>> This doesn’t work because VecScatterCreate says the local size of the IS’s must be the same.
>> 
>> Is the only way to set up this VecScatter to create a sequential IS on each processor of length 8 and duplicate the values?
>> 
>> The two inputs are
>> 
>>   index of input vector --> input of output vector
>> 
>> and you can have as many entries of this map on any process as you want. Clearly, you
>> need the same number of entires in each IS to make this map meaningful. Does that make
>> sense?
>> 
>>   Thanks,
>> 
>>     Matt
>>  
>> Thanks,
>> 
>> Randy M.
>> 
>> 
>> 
>> 
>> -- 
>> 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
> 



More information about the petsc-users mailing list