Re: [deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-09-04 Thread Bruno Blais
Dear Wolfgang,
Thank you, everything is clear now and i managed to accomplish what I 
wanted. 
Thanks!
Bruno


On Tuesday, 3 September 2019 19:09:00 UTC-4, Wolfgang Bangerth wrote:
>
>
> Bruno, 
>
> > Is there a different between how DynamicSparsityPatterns and 
> > BlockDynamicSparsityPatterns behave? 
>
> The latter is just an array of the former. Under the hood, every block 
> is simply a DynamicSparsityPattern that can be initialized in the same 
> way one always does. 
>
>
> > When you look at step-40, which is the first "MPI" step, the way the 
> > sparsity pattern is made is 
> > (
> https://dealii.org/current/doxygen/deal.II/step_40.html#LaplaceProblemsetup_system)
>  
>
> > | 
> > DynamicSparsityPattern 
> > <
> https://dealii.org/current/doxygen/deal.II/classDynamicSparsityPattern.html>dsp(locally_relevant_dofs);
>  
>
> > DoFTools::make_sparsity_pattern 
> > <
> https://dealii.org/current/doxygen/deal.II/group__constraints.html#gad93530ee35c780e9ef7bc5e4856039df>(dof_handler,dsp,constraints,false);
>  
>
> > SparsityTools::distribute_sparsity_pattern 
> > <
> https://dealii.org/current/doxygen/deal.II/namespaceSparsityTools.html#ae2c7bdbdb62642f60d60087e4cb6195f>(
>  
>
> > dsp, 
> > dof_handler.n_locally_owned_dofs_per_processor(), 
> > mpi_communicator, 
> > locally_relevant_dofs); 
> > | 
> > 
> > My understanding was that you were only making the sparsity pattern for 
> > your own locally relevants dofs and the distribution step would make 
> > sure that everything was coherent. 
>
> Correct. 
>
>
> > However, the sparsity pattern is made 
> > in a completely different way in step-32 
> > (https://dealii.org/current/doxygen/deal.II/step_32.html) and the 
> > TrilinosWrappers:BlockSparsityPattern is used. 
>
> Correct. In step-40, we use PETSc, which has no sparsity pattern data 
> structure of its own, and so we need to initialize the PETSc matrices 
> with our own. In contrast, Trilinos has its own sparsity pattern 
> classes, and so to initialize a Trilinos matrix, we need to build one of 
> their sparsity patterns. (Or block patterns, as it may be -- which again 
> is just an array of patterns.) 
>
>
> > Consequently, I was a bit confused as to the difference between these 
> > approaches. It seems like the second one is necessary for Block 
> matrices? 
> > I will take a deeper look into this, but I must say my understanding of 
> > that point right now is relatively poor :( 
>
> The difference has nothing to do with blocks and everything with whether 
> you base your linear algebra on PETSc or Trilinos. 
>
> Does this help? 
>
> Cheers 
>   W. 
>
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/d7d6b2fe-d2ca-4ea4-9c21-b19953cf2524%40googlegroups.com.


Re: [deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-09-03 Thread Wolfgang Bangerth


Bruno,

> Is there a different between how DynamicSparsityPatterns and 
> BlockDynamicSparsityPatterns behave?

The latter is just an array of the former. Under the hood, every block 
is simply a DynamicSparsityPattern that can be initialized in the same 
way one always does.


> When you look at step-40, which is the first "MPI" step, the way the 
> sparsity pattern is made is 
> (https://dealii.org/current/doxygen/deal.II/step_40.html#LaplaceProblemsetup_system)
> |
> DynamicSparsityPattern 
> dsp(locally_relevant_dofs);
> DoFTools::make_sparsity_pattern 
> (dof_handler,dsp,constraints,false);
> SparsityTools::distribute_sparsity_pattern 
> (
>     dsp,
>     dof_handler.n_locally_owned_dofs_per_processor(),
>     mpi_communicator,
>     locally_relevant_dofs);
> |
> 
> My understanding was that you were only making the sparsity pattern for 
> your own locally relevants dofs and the distribution step would make 
> sure that everything was coherent.

Correct.


> However, the sparsity pattern is made 
> in a completely different way in step-32 
> (https://dealii.org/current/doxygen/deal.II/step_32.html) and the 
> TrilinosWrappers:BlockSparsityPattern is used.

Correct. In step-40, we use PETSc, which has no sparsity pattern data 
structure of its own, and so we need to initialize the PETSc matrices 
with our own. In contrast, Trilinos has its own sparsity pattern 
classes, and so to initialize a Trilinos matrix, we need to build one of 
their sparsity patterns. (Or block patterns, as it may be -- which again 
is just an array of patterns.)


> Consequently, I was a bit confused as to the difference between these 
> approaches. It seems like the second one is necessary for Block matrices?
> I will take a deeper look into this, but I must say my understanding of 
> that point right now is relatively poor :(

The difference has nothing to do with blocks and everything with whether 
you base your linear algebra on PETSc or Trilinos.

Does this help?

Cheers
  W.


-- 

Wolfgang Bangerth  email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/daeb73c6-cee8-8a0f-2abe-074c44d30a59%40colostate.edu.


Re: [deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-09-01 Thread Bruno Blais
Dear Wolfgang,
Thank you very much for your message.
Is there a different between how DynamicSparsityPatterns and 
BlockDynamicSparsityPatterns behave?
When you look at step-40, which is the first "MPI" step, the way the 
sparsity pattern is made is (
https://dealii.org/current/doxygen/deal.II/step_40.html#LaplaceProblemsetup_system
)
DynamicSparsityPattern 
 
dsp(locally_relevant_dofs);
 DoFTools::make_sparsity_pattern 

(dof_handler, dsp, constraints, false);
 SparsityTools::distribute_sparsity_pattern 

(
   dsp,
   dof_handler.n_locally_owned_dofs_per_processor(),
   mpi_communicator,
   locally_relevant_dofs);

My understanding was that you were only making the sparsity pattern for 
your own locally relevants dofs and the distribution step would make sure 
that everything was coherent. However, the sparsity pattern is made in a 
completely different way in step-32 (
https://dealii.org/current/doxygen/deal.II/step_32.html) and the 
TrilinosWrappers:BlockSparsityPattern is used.

Consequently, I was a bit confused as to the difference between these 
approaches. It seems like the second one is necessary for Block matrices?
I will take a deeper look into this, but I must say my understanding of 
that point right now is relatively poor :(
Thanks!
Bruno




On Friday, 30 August 2019 23:41:05 UTC-4, Wolfgang Bangerth wrote:
>
>
> Bruno, 
> I don't quite recall if we ever used the BlockDynamicSparsityPattern in a 
> parallel context. For sure, the way you're initializing it implies that 
> every 
> process allocates the memory for all DoFs as it's not given the 
> information 
> about locally_relevant_dofs. I'd have to look up whether there is a way to 
> do 
> that. On the other hand, I would assume that the Trilinos version has a 
> way to 
> designate what are the locally relevant dofs on each process. 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3d5e5349-ef9a-4a8e-8922-bcd3256caa08%40googlegroups.com.


Re: [deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-08-30 Thread Wolfgang Bangerth


Bruno,
I don't quite recall if we ever used the BlockDynamicSparsityPattern in a 
parallel context. For sure, the way you're initializing it implies that every 
process allocates the memory for all DoFs as it's not given the information 
about locally_relevant_dofs. I'd have to look up whether there is a way to do 
that. On the other hand, I would assume that the Trilinos version has a way to 
designate what are the locally relevant dofs on each process.

Best
  W.

-- 

Wolfgang Bangerth  email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/6660a035-74c3-1219-c886-70b71c800305%40colostate.edu.