MPI: Evaluating several distributed functions on each node

21 views
Skip to first unread message

Konrad Simon

unread,
Apr 1, 2022, 10:40:53 AM4/1/22
to deal.II User Group
Dear all,

I am facing a little challenge: Suppose I have several objects myFunction of a certain class MyFunction<dim> derived from a Function<dim> object on each process in my MPI universe. The number of MyFunction objects may vary from process to process.
I am trying to evaluate each object at certain points p that live on a distributed::Triangualtion<dim>. The evaluation points are different for each MyFunction object. A point may be contained in a cell owned by another process whose id is known, so I know where to send it to to ask a MyFunction object on that specific process to evaluate it for me and send the value back.

Now my question: How do I deal with several MyFunction objects on one process (I can identify these by a hash). Is it a good idea to have a class with a set of static variables and methods on each node to manage the communication and distribute necessary information within the process using the specific MyFunction hash? Does that make sense?

Let me stress again, the difficulty here is that I have several objects that may ask for values one by one or even in a (shared memory) parallel manner that may or may not trigger communication (sort of some_to_some style as implemented in Deal.II). 

Thanks in advance :-)

Best,
Konrad

Wolfgang Bangerth

unread,
Apr 1, 2022, 12:05:53 PM4/1/22
to dea...@googlegroups.com
Let me phrase what I think you are trying to do differently: In your global
MPI universe, you have many function objects and there are instances where one
process has to ask another process to evaluate one of these functions object
within the latter's process space. In order to do this, the former process
needs to (i) be able to identify the rank of the latter process, and (ii)
describe to the latter which function to evaluate and where.

You can do this in many different ways. One is a pair
(hash, point)
another would be
(string, point)
where in either case, the first element of the pair uniquely identifies the
function you want to evaluate in a way that is globally unique. If you have a
way to create a has, that's fine. If you can describe each function by a name
(string), that's fine too. Which you use is probably immaterial. Either way,
it's probably going to end up as a map from hash (or string) to
pointer-to-function.

The approach does not require that each process actually stores all function
objects. It only needs to store those that it will ever be asked to evaluate.
If you name these functions by a string, you can also just create function
objects on each process on-demand, as soon as a request to evaluate it for the
first time comes in.

Best
W.

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

Reply all
Reply to author
Forward
0 new messages