File: test_no_mumps.patch

package info (click to toggle)
fenics-dolfinx 1%3A0.10.0.post4-1exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 6,028 kB
  • sloc: cpp: 36,535; python: 25,391; makefile: 226; sh: 171; xml: 55
file content (34 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Index: fenics-dolfinx/python/test/unit/fem/test_petsc_solver_wrappers.py
===================================================================
--- fenics-dolfinx.orig/python/test/unit/fem/test_petsc_solver_wrappers.py	2025-11-24 10:51:09.020117144 +0100
+++ fenics-dolfinx/python/test/unit/fem/test_petsc_solver_wrappers.py	2025-11-24 10:52:01.851118693 +0100
@@ -127,6 +127,20 @@
 
         import dolfinx.fem.petsc
 
+        sys = PETSc.Sys()
+        if ((kind=="nest" or isinstance(kind, list))
+            and not sys.hasExternalPackage("mumps")):
+            pytest.skip("matrix type nest requires MUMPS")
+
+        if sys.hasExternalPackage("mumps"):
+            factor_type = "mumps"
+        elif sys.hasExternalPackage("superlu_dist"):
+            factor_type = "superlu_dist"
+        elif MPI.COMM_WORLD.size == 1:
+            factor_type = "petsc"
+        else:
+            pytest.skip("No external solvers available in parallel")
+
         msh = dolfinx.mesh.create_unit_square(
             MPI.COMM_WORLD, 12, 12, ghost_mode=mode, dtype=PETSc.RealType
         )
@@ -197,7 +211,7 @@
         petsc_options = {
             "ksp_type": "preonly",
             "pc_type": "lu",
-            "pc_factor_mat_solver_type": "mumps",
+            "pc_factor_mat_solver_type": factor_type,
             "ksp_error_if_not_converged": True,
         }
         problem = dolfinx.fem.petsc.LinearProblem(