Re: [deal.II] MPI: Evaluating several distributed functions on each node

2022-04-01 Thread Wolfgang Bangerth

On 4/1/22 08:40, Konrad Simon wrote:


I am facing a little challenge: Suppose I have several objects myFunction of a 
certain class MyFunction derived from a Function 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. 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).


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: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/6d894326-19f4-09ed-00ed-4cf86411ee6c%40colostate.edu.


[deal.II] MPI: Evaluating several distributed functions on each node

2022-04-01 Thread Konrad Simon
Dear all,

I am facing a little challenge: Suppose I have several objects myFunction 
of a certain class MyFunction derived from a Function 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. 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

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/4fb6b294-aa7f-4dc2-b823-e42247bf2302n%40googlegroups.com.