On 2/19/21 2:38 PM, Timo Heister wrote:
I see additional problems with separate communicators per object:
1. For me it is unclear how operations that involve more than one
object should communicate. For example, a mat-vec has 2 vectors (src,
dst) and a matrix and as such 3 communicators. Of course you can make
an arbitrary choice here, but this doesn't seem clean to me.
That's true, but the point is to avoid different objects communicating
on the same communicator. Which of the three you mention here is, in
the end, not important -- in fact, we don't care: Let PETSc or
Trilinos do what they need to do.
Well, there are parts where we do care, because we have our own parallel
vectors and parallel matrix-vector products (mostly matrix-free
functionality). Those cases are linked to the triangulation's
communicator, which might be the place where duplicating a communicator
makes sense. One could do it also with a finer granularity inside
certain collections of vectors, but the crucial ingredient is to make
data structures aware of the places where objects with different
communicators come together, like different communicators in the domain
and range partitioner of a matrix-vector product. It's actually on my
todo list to use different communicators on coarser levels of the
multigrid hierarchy, either in terms of different triangulations for
(global coarsening) or just the levels in the regular h-multigrid with
local smoothing we have had for a long time.
The important message is that we can't simply go through the library and
switch over to duplicating communicators for every class where we hand
in and store a communicator, but, at least for the linear algebra part
like parallel vectors and MatrixFree, decide on a case-by-case basis so
that we don't accidentally destroy things.
2. MPI_comm_dup can involve communication and as such can be slow for
large processor counts. Not sure you want to always pay the price for
that. I remember at least one MPI implementation that does an
allreduce (or something worse than that).
That is true too, though one would assume that whatever one ends up
doing on these communicators is going to be more expensive than the
duplication.
It depends on what you are doing and on what scale you are running. For
some MPI implementations, the duplication can be pretty expensive (on
the order of seconds) once you reach 100k or more ranks, depending on
how they implement the operation. Imagine what happens if you do an
MPI_Comm_dup every time you enter a Schur complement approximate inverse
and request a temporary vector for the local solvers - an operation that
otherwise scales well down to 1e-3 to 1e-4 seconds. Again, you need a
case-by-case decision, and everything the below the level of the
triangulation needs to be audited at least.
It may not be an important issue. Would a compromise be to duplicate
communicators in the constructors of all main classes in the tutorial,
as a recommendation of best practices. (This is what ASPECT does, for
reference.) This doesn't address the issue of what can go wrong when
using multiple threads from within the main class, but it would at
least address the issue if someone wanted to run multiple instances of
the main class in parallel, and may bring the issue to people's mind.
Apart from the disagreement I expressed above, here I completely agree
with you.
Best,
Martin
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/9dce8c01-158f-30a3-f4aa-0a4f70dc5d3e%40gmail.com.