# OSError: Unable to open file, failed import

**URL:** <https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741>\
**Category:** Errors\
**Created:** [18 January 2023 08:54 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741 "2023-01-18T08:54:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [18 January 2023 08:54 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/1 "2023-01-18T08:54:57Z")

</div>

Hi,

I was having a bit of trouble in running pyFR on clusters

When in my bash shell I run the following series of commands

```auto
conda init bash
source .bashrc
conda activate pyFR
ml gnu8 metis
cd PyFR-Test-Cases/2d-euler-vortex
pyfr import 2d-euler-vortex.msh 2d-euler-vortex.pyfrm
pyfr partition 2 2d-euler-vortex.pyfrm .
mpiexec -n 2 pyfr run -b openmp -p 2d-euler-vortex.pyfrm 2d-euler-vortex.ini

```

it works just fine and simulation ended correctly.

When I create che same workflow with an sbatch submission I get this error lines:

````auto
  fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 106, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 1760, sblock->base_addr = 0, stored_eof = 45284)```

````

The step which fails when running in sbatch is

```auto
pyfr import 2d-euler-vortex.msh 2d-euler-vortex.pyfrm

```

Moreover I have an issue with cuda backend and I’m not sure if it related only to its version (11.1 which is lower than the required one \>=11.4 which I cannot update to at the moment)

```auto
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib64/libcuda.so: undefined symbol: cuDeviceGetUuid_v2

```

Any idea on how to solve?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [18 January 2023 19:45 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/2 "2023-01-18T19:45:21Z")

</div>

For the file issue can you please try running `h5dump` on the file in question (from sbatch) and seeing if it works?

The version requirements for various components are not chosen arbitrarily. We need 11.4 because some functions used by PyFR were only added in 11.4.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [18 January 2023 20:32 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/3 "2023-01-18T20:32:25Z")

</div>

Running from sbatch

```auto
h5dump -d 2d-euler-vortex.msh -o dataset.txt

```

and I get

```auto
h5dump error: unable to open file "dataset.txt"

```

As it regards cuda error: according to you it is related to cuda version? or it may be something different other than that?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [18 January 2023 20:39 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/4 "2023-01-18T20:39:32Z")

</div>

This suggests that the error is file system related, and not to do with PyFR. You will need to follow up with your system administrator to debug what might be the cause of this.

If you are using a CUDA version below 11.4 you will see errors.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [18 January 2023 20:46 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/5 "2023-01-18T20:46:27Z")

</div>

I’m not sure about that, if I run from sbatch:

```auto
srun -n 1 test.sh

```

it works just fine (with openmp backend) but I’m limited to 1 process (see [Writing MPS to .h5 file in a multi-core process - ITensor Support Q&A](http://itensor.org/support/3611/writing-mps-to-h5-file-in-a-multi-core-process)), so it should not be file system related

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [18 January 2023 21:00 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/6 "2023-01-18T21:00:37Z")

</div>

Can you confirm if you are getting the error when running PyFR or when trying to import a mesh? The former should only be run on a single rank.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [18 January 2023 21:03 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/7 "2023-01-18T21:03:16Z")

</div>

The error only appears when I try to import the mesh with n\>1

In case this could solve the problem, how I can dynamically change from -n 1 for mesh import to n = 100 (for example) when running the simulation?

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [18 January 2023 21:08 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/8 "2023-01-18T21:08:47Z")

</div>

Every command except for running a simulation should be performed on a single rank. Import the mesh, partition it, and then submit your batch job on as many ranks as you have used to partition the domain and have this execute `pyfr run ...`.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [18 January 2023 21:11 UTC](https://pyfr.discourse.group/t/oserror-unable-to-open-file-failed-import/741/9 "2023-01-18T21:11:21Z")

</div>

I’ll try and let you know

Regards, Frank
