In my serial script there is a part that solves a big linear system. I would like to use Fenics to solve my linear system in parallel, but keep the rest serial.
For now, I have been able to use the Fenics library to solve my linear system, and I do not know how to make only the solve block run in parallel.
here is my code:
from petsc4py import PETSc
from dolfin import *
def solve_parallel(scipyMat, numpRHS, nx,ny):
petscMat = PETScMatrix(PETSc.Mat().createAIJ(size=scipyMat.shape,csr=scipyMat.indptr,scipyMat.indices,scipyMat.data)))
x = PETScVector()
b = PETScVector(PETSc.Vec().createWithArray(numpRHS))
solver = LUSolver(petscMat, "mumps")
solver.solve(petscMat,x,b)
return x.array()
How can I switch to parallel in the 'solve_parallel()' function ?