[petsc-users] several DAs with different dofs

Barry Smith bsmith at mcs.anl.gov
Thu Nov 7 16:28:18 CST 2013


On Nov 7, 2013, at 4:10 PM, Juha Jäykkä <juhaj at iki.fi> wrote:

>>  Just create another DA with a different dof argument and then use the
>> DMGetGlobalVector() to get an empty vector and fill it up as needed with
>> the data[][][] style
> 
> Thanks for the idea! Will that be guaranteed to have the same layout?

  Yes, unless you manually control the layout of one of them they will all have the same layout

> I would 
> not want to end up with one DA split to 4 MPI ranks along some axis and the 
> other DA split to 3: then I would not have the right data.
> 
> This also has another disadvantage: I end up using a LOT more memory than I 
> actually need: all the DA structures that get allocated before I create any 
> vectors, would get allocated mostly for nothing because I will never create a 
> local vector out of it and never do any MPI calls with it.
> 
> Bottom line: if the answer to my question above is "yes", I would still prefer 
> a way which consumes less memory if there is an easy one. 

   There is no easier way. Just live with the memory usage.

> 
> Cheers,
> Juha
> 
>> 
>>   Barry
>> 
>> On Nov 7, 2013, at 3:35 PM, Juha Jäykkä <juhaj at iki.fi> wrote:
>>> Hi list!
>>> 
>>> I am thinking of pre-computing and storing some values that are used often
>>> during a single TS iteration. I thought I'd create another vector from my
>>> DA stick those values there: that would be the cleanest solution.
>>> However, the dof of the DA is not big enough to hold all my pre-computed
>>> values!
>>> 
>>> Any suggestions how to do this?
>>> 
>>> Unless I miss something obvious, here are my "requirements". I do not need
>>> the data across iterations. but I'd rather not realloc it every time
>>> either. The data need no ghosts (the data are just local values of some
>>> functions of my variables, so any ghosts needed are the ghosts of the
>>> variables). I would value a data[][][]-style indexing for simplicity (of
>>> code). And finally, I would value the possibility of saving these for
>>> inspection under some circumstances in the same format as the main data
>>> (i.e. VecView).
>>> 
>>> Cheers,
>>> Juha
> -- 
> 		 -----------------------------------------------
> 		| Juha Jäykkä, juhaj at iki.fi			|
> 		| http://koti.kapsi.fi/~juhaj/			|
> 		 -----------------------------------------------
> 



More information about the petsc-users mailing list