[Dune-devel] SOCIS 2014: questions

Agnese, Marco m.agnese13 at imperial.ac.uk
Tue Jul 22 15:22:41 CEST 2014


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();

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.

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.

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.

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



Thank you,
cheers,
Marco.


 

________________________________________
From: Markus Blatt [markus at dr-blatt.de]
Sent: Tuesday, July 22, 2014 10:55 AM
To: Agnese, Marco
Cc: dune-devel at dune-project.org
Subject: Re: SOCIS 2014: questions

Hi,

On Mon, Jul 21, 2014 at 06:26:42PM +0000, Agnese, Marco wrote:
> Hi Markus,
> I answer here because I didn't receive any email from the malinglist and I don't know how to answer without opening a new thread.
>

This should be as easy as hitting reply to all (I do not know how to
do this with your mailer)  or manually setting CC to
dune-devel at dune-project.org (like I did here). I will try to always
reply to you and keep dune-devel in  the cc.

> First of all I would ask you a question about the owneroverlapcopycopy. I write a very simple code to understand how it works
>
> https://github.com/magnese/dune-istl/blob/threads/dune/istl/test/simpleoverlaptest.cc
>
> but it doesn't work as I expected therefore I have misunderstood something. If you can enlighten me it would be great:)
>
> So In this code I create a sparse matrix and a sparse vector
>
> rank 0:
> A ={1 0 0;0 2 0; 0 0 3}
> x={1;2;3}
> rank 1:
> A ={4 0 7;0 5 0; 0 0 6}
     ^^^
     Either this has to 3 here or the third row in the matrix has to
     be 0 0 0 4 0 7
> x={4;5;6}
>
> 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}
>
> therefore I set on rank 0 for all the entries the flag owner,

This is simply not possible in this concept as eache owner row has to
know all nonzero entries of the global matrix. Therefore either the
last index is overlap and owner on the other process or you have to
add another additional index (the last global index of the problem) as
overlap/copy.


> while for rank 1 I set copy for A[0][0] and overlap for A[0][2].

I do not understand what you mean here.

Let us stick to your example and two processes (BTW: similar examples
should also be in the papers and in the files below
dune-common/doc/comm. It migh also be helpfull to take a look at
dune-istl/dune/istl/paamg/test/anisotropic.hh (Shame on me for not
documenting this one.).

First we create a partition of the global index set:
I_0={0, 1, 2} I_1={4, 5} (BTW these will all have the attribute owner}

Augment the index sets:
0: only row 2 has a nonzero A_{2,5} that represents a connection to a degree of freedom  that is not in I_0
   => I_0 := I_0 \cup {5} (Note: 5 will have attribute copy)

Now you can set up the parallel index and local matrices by assigning
each global index a local one.

J_0={(0,0,o), (1,1,o), (2,2,o), (5,3,c)}
A_0=[1 0 0 0
     0 2 0 0
     0 0 3 7
     0 0 0 1]

I will skip the second process.


HTH

Markus
--
Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany,  USt-Id: DE279960836
Tel.: +49 (0) 160 97590858



More information about the Dune-devel mailing list