Save MeshFunction in parallel with parameters['ghost_mode'] = 'shared_facet'

, ,

When I try to save a MeshFunction with MPI with parameters['ghost_mode'] = 'shared_facet' it gives me some error. May I know how to solve this? and what is the problem here?

I am using dolfin 2018.2.0.

from dolfin import *
from os import path
parameters['ghost_mode'] = 'shared_facet'
# Create a mesh
mesh = UnitSquareMesh(32, 32)

class rectangle(SubDomain):
    def inside(self,x, on_boundary):
        return between(x[0],(0.25,0.75)) and between(x[1],(0.25,0.75))
Rec = rectangle()

# Define domain indicator function
domainindicator = MeshFunction('size_t', mesh, mesh.topology().dim())
domainindicator.set_all(1)
Rec.mark(domainindicator,0)

my_filed = XDMFFile(MPI.comm_world, "domainindicator.xdmf")
my_filed.write(domainindicator)

Above is the MWE and it gives this error:

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 1:
  #000: ../../../src/H5Dio.c line 263 in H5Dwrite(): file selection+offset not within extent
    major: Dataspace
    minor: Out of range

Can’t replicate with my local installation. I have a newer HDF5 version in the same series (1.10.10, while you have 1.10.0). You may also want to upgrade to the latest dolfin version.

Hi

Do you get this error when using the newer version?

no, everything is working correctly, and I can open the xdmf file in paraview and visualize the two subdomains.

Sorry for double check, but did you try it with more than 1 core (mpirun -n 2), serial run also works for me

Works in parallel as well. If it works for you in serial, but not in parallel, it’s possible that your hdf5 installation isn’t configured properly to work in parallel.