Thank you for your answer. I installed FEniCS from source on Linux. I installed DOLFINx v0.7 and I use Open MPI v4.0.5.
Further tests show that the problem comes from the partitioner. I took the partitioner from the python/test/unit/mesh/test_mesh_partitioners.py
in the test test_asymmetric_partitioner
:
import numpy as np
import dolfinx
from mpi4py import MPI
from dolfinx import mesh
def partitionerUnitTest(comm, n, m, topo):
r = comm.Get_rank()
dests = []
offsets = [0]
for i in range(topo.num_nodes):
dests.append(r)
if r == 1:
dests.append(0)
offsets.append(len(dests))
dests = np.array(dests, dtype=np.int32)
offsets = np.array(offsets, dtype=np.int32)
return dolfinx.cpp.graph.AdjacencyList_int32(dests, offsets)
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitionerUnitTest)
And that runs fine!
Moreover I tried to use the partitioners provided by dolfinx.graph
. If I use partitioner
, I get the following error:
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 33, in <module>
Traceback (most recent call last):
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 33, in <module>
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner(): incompatible function arguments. The following argument types are supported:
1. () -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x147de73b6d50>, 2, 2, <AdjacencyList> with 64 nodes
0: [0 1 9 10 ]
1: [1 2 10 11 ]
2: [2 3 11 12 ]
3: [3 4 12 13 ]
4: [4 5 13 14 ]
5: [5 6 14 15 ]
6: [6 7 15 16 ]
7: [7 8 16 17 ]
8: [9 10 18 19 ]
9: [10 11 19 20 ]
10: [11 12 20 21 ]
11: [12 13 21 22 ]
12: [13 14 22 23 ]
13: [14 15 23 24 ]
14: [15 16 24 25 ]
15: [16 17 25 26 ]
16: [18 19 27 28 ]
17: [19 20 28 29 ]
18: [20 21 29 30 ]
19: [21 22 30 31 ]
20: [22 23 31 32 ]
21: [23 24 32 33 ]
22: [24 25 33 34 ]
23: [25 26 34 35 ]
24: [27 28 36 37 ]
25: [28 29 37 38 ]
26: [29 30 38 39 ]
27: [30 31 39 40 ]
28: [31 32 40 41 ]
29: [32 33 41 42 ]
30: [33 34 42 43 ]
31: [34 35 43 44 ]
32: [36 37 45 46 ]
33: [37 38 46 47 ]
34: [38 39 47 48 ]
35: [39 40 48 49 ]
36: [40 41 49 50 ]
37: [41 42 50 51 ]
38: [42 43 51 52 ]
39: [43 44 52 53 ]
40: [45 46 54 55 ]
41: [46 47 55 56 ]
42: [47 48 56 57 ]
43: [48 49 57 58 ]
44: [49 50 58 59 ]
45: [50 51 59 60 ]
46: [51 52 60 61 ]
47: [52 53 61 62 ]
48: [54 55 63 64 ]
49: [55 56 64 65 ]
50: [56 57 65 66 ]
51: [57 58 66 67 ]
52: [58 59 67 68 ]
53: [59 60 68 69 ]
54: [60 61 69 70 ]
55: [61 62 70 71 ]
56: [63 64 72 73 ]
57: [64 65 73 74 ]
58: [65 66 74 75 ]
59: [66 67 75 76 ]
60: [67 68 76 77 ]
61: [68 69 77 78 ]
62: [69 70 78 79 ]
63: [70 71 79 80 ]
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner(): incompatible function arguments. The following argument types are supported:
1. () -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x14fdabbead50>, 2, 2, <AdjacencyList> with 0 nodes
If I use partitioner_scotch
the error is the following:
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 34, in <module>
Traceback (most recent call last):
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 34, in <module>
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner_scotch)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner_scotch)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner_scotch(): incompatible function arguments. The following argument types are supported:
1. (imbalance: float = 0.025, seed: int = 0) -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x1519c795dd20>, 2, 2, <AdjacencyList> with 64 nodes
0: [0 1 9 10 ]
1: [1 2 10 11 ]
2: [2 3 11 12 ]
3: [3 4 12 13 ]
4: [4 5 13 14 ]
5: [5 6 14 15 ]
6: [6 7 15 16 ]
7: [7 8 16 17 ]
8: [9 10 18 19 ]
9: [10 11 19 20 ]
10: [11 12 20 21 ]
11: [12 13 21 22 ]
12: [13 14 22 23 ]
13: [14 15 23 24 ]
14: [15 16 24 25 ]
15: [16 17 25 26 ]
16: [18 19 27 28 ]
17: [19 20 28 29 ]
18: [20 21 29 30 ]
19: [21 22 30 31 ]
20: [22 23 31 32 ]
21: [23 24 32 33 ]
22: [24 25 33 34 ]
23: [25 26 34 35 ]
24: [27 28 36 37 ]
25: [28 29 37 38 ]
26: [29 30 38 39 ]
27: [30 31 39 40 ]
28: [31 32 40 41 ]
29: [32 33 41 42 ]
30: [33 34 42 43 ]
31: [34 35 43 44 ]
32: [36 37 45 46 ]
33: [37 38 46 47 ]
34: [38 39 47 48 ]
35: [39 40 48 49 ]
36: [40 41 49 50 ]
37: [41 42 50 51 ]
38: [42 43 51 52 ]
39: [43 44 52 53 ]
40: [45 46 54 55 ]
41: [46 47 55 56 ]
42: [47 48 56 57 ]
43: [48 49 57 58 ]
44: [49 50 58 59 ]
45: [50 51 59 60 ]
46: [51 52 60 61 ]
47: [52 53 61 62 ]
48: [54 55 63 64 ]
49: [55 56 64 65 ]
50: [56 57 65 66 ]
51: [57 58 66 67 ]
52: [58 59 67 68 ]
53: [59 60 68 69 ]
54: [60 61 69 70 ]
55: [61 62 70 71 ]
56: [63 64 72 73 ]
57: [64 65 73 74 ]
58: [65 66 74 75 ]
59: [66 67 75 76 ]
60: [67 68 76 77 ]
61: [68 69 77 78 ]
62: [69 70 78 79 ]
63: [70 71 79 80 ]
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner_scotch(): incompatible function arguments. The following argument types are supported:
1. (imbalance: float = 0.025, seed: int = 0) -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x147ff2240d20>, 2, 2, <AdjacencyList> with 0 nodes
And finally with partitioner_parmetis
, the error is:
Traceback (most recent call last):
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 35, in <module>
Traceback (most recent call last):
File "/stck/fpascal/Python/Code/FENICS/Create_mesh.py", line 35, in <module>
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner_parmetis)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral, partitioner=partitioner_parmetis)
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 569, in create_unit_square
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
return create_rectangle(comm, [np.array([0.0, 0.0]), np.array([1.0, 1.0])],
File "/scratchm/fpascal/Softwares/Dist_dolfinx/lib/python3.9/site-packages/dolfinx/mesh.py", line 540, in create_rectangle
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner_parmetis(): incompatible function arguments. The following argument types are supported:
1. (imbalance: float = 1.02, options: Annotated[List[int], FixedSize(3)] = [1, 0, 5]) -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x155206a4bd20>, 2, 2, <AdjacencyList> with 0 nodes
mesh = _cpp.mesh.create_rectangle_float64(comm, points, n, cell_type, partitioner, diagonal)
TypeError: partitioner_parmetis(): incompatible function arguments. The following argument types are supported:
1. (imbalance: float = 1.02, options: Annotated[List[int], FixedSize(3)] = [1, 0, 5]) -> Callable[[MPICommWrapper, int, dolfinx.cpp.graph.AdjacencyList_int64, bool], dolfinx.cpp.graph.AdjacencyList_int32]
Invoked with: <mpi4py.MPI.Intracomm object at 0x151153b1cd20>, 2, 2, <AdjacencyList> with 64 nodes
0: [0 1 9 10 ]
1: [1 2 10 11 ]
2: [2 3 11 12 ]
3: [3 4 12 13 ]
4: [4 5 13 14 ]
5: [5 6 14 15 ]
6: [6 7 15 16 ]
7: [7 8 16 17 ]
8: [9 10 18 19 ]
9: [10 11 19 20 ]
10: [11 12 20 21 ]
11: [12 13 21 22 ]
12: [13 14 22 23 ]
13: [14 15 23 24 ]
14: [15 16 24 25 ]
15: [16 17 25 26 ]
16: [18 19 27 28 ]
17: [19 20 28 29 ]
18: [20 21 29 30 ]
19: [21 22 30 31 ]
20: [22 23 31 32 ]
21: [23 24 32 33 ]
22: [24 25 33 34 ]
23: [25 26 34 35 ]
24: [27 28 36 37 ]
25: [28 29 37 38 ]
26: [29 30 38 39 ]
27: [30 31 39 40 ]
28: [31 32 40 41 ]
29: [32 33 41 42 ]
30: [33 34 42 43 ]
31: [34 35 43 44 ]
32: [36 37 45 46 ]
33: [37 38 46 47 ]
34: [38 39 47 48 ]
35: [39 40 48 49 ]
36: [40 41 49 50 ]
37: [41 42 50 51 ]
38: [42 43 51 52 ]
39: [43 44 52 53 ]
40: [45 46 54 55 ]
41: [46 47 55 56 ]
42: [47 48 56 57 ]
43: [48 49 57 58 ]
44: [49 50 58 59 ]
45: [50 51 59 60 ]
46: [51 52 60 61 ]
47: [52 53 61 62 ]
48: [54 55 63 64 ]
49: [55 56 64 65 ]
50: [56 57 65 66 ]
51: [57 58 66 67 ]
52: [58 59 67 68 ]
53: [59 60 68 69 ]
54: [60 61 69 70 ]
55: [61 62 70 71 ]
56: [63 64 72 73 ]
57: [64 65 73 74 ]
58: [65 66 74 75 ]
59: [66 67 75 76 ]
60: [67 68 76 77 ]
61: [68 69 77 78 ]
62: [69 70 78 79 ]
63: [70 71 79 80 ]