Basically, I want to do the same thing mentioned in Gather solution in parallel - #2 by dajuno in FEniCSX. That is, I want to gather the results from every processor on processor 0. Specifically, I want to obtain the same result as the one without using parallel computation.
Take the Poisson problem Implementation — FEniCSx tutorial (jorgensd.github.io) as an example, we can print the result with
print(u_vertex_values.T)
as
[[3. 2.62 2.63 3.01 2.28 2.29 2.32 2.66 3.04 1.98 1.99 2.02 2.07 2.37
2.71 3.09 1.72 1.73 1.76 1.81 1.88 2.14 2.44 2.78 3.16 1.5 1.51 1.54
1.59 1.66 1.75 1.97 2.23 2.53 2.87 3.25 1.32 1.33 1.36 1.41 1.48 1.57
1.68 1.86 2.08 2.34 2.64 2.98 3.36 1.18 1.19 1.22 1.27 1.34 1.43 1.54
1.67 1.81 1.99 2.21 2.47 2.77 3.11 3.49 1.08 1.09 1.12 1.17 1.24 1.33
1.44 1.57 1.72 1.82 1.96 2.14 2.36 2.62 2.92 3.26 3.64 1.02 1.03 1.06
1.11 1.18 1.27 1.38 1.51 1.66 1.83 1.89 1.99 2.13 2.31 2.53 2.79 3.09
3.43 3.81 1. 1.01 1.04 1.09 1.16 1.25 1.36 1.49 1.64 1.81 2. 2.02
2.08 2.18 2.32 2.5 2.72 2.98 3.28 3.62 4. ]]
However, when we compute it in 2 processors, we will get two separate results as
[[2. 1.81 1.83 2.02 1.64 1.66 1.72 1.89 2.08 1.49 1.51 1.57 1.67 1.82
1.99 2.18 1.36 1.38 1.44 1.54 1.68 1.81 1.96 2.13 2.32 1.25 1.27 1.33
1.43 1.57 1.16 1.18 1.24 1.34 1.48 1.09 1.11 1.17 1.27 1.41 1.04 1.06
1.12 1.22 1.36 1.54 1.01 1.03 1.09 1.19 1.33 1. 1.02 1.08 1.18 1.32
2.5 2.31 2.14 1.99 1.86 1.75 1.66 1.59 1.51 1.5 1.72 1.73 1.76 1.81
1.88 1.97 2.08 2.21 2.36 2.53 2.72]]
[[2.5 2.53 2.72 2.31 2.36 2.62 2.79 2.98 2.14 2.21 2.47 2.77 2.92 3.09
3.28 1.99 2.08 2.34 2.64 2.98 3.11 3.26 3.43 3.62 1.86 1.97 2.23 2.53
2.87 3.25 3.36 3.49 3.64 3.81 4. 1.75 1.88 2.14 2.44 2.78 3.16 1.66
1.81 2.07 2.37 2.71 3.09 1.59 1.76 2.02 2.32 2.66 3.04 1.73 1.99 2.29
2.63 3.01 1.51 1.72 1.98 2.28 2.62 3. 1.5 1.54 1.32 1.33 1.36 1.41
1.48 1.57 1.68 1.81 1.96 2.13 2.32]]
Even if we use the function MPI.COMM_WORLD.gather()
, we just obtain a simple combination of these two results. So is it possible to resume the result without using parallel computation?
Thanks!