From ec3d18969bbf302ac8a1eea2b018c9100b716c64 Mon Sep 17 00:00:00 2001 From: Umberto Zerbinati Date: Sat, 7 Dec 2024 15:49:04 +0000 Subject: [PATCH] Removed MPI direct dependency from ngsPETSc. MPI should either come from NGSolve/Firedrake or FEniCSx. Signed-off-by: Umberto Zerbinati --- ngsPETSc/eps.py | 4 +--- ngsPETSc/plex.py | 4 +--- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ngsPETSc/eps.py b/ngsPETSc/eps.py index 6bd6a3b..0e1c724 100644 --- a/ngsPETSc/eps.py +++ b/ngsPETSc/eps.py @@ -10,8 +10,6 @@ warnings.warn("Import Warning: it was not possible to import SLEPc") SLEPc = None -from mpi4py import MPI - from ngsolve import GridFunction from ngsPETSc import Matrix, VectorMapping @@ -41,7 +39,7 @@ class EigenSolver(): if SLEPc is not None: def __init__(self, pencil, fes, nev, ncv=SLEPc.DECIDE, optionsPrefix=None, solverParameters=None): - self.comm = MPI.COMM_WORLD + self.comm = PETSc.COMM_WORLD.tompi4py() if not isinstance(pencil, tuple): pencil=tuple([pencil]) self.penLength = len(pencil) self.fes = fes diff --git a/ngsPETSc/plex.py b/ngsPETSc/plex.py index fd50d06..62afc99 100644 --- a/ngsPETSc/plex.py +++ b/ngsPETSc/plex.py @@ -17,8 +17,6 @@ class comp: "dummy class" Mesh = type(None) -from mpi4py import MPI - FACE_SETS_LABEL = "Face Sets" CELL_SETS_LABEL = "Cell Sets" EDGE_SETS_LABEL = "Edge Sets" @@ -33,7 +31,7 @@ class MeshMapping: ''' - def __init__(self, mesh=None, comm=MPI.COMM_WORLD, name="Default"): + def __init__(self, mesh=None, comm=PETSc.COMM_WORLD.tompi4py(), name="Default"): self.name = name self.comm = comm if isinstance(mesh,(ngs.comp.Mesh,ngm.Mesh)): diff --git a/pyproject.toml b/pyproject.toml index 482e419..1f1470b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,6 @@ python = "^3.9" netgen-mesher = "^6.2" netgen-occt = "^7.8" petsc4py = "^3.22.1" -mpi4py = "^4" numpy = "^2" scipy = "^1" @@ -40,6 +39,7 @@ pylint = "^3.3" [tool.poetry.group.ngsolve.dependencies] ngsolve = "^6.2" +mpi4py = "^4" [build-system] requires = ["poetry-core"]