Fenicsx- saving state file to enable restart from the last saved time step in parallel

Hi,
I have been working with fenicsx 0.6.0. I am trying to save state variables every 100 timesteps, which helps me restarting the simulation from last saved timestep when my simulation crashes - checkpointing in other terms I guess. I am able to do that in serial code using these functions:

def save_state(step, u, un, filename="./stateBackup/simulation_state.npz"):
    # Convert to numpy arrays
    u_array = u.vector[:]
    un_array = un.vector[:]
    # Save using np.savez
    np.savez(filename, step=step, u=u_array, un=un_array)

def load_state(u, un, filename="./stateBackup/simulation_state.npz"):
    # Load the data
    with np.load(filename, allow_pickle=False) as data:
        step = data['step']
        u.vector.setArray(data['u'])
        un.vector.setArray(data['un'])
    return step
                               But while working in parallel, I am facing issues of dof mismatch after restarting with the saved state file. Any leads on how to work with this in parallel environment would be super helpful.                    Thanks in advance.

Achieving n-m checkpointing is actually quite challenging. Thankfully @dokken is kind enough to share his excellent work via GitHub - jorgensd/adios4dolfinx: Extending DOLFINx with checkpointing functionality.

This uses adios2 in the backend to store all the information necessary to save/load data from arbitrary partitions into new partitions. Ideal for checkpointing in parallel computations.

Thanks Nate!
I came across this earlier, but the issue is adios4dolfinx is compatible with fenicsx v0.7 or higher, and my script is in fenicsx v0.6. Which is why I was looking if there is any workaround for this, before I start writing my script to work with higher versions of fenicsx.

There is a 0.6.0 release: Release v0.6.0 · jorgensd/adios4dolfinx · GitHub

However, I would strongly advice to upgrade your installation, as there are many bugs and performance fixes and new features since 2023