Saving to HDF5 doesn't work on docker image of dolfinadjoint on Linux

Hi,

I’m using docker image of dolfinadjoint on Linux by

docker run --name parallel -ti -w /home/fenics/shared -v /home/Dockerpyadjoint:/home/fenics/shared quay.io/dolfinadjoint/pyadjoint:latest

and I’d like to save an expression to HDF5 file running the MWE below by python3 filename.py:

from fenics import *

mesh = UnitSquareMesh(10,10)
V = FunctionSpace(mesh,"CG",1)
x = SpatialCoordinate(mesh)
f = project(x[0]*x[1],V)

fFile = HDF5File(MPI.comm_world,"f.h5","w")
fFile.write(f,"/f")
fFile.close()

But it throws an exception:

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 0:
  #000: ../../../src/H5F.c line 491 in H5Fcreate(): unable to create file
    major: File accessibilty
    minor: Unable to open file
  #001: ../../../src/H5Fint.c line 1111 in H5F_open(): unable to open file: time = Wed Dec  2 14:56:03 2020
, name = 'f.h5', tent_flags = 13
    major: File accessibilty
    minor: Unable to open file
  #002: ../../../src/H5FD.c line 812 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #003: ../../../src/H5FDsec2.c line 348 in H5FD_sec2_open(): unable to open file: name = 'f.h5', errno = 13, error message = 'Permission denied', flags = 13, o_flags = 242
    major: File accessibilty
    minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 0:
  #000: ../../../src/H5L.c line 871 in H5Lexists(): not a location
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: ../../../src/H5Gloc.c line 253 in H5G_loc(): invalid object ID
    major: Invalid arguments to routine
    minor: Bad value 
...

Running the same code on the same docker image on windows and jupyter it works fine.

Am I doing anything wrong?

Thanks in advance!

Cannot reproduce using the following on ubuntu 20.04:

docker run --rm -ti -w /home/fenics/shared -v $PWD:/home/fenics/shared quay.io/dolfinadjoint/pyadjoint:latest
python3 -c 'from fenics import *

mesh = UnitSquareMesh(10,10)
V = FunctionSpace(mesh,"CG",1)
x = SpatialCoordinate(mesh)
f = project(x[0]*x[1],V)

fFile = HDF5File(MPI.comm_world,"f.h5","w")
fFile.write(f,"/f")
fFile.close()'

I would say this is an issue with the folder that you are sharing (I would bet somewhere in the error message it says permission denied.

1 Like

You are completely right! Thank you!