Dear all, I am working with a simple Poisson equation to understand better the parallel computing. So far, according to the plot in paraview, I am able to get the same correct solution using a different number of processes. For later use, I want to access the solution data as a unique local sequential numpy array that has as components the value of the solution for each node of the mesh. I thought that u.vector().gather() is the option I need, but when I print it I get different values for each processor. Here is an example for print(uu.vector().gather()) for different N processors : N= 1 [2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964] N=2 [2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964] [2. 2. 2.01788253 2.01556306 2.02651517 2. 2.01725592 1.98544718 2.02588859 2. 2.01137299 1.98085025 1.98009714 1.9850916 1.97727273 1.98118216] N=4 [1.97689956 1.98690345 2.01309647 2.02655104 2.02310037 2. 2. 2. 1.98313422 2. 1.97892604 2.01686572 2.02107399 2.01943249 1.98056736 1.97344906] [1.97689956 1.98690345 2.01309647 2.02655104 2.02310037 2. 2. 2. 1.98313422 2. 1.97892604 2.01686572 2.02107399 2.01943249 1.98056736 1.97344906] [2. 2. 2.01788253 2. 2.01556304 2.02651515 2.01137299 1.98085017 1.98509166 1.97727273 1.98118219 1.98009727 2.01725589 2.02588851 1.98544706 2. ] [2. 2. 2.01788253 2. 2.01556304 2.02651515 2.01137299 1.98085017 1.98509166 1.97727273 1.98118219 1.98009727 2.01725589 2.02588851 1.98544706 2. ] What I would like to have is that for each processor the output coincide with the sequential solution for N=1, i.e. [2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964] Could someone please suggest how to do it? Thank you in advance, best regards, Luca Mechelli -- Luca Mechelli Wissenschaftlicher Mitarbeiter Arbeitsgruppe Numerik Fachbereich Mathematik und Statistik Universität Konstanz Fach D 198 D-78457 Konstanz Telefon: +49-(0) 7531-88-4637
Dear Luca,
On 3 Jul 2019, at 09:43, Luca Mechelli <luca.mechelli@uni-konstanz.de> wrote:
Dear all,
I am working with a simple Poisson equation to understand better the parallel computing. So far, according to the plot in paraview, I am able to get the same correct solution using a different number of processes.
For later use, I want to access the solution data as a unique local sequential numpy array that has as components the value of the solution for each node of the mesh. I thought that u.vector().gather() is the option I need, but when I print it I get different values for each processor.
I wonder if what is happening is that the printing is somehow being interleaved (it is not synchronised across the different processes). However, this "allgather" approach is not very scalable as soon as you start running bigger problems. Can you explain in a little more detail what you would like to do with the solution once you've obtained it. It may be possible to do something more neatly. Thanks, Lawrence
Here is an example for print(uu.vector().gather()) for different N processors :
N= 1 [2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964]
N=2 [2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964] [2. 2. 2.01788253 2.01556306 2.02651517 2. 2.01725592 1.98544718 2.02588859 2. 2.01137299 1.98085025 1.98009714 1.9850916 1.97727273 1.98118216]
N=4 [1.97689956 1.98690345 2.01309647 2.02655104 2.02310037 2. 2. 2. 1.98313422 2. 1.97892604 2.01686572 2.02107399 2.01943249 1.98056736 1.97344906] [1.97689956 1.98690345 2.01309647 2.02655104 2.02310037 2. 2. 2. 1.98313422 2. 1.97892604 2.01686572 2.02107399 2.01943249 1.98056736 1.97344906] [2. 2. 2.01788253 2. 2.01556304 2.02651515 2.01137299 1.98085017 1.98509166 1.97727273 1.98118219 1.98009727 2.01725589 2.02588851 1.98544706 2. ] [2. 2. 2.01788253 2. 2.01556304 2.02651515 2.01137299 1.98085017 1.98509166 1.97727273 1.98118219 1.98009727 2.01725589 2.02588851 1.98544706 2. ]
What I would like to have is that for each processor the output coincide with the sequential solution for N=1, i.e.
[2. 2. 2.01686578 2.02107396 2.01943246 2.02655103 2. 1.98313432 2.01309658 2.02310037 1.98056756 2. 1.97892594 1.98690342 1.97344897 1.97689964]
Could someone please suggest how to do it?
Thank you in advance, best regards, Luca Mechelli
participants (2)
- 
                
                Lawrence Mitchell
- 
                
                Luca Mechelli