# Problem with XDMFFile in parallel

**URL:** <https://fenicsproject.discourse.group/t/problem-with-xdmffile-in-parallel/10272>\
**Category:** I/O\
**Created:** [January 27, 2023, 11:29am UTC](https://fenicsproject.discourse.group/t/problem-with-xdmffile-in-parallel/10272 "2023-01-27T11:29:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![plugged](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/plugged/32/5115_2.png) [@plugged](https://fenicsproject.discourse.group/u/plugged)\
**Post date:** [January 27, 2023, 11:29am UTC](https://fenicsproject.discourse.group/t/problem-with-xdmffile-in-parallel/10272/1 "2023-01-27T11:29:59Z")

</div>

Hello everyone,

I stubled across a problem (and its solution) with using FEniCS in parallel. For the sake of completeness and documentation, I will present both the problem and its solution here, for others to be able to find it.

When using FEniCS from a compute cluster on more than a single node, parallel output using `XDMFFile` did not work properly. In particular, FEniCS did not generate the corresponding .h5 files needed to store the solution.

The problem was that, when running the code on a single machine, the output directory for the files was created automatically. However, when running on two nodes or more, this did not happen automatically, so that the .h5 could not be written. However, the directory was created after (trying to) write the .h5 files, so that the corresponding .xdmf files were saved, but the associated .h5 files did not exist.  
If one creates the target directory before invoking the `XDMFFile.write` or `XDMFFile.write_checkpoint` commands, everything works fine and as expected.
