Use File objects to read meshes from file fails in parallel

Bug #430040 reported by Skavhaug
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
High
Garth Wells

Bug Description

The following code does not create a distributed mesh in parallel:

File f("somemeshfile.xml");
Mesh mesh;
f >> mesh;

The following code works as expected, i.e. a distributed mesh in constructed:

Mesh mesh("somemeshfile.xml");

Related branches

Revision history for this message
Anders Logg (logg) wrote :

One option would be to keep operator>> as it is (reading the entire mesh on each processor).
It might be desirable to do so in some applications. So it could be a feature and not a bug. If we
issue a suitable warning that should be enough.

Changed in dolfin:
status: New → Confirmed
Changed in dolfin:
importance: Undecided → High
Changed in dolfin:
milestone: none → 0.94
Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 430040] Re: Use File objects to read meshes from file fails in parallel

On Mon, Sep 21, 2009 at 02:24:15PM -0000, Garth Wells wrote:
> ** Changed in: dolfin
> Milestone: None => 0.94

I think this is a feature, not a bug.

--
Anders

Revision history for this message
Garth Wells (garth-wells) wrote :

logg wrote:
> On Mon, Sep 21, 2009 at 02:24:15PM -0000, Garth Wells wrote:
>> ** Changed in: dolfin
>> Milestone: None => 0.94
>
> I think this is a feature, not a bug.
>

I would call it a bug since it's at best ambiguous, at worst
counter-intuitive.

Garth

> --
> Anders
>

Revision history for this message
Anders Logg (logg) wrote :

On Mon, Sep 21, 2009 at 03:15:15PM -0000, Garth Wells wrote:
>
> logg wrote:
> > On Mon, Sep 21, 2009 at 02:24:15PM -0000, Garth Wells wrote:
> >> ** Changed in: dolfin
> >> Milestone: None => 0.94
> >
> > I think this is a feature, not a bug.
> >
>
> I would call it a bug since it's at best ambiguous, at worst
> counter-intuitive.
>
> Garth

There may be occasions when one will want to read an entire mesh to a
processor (or each processor) when running in parallel. A good example
of this is when a mesh has been partitioned before and is stored to files:

  mesh-0.xml
  mesh-1.xml
  mesh-2.xml
  mesh-3.xml
  ...

Then

  file >> mesh;

provides an interface that can be used for this.

It would also be fairly difficult to "fix" this. As it is now, the
constructor of Mesh provides a wrapper for >> and reads into
LocalMeshData rather than a Mesh, and then calls the partitioning.
If we were to put this into >>, then the partitioning would need to be
called from within the XML parser logic.

There is already a warning when doing file >> mesh in parallel which I
think should be enough:

  "Reading entire mesh to one processor. If this is not what you
  intended, initialize the mesh directly from the filename."

--
Anders

Revision history for this message
Garth Wells (garth-wells) wrote :

logg wrote:
> On Mon, Sep 21, 2009 at 03:15:15PM -0000, Garth Wells wrote:
>> logg wrote:
>>> On Mon, Sep 21, 2009 at 02:24:15PM -0000, Garth Wells wrote:
>>>> ** Changed in: dolfin
>>>> Milestone: None => 0.94
>>> I think this is a feature, not a bug.
>>>
>> I would call it a bug since it's at best ambiguous, at worst
>> counter-intuitive.
>>
>> Garth
>
> There may be occasions when one will want to read an entire mesh to a
> processor (or each processor) when running in parallel. A good example
> of this is when a mesh has been partitioned before and is stored to files:
>
> mesh-0.xml
> mesh-1.xml
> mesh-2.xml
> mesh-3.xml
> ...
>
> Then
>
> file >> mesh;
>
> provides an interface that can be used for this.
>
> It would also be fairly difficult to "fix" this. As it is now, the
> constructor of Mesh provides a wrapper for >> and reads into
> LocalMeshData rather than a Mesh, and then calls the partitioning.
> If we were to put this into >>, then the partitioning would need to be
> called from within the XML parser logic.
>
> There is already a warning when doing file >> mesh in parallel which I
> think should be enough:
>
> "Reading entire mesh to one processor. If this is not what you
> intended, initialize the mesh directly from the filename."
>

It may be better to remove ">>" and add an explicit option to the Mesh
constructor. I don't like the above type of warning messages - I would
prefer to remove the ambiguity.

Garth

> --
> Anders
>

Revision history for this message
Anders Logg (logg) wrote :

Yes, that would be ok. In that case, we could make >> for Mesh private in the File class, and make Mesh a friend so
that it can be used from the Mesh constructor.

Anders Logg (logg)
Changed in dolfin:
milestone: 0.9.4 → 0.9.6
Anders Logg (logg)
Changed in dolfin:
milestone: 0.9.6 → 0.9.7
Changed in dolfin:
milestone: 0.9.7 → 1.0-beta
assignee: nobody → Garth Wells (garth-wells)
Changed in dolfin:
status: Confirmed → Fix Committed
Anders Logg (logg)
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.