[Dune-devel] SOCIS 2014: questions

Markus Blatt markus at dr-blatt.de
Tue Jul 22 17:43:38 CEST 2014


On Tue, Jul 22, 2014 at 01:22:41PM +0000, Agnese, Marco wrote:
> Hi Markus,
> before doing the my test I took a look to both examples and doc which you mention. 
> 
> >    ^^^
> >     Either this has to 3 here or the third row in the matrix has to
> >     be 0 0 0 4 0 7
> 
> I meant that the entry is 4 before communication on rank 1 but after it is a copy of the value of rank 0 therefore 3. 
> 
> Thank you for the explanation but i still don't understand one thing. 
> I set the index set as
> 
>   indices.beginResize();  if(rank==0){
>    indices.add(0,LocalIndexType(0,AttributeSetType::owner,true));
>    indices.add(1,LocalIndexType(1,AttributeSetType::owner,true));
>    indices.add(2,LocalIndexType(2,AttributeSetType::owner,true));
>    indices.add(5,LocalIndexType(3,AttributeSetType::copy,true));
>  }
>  else{
>    indices.add(2,LocalIndexType(0,AttributeSetType::copy,true));
>    indices.add(5,LocalIndexType(1,AttributeSetType::owner,true));
>    indices.add(3,LocalIndexType(2,AttributeSetType::owner,true));
>    indices.add(4,LocalIndexType(3,AttributeSetType::owner,true));
>  }
>  indices.endResize();

Somehow this contradicts your other mail. Here you have 6 global
indices, but in another mail you write the global matrix as: 

> > At some point I set the indexset in order to describe the following
> > global structures
> >
> > A ={1 0 0 0 0;0 2 0 0 0; 0 0 3 0 7;0 0 0 5 0; 0 0 0 0 0 6}
> > x={1;2;3;5;6}
> >

This means your system only has 5 degrees of freedom! That cannot
work. Either you are missing one matrix row, or your index set is too
large.

> and x now is correct but the product isn't.  I think I have some
> misunderstanding on how to chose the index. I try to explain my
> reasoning so you can tell me where I am wrong.

Running this with valgrind might show memory errors here.
> 
> On rank 0 I have 3 nonzeros entries owned A[0][0] A[1][1] and A[2][2] which have respectively local index 0,1 and 2. I have to augment the partition since A[2][5]!=0 therefore I set a copy local index with value 3. The global index is 0 (A[0][0]), 1 (A[1][1]) and 2 (A[2][2]) for the owned entries while is 5 for the copy entry.
>

Associating matrix entries with indices the way you do is rather
confusing for me. I usually only associate them with degrees of
freedom (which have a natural relation ship to local vector entries).

Is A the local matrix here? Then there is no  A[2][5]. Therefore I
assume it must be the one that is globally stored.

> On rank 1 I have 3 nonzeroes entries owned A[0][2] A[1][1] and
> A[2][2] which have local index 1,2 and 3 respectively. The entry
> A[0][0] is a copy and has local index 0. The global index is 5
> (A[0][2]), 3 (A[1][1]) and 4 (A[2][2]) and 2 for the copy entry.

Now I am lost. Let us stick to my way of reasoning. Each index is
associated with one global and one local DOF. The  DOFs are
stored in a vector v locally (index is the local index). Let I_p be
the mapping from global to local index on process p. Then given that
the global index i is stored on p as owner, v[I_p[i]] is the entry at index i
of the global container. 

For the matrix we use the same index set for the right and left hand
side. Therefore if i and j are stored on p as owner and A is the locally stored
matrix, the A[I_p[i]][A[I_p[j]] is the entry of the global matrix.

If the indices are not owned the entries are there, but might have
different values.

How does your global and local matrices now look exactly?

Leaving the rest for reference.
> 
> Therefore, the local indices are assigned reading the matrix by row. Instead, the global indices are assigned first from 0 to 4 for the diagonal entries and 5 is assigned to the nonzero entry off the diagonal.
> 
> What am I doing wrong?
> 
> The output is
> 
> [rank 0] x after communication
> 1
> 2
> 3
> [rank 1] x after communication
> 3
> 5
> 6
> 
> 
> [rank 0] y=Ax with Schwarz operator
> 1
> 4
> 9
> [rank 1] y=Ax with Schwarz operator
> 0
> 25
> 36
> 
> while I would expect
> 
> 
> [rank 0] y=Ax with Schwarz operator
> 1
> 4
> 51
> [rank 1] y=Ax with Schwarz operator
> 51
> 25
> 36
> 
> 

Markus

-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140722/17f6a3e6/attachment.sig>


More information about the Dune-devel mailing list