TimeSeries readable only on same number of procs
Issue #1016
new
TimeSeries can only be read if the script is run on the same number of processors as were used for writing the TimeSeries.
Example: Run the MWE on 1 process and then on 2. The serial TimeSeries is not read correctly on 2 processes. If the number of processors is equal, it works.
from dolfin import *
import numpy as np
mesh = UnitSquareMesh(64, 64)
V = FunctionSpace(mesh, 'P', 1)
u = interpolate(Expression('sin(20*x[0])*sin(20*x[1])', degree=1), V)
ts = TimeSeries('ts_parallel')
rank = MPI.rank(mesh.mpi_comm())
size = MPI.size(mesh.mpi_comm())
# store if running in serial
if size == 1:
ts.store(u.vector(), 0.)
# read TimeSeries
u2 = Function(V)
ts.retrieve(u2.vector(), 0., False)
print('{}: |u-u2| = {}'.format(rank, np.linalg.norm(u.vector().get_local() -
u2.vector().get_local())))
I don't know if this is the intended behavior, at least I did not find any documentation about it.
Best wishes David
Comments (1)
-
reporter - Log in to comment
Ok, I just noticed this comment in HDF5File.cpp, in the write() function for dolfin functions. So one has to store functions with HDF5File to be able to read/write data on different numbers of procs.
It would be useful if this was mentioned somewhere in the docs. For instance, there are no docstrings for HDF5File.write and TimeSeries.write in python.