Extract constant modes slow

31 views
Skip to first unread message

Jonathan Russ

unread,
Jan 23, 2020, 7:00:05 PM1/23/20
to deal.II User Group
Hello -

I noticed that the Trilinos ML preconditioner accessed through the TrilinosWrappers benefits heavily from supplying the constant modes or the null-space of the laplace operator. Using the extract_constant_modes functionality I notice that this can take quite a bit of time for a vector valued problem (with 135,000 dofs on 30 processors this took about 7 minutes). I was wondering if there is some way for me to speed this calculation up somehow? What affects the calculation the most (should I not reorder the dofs, etc)?

Thank you very much in advance for any advice you might provide,
Jonathan

Wolfgang Bangerth

unread,
Jan 24, 2020, 12:49:34 PM1/24/20
to dea...@googlegroups.com
On 1/23/20 5:00 PM, Jonathan Russ wrote:
>
> I noticed that the Trilinos ML preconditioner accessed through the
> TrilinosWrappers benefits heavily from supplying the constant modes or
> the null-space of the laplace operator. Using the extract_constant_modes
> functionality I notice that this can take quite a bit of time for a
> vector valued problem (with 135,000 dofs on 30 processors this took
> about 7 minutes). I was wondering if there is some way for me to speed
> this calculation up somehow? What affects the calculation the most
> (should I not reorder the dofs, etc)?

Jonathan -- interesting. We do this in most of our codes, and it has
never come up as a problem. Do you think you could construct a minimal
example that shows this? Just set up a DoFHandler and call
extract_constant_modes().

Best
W.


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

Jonathan Russ

unread,
Jan 24, 2020, 1:37:33 PM1/24/20
to deal.II User Group
Professor Bangerth -

Thank you for your reply, however, I just seemed to have solved my problem. I had a block system with one vector valued field and one scalar valued field. When I extract the constant modes for the vector valued field it is very fast (using the vector component mask). However, the same operation for the scalar valued field does not perform quickly. I see that simply omitting this step for the scalar valued field has almost no effect on the solution of the scalar valued problem. Therefore I no longer have any issue :)

Thank you again for your reply and sorry for taking your time.
Jonathan

Wolfgang Bangerth

unread,
Jan 24, 2020, 1:40:35 PM1/24/20
to dea...@googlegroups.com
On 1/24/20 11:37 AM, Jonathan Russ wrote:
>
> Thank you for your reply, however, I just seemed to have solved my
> problem. I had a block system with one vector valued field and one
> scalar valued field. When I extract the constant modes for the vector
> valued field it is very fast (using the vector component mask). However,
> the same operation for the scalar valued field does not perform quickly.
> I see that simply omitting this step for the scalar valued field has
> almost no effect on the solution of the scalar valued problem. Therefore
> I no longer have any issue :)

Good to know. That said, it might still be interesting to have a
testcase that shows the slow behavior!

Jonathan Russ

unread,
Jan 24, 2020, 1:52:22 PM1/24/20
to deal.II User Group
Professor Bangerth -

Since you asked I decided to time each thing individually that I commented out to make sure I knew which function call was taking so long. It turns out that I was incorrect before when I said that extract_constant_modes was slow. I was initializing the preconditioner immediately afterward for some reason with a zero matrix. This initialization was the reason for additional time. I apologize for the misleading title of the topic now and will be more careful next time.

Thanks,
Jonathan

Wolfgang Bangerth

unread,
Jan 24, 2020, 1:53:31 PM1/24/20
to dea...@googlegroups.com
On 1/24/20 11:52 AM, Jonathan Russ wrote:
>
> Since you asked I decided to time each thing individually that I
> commented out to make sure I knew which function call was taking so
> long. It turns out that I was incorrect before when I said that
> extract_constant_modes was slow. I was initializing the preconditioner
> immediately afterward for some reason with a zero matrix. This
> initialization was the reason for additional time. I apologize for the
> misleading title of the topic now and will be more careful next time.

:-) You just supported the general rule that even good programmers can't
tell where their bottlenecks are without actually putting timers into
their codes ;-)

Best
WB
Reply all
Reply to author
Forward
0 new messages