Assign communicator to mesh

Hello everyone, thanks for the help. I am trying to solve a parametric PDE multiple times. For that, I am trying to use MPI to distribute the computation of the different solutions. This is the first time I have used MPI. Currently, I am facing the issue that the computations freeze when I apply the boundary conditions. I guess it is because I am not assigning any communicator to the mesh. I am using a mesh obtained from meshr. I am having issues assigning the communicator the mesh.
For the creation of the mesh I followed ( Solving PDEs in Python -
The FEniCS Tutorial Volume I (fenicsproject.org)
)
Here is the code for this section
‘’’
from mshr import Rectangle, Circle, generate_mesh
from dolfin import *
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
self_comm = MPI.COMM_SELF
channel = Rectangle(Point(0, 0), Point(1.0, 0.4))
cylinder = Circle(Point(0.2, 0.2), 0.05)
domain = channel - cylinder
mesh = generate_mesh(domain, 30)
mesh = comm.bcast(mesh, root=0)
‘’’
The error I got is:
‘’’
mesh = comm.bcast(mesh, root=0)
^^^^^^^^^^^^^^^^^^^^^^^^
File “mpi4py/MPI/Comm.pyx”, line 1569, in mpi4py.MPI.Comm.bcast
File “mpi4py/MPI/msgpickle.pxi”, line 721, in mpi4py.MPI.PyMPI_bcast
File “mpi4py/MPI/msgpickle.pxi”, line 145, in mpi4py.MPI.pickle_dump
File “mpi4py/MPI/msgpickle.pxi”, line 131, in mpi4py.MPI.cdumps
TypeError: cannot pickle ‘dolfin.cpp.mesh.Mesh’ object
‘’’

My second attempt was to generate the mesh directly using dolfin and assign the communicator in the creation of the RectangleMesh and CircleMesh. But I am getting the following error while creating the CircleMesh ( CircleMesh — FEniCS Project)
‘’’
import dolfin as dl

Define the circle parameters

center = dl.Point(0.0, 0.0)

radius = 1.0

resolution = 32

Create the circle mesh

mesh = dl.cpp.mesh.CircleMesh(center, radius, resolution)

‘’’
But I get the following error
‘’’
module ‘dolfin.cpp.mesh’ has no attribute ‘CircleMesh’
‘’’

My third attempt was to store the mesh, read it, and then assign it
‘’’

from mshr import Rectangle, Circle, generate_mesh
from dolfin import *
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
self_comm = MPI.COMM_SELF
file_name = ‘mesh_square_cyliner_ns.xml’
file_format = ‘xml’
if os.path.exists(file_name):
mesh = Mesh()
with XDMFFile(file_name) as infile:
infile.read(mesh)

mesh = comm.bcast(mesh, root=0)

‘’’

But I get the following error

‘’’
TypeError: cannot pickle ‘dolfin.cpp.mesh.Mesh’ object
‘’’
Any help is appreciated! Thanks!