Data streaming ensures that snapshots not fitting in host or device memory are seamlessly stored to disk – this is what we refer to as “serialization”.
While this is all automated, DevitoPRO offers some APIs to control serialization.
Custom I/O directory
Use the serialization kwarg when creating a TimeFunction to store the snapshots in a directory of choice.
Let’s now see how we can fetch the snapshots using a different TimeFunction.
#NBVAL_IGNORE_OUTPUTv = TimeFunction(name='v', grid=grid)vsave = TimeFunction(name='vsave', grid=grid, save=nt)fetchdir = usave._fnbase# NOTE: currently the `fetchdir` does not coincide with the `dumpdir`# This might change in the near future, thus enabling a much neater `serialization=dumpdir`usave1 = TimeFunction(name='usave1', grid=grid, save=nt, layers=Disk, serialization=fetchdir)# print(fetchdir)eqns = [Eq(v, v.backward -1), Eq(vsave, usave1)]summary = Operator(eqns)(time_M=nt-1, time_m=0)# print(vsave.data)