trilinos sparsity pattern: end iterator of last locally owned row triggers trilinos error

63 views
Skip to first unread message

Simon

unread,
Jan 4, 2024, 2:23:57 PM1/4/24
to deal.II User Group
Dear all,

attached is a minimal example with 125 dofs, where dofs with indices 0-74 
live on proccesor 0 and dofs with indices 75-124 live on processor 1
(two MPI processes).

Consider the following code to loop over the rows of a Trilinos sparsity pattern:
// make_sparsity_pattern,...
for(unsigned int row = 0; row < dofHandler.n_dofs(); ++row)
{
   if( ! sparsityPattern.row_is_stored_locally(row)) continue;
   auto it = sparsityPattern.begin(row);
   auto itend = sparsityPattern.end(row);
   // do something with the columns
   while(it != itend) { it->column();...}
}

For row=74 on processor 0, there is an error

dealii::TrilinosWrappers::SparsityPatternIterators::Accessor::visit_present_row()
"An error with error number -1 occurred while calling a Trilinos function"

The mentioned Trilinos function is ExtractGlobalRowCopy() and the error number
suggests an access to a row which is not locally owned.
This makes sense to me because 
sparsityPattern.end(74) calls visit_present_row(75),
which is indeed not locally owned.

Not sure whether I miss something or this is a bug.
My expectation was to use the begin and end iterators on all locally owned rows.

Thank you,
Simon
iterators.cc

Wolfgang Bangerth

unread,
Jan 4, 2024, 3:50:36 PM1/4/24
to dea...@googlegroups.com

Simon:
A bug. And a timely one in view of the fact that I have been thinking about
exactly this issue recently:
https://github.com/dealii/dealii/pull/16406
Would you be willing to create a complete example, and open a bug report for
this on github?

Best
W.

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


Simon

unread,
Jan 4, 2024, 4:45:56 PM1/4/24
to deal.II User Group
"Would you be willing to create a complete example, and open a bug report for
this on github?"

Sure. I opened an issue 

Do you think this bug has a quick solution?
I am interested in the columns of the rows. 
I did not see a different way to do this than using the row iterators.

Best,
Simon

Wolfgang Bangerth

unread,
Jan 5, 2024, 4:10:39 PM1/5/24
to dea...@googlegroups.com
On 1/4/24 14:45, Simon wrote:
>
> Sure. I opened an issue
> https://github.com/dealii/dealii/issues/16414
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fdealii%2Fissues%2F16414&data=05%7C02%7CWolfgang.Bangerth%40colostate.edu%7Ca70212f26a504628a61e08dc0d6e8ab2%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638400016961182310%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C62000%7C%7C%7C&sdata=7MrC0qqjNuz%2FRD7u6ttIACR2pRoFjIoUxdXmeaosj9o%3D&reserved=0>
>
> Do you think this bug has a quick solution?
> I am interested in the columns of the rows.
> I did not see a different way to do this than using the row iterators.

Yes, I think I know how to fix this. I'll get to it next week when I'm back
from staying at my in-laws.
Reply all
Reply to author
Forward
0 new messages