[Trilinos-Users] getGlobalNumRows(), Tpetra

Hysom, David A. hysom1 at llnl.gov
Thu Oct 27 12:45:39 EDT 2016


Hi,

We're using a 2D distributed CrsMatrix.
Per your documentation here:
https://trilinos.org/docs/r11.10/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html#a8cd81aca81c80d690e8acc0f800d8a55
We should use this to get the number of rows in the matrix:
globalNumRows = getRangeMap()<https://trilinos.org/docs/r11.10/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html#a331bf51d3bf0bdeee0d20391a7826a9e>->getGlobalNumElements();

However, this is returning the number of (non-zero) entries in the matrix!
Can you explain this?

As an ugly work-around, we're using:

global_ordinal_t num_rows = 1 + A->getRangeMap()<https://webmail.llnl.gov/owa/redir.aspx?REF=xRxOjTBUUQ4DUdsd_jZWKBfTKncbhOVcRgYraytUiZmDbG6UiP7TCAFodHRwczovL3dlYm1haWwubGxubC5nb3Yvb3dhL3JlZGlyLmFzcHg_UkVGPW1KNDZnei10V1lhakRYamEwbEpvQ0NWZWtrRzV6X2FqanJndU83U2VMUFJlVGFYUWhQN1RDQUZvZEhSd2N6b3ZMM1J5YVd4cGJtOXpMbTl5Wnk5a2IyTnpMM0l4TWk0NEwzQmhZMnRoWjJWekwzUndaWFJ5WVM5a2IyTXZhSFJ0YkM5amJHRnpjMVJ3WlhSeVlWOHhYekZEY25OTllYUnlhWGd1YUhSdGJDTmhaak5qTVdSbFpXWmhNemsxTkdObVl6UXhaRGMxT0dFeU5XWmpZak5pTlRnLg..>->getMaxAllGlobalIndex();

The following is for a matrix with 34 rows and 156 non-zeros (the well-known
karate graph):

=====
P_0
is twoD? 1
A->getRowMap()->getGlobalNumElements(): 47
A->getRangeMap()->getGlobalNumElements(): 156
A->getRangeMap()->getNodeNumElements(): 9
A->getRangeMap()->getMaxAllGlobalIndex(): 33
A->getRangeMap()->getMinGlobalIndex(): 0
A->getRangeMap()->getMaxGlobalIndex(): 8
A->getRangeMap()->getMinLocalIndex(): 0
A->getRangeMap()->getMaxLocalIndex(): 8
A->getRangeMap()->isContiguous(): 0
A->getRangeMap()->isDistributed(): 1
A->getRowMap()->isContiguous(): 0
A->getRowMap()->isDistributed(): 1
my global elements (in the range map): 0 1 2 3 4 5 6 7 8

=====
P_1
is twoD? 1
A->getRowMap()->getGlobalNumElements(): 47
A->getRangeMap()->getGlobalNumElements(): 156
A->getRangeMap()->getNodeNumElements(): 9
A->getRangeMap()->getMaxAllGlobalIndex(): 33
A->getRangeMap()->getMinGlobalIndex(): 9
A->getRangeMap()->getMaxGlobalIndex(): 17
A->getRangeMap()->getMinLocalIndex(): 0
A->getRangeMap()->getMaxLocalIndex(): 8
A->getRangeMap()->isContiguous(): 0
A->getRangeMap()->isDistributed(): 1
A->getRowMap()->isContiguous(): 0
A->getRowMap()->isDistributed(): 1
my global elements (in the range map): 9 10 11 12 13 14 15 16 17

=====
P_2
is twoD? 1
A->getRowMap()->getGlobalNumElements(): 47
A->getRangeMap()->getGlobalNumElements(): 156
A->getRangeMap()->getNodeNumElements(): 8
A->getRangeMap()->getMaxAllGlobalIndex(): 33
A->getRangeMap()->getMinGlobalIndex(): 18
A->getRangeMap()->getMaxGlobalIndex(): 25
A->getRangeMap()->getMinLocalIndex(): 0
A->getRangeMap()->getMaxLocalIndex(): 7
A->getRangeMap()->isContiguous(): 0
A->getRangeMap()->isDistributed(): 1
A->getRowMap()->isContiguous(): 0
A->getRowMap()->isDistributed(): 1
my global elements (in the range map): 18 19 20 21 22 23 24 25

=====
P_3
is twoD? 1
A->getRowMap()->getGlobalNumElements(): 47
A->getRangeMap()->getGlobalNumElements(): 156
A->getRangeMap()->getNodeNumElements(): 8
A->getRangeMap()->getMaxAllGlobalIndex(): 33
A->getRangeMap()->getMinGlobalIndex(): 26
A->getRangeMap()->getMaxGlobalIndex(): 33
A->getRangeMap()->getMinLocalIndex(): 0
A->getRangeMap()->getMaxLocalIndex(): 7
A->getRangeMap()->isContiguous(): 0
A->getRangeMap()->isDistributed(): 1
A->getRowMap()->isContiguous(): 0
A->getRowMap()->isDistributed(): 1
my global elements (in the range map): 26 27 28 29 30 31 32 33

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20161027/f7be3510/attachment.html>


More information about the Trilinos-Users mailing list