This PR seeks the performance related to checkpointing in scenarios where the checkpointing process currently leads to data duplication for the following cases:
A new method handling clear checkpoints only for the cases where DelegatedFunctionCheckpoint is not set. That is because clear DelegatedFunctionCheckpoint leads to duplicated data being stored in the TimeStep.checkpoint set.
Optimization for Cofunction Assignments in Timesteps:
In the context of the code:
c = Cofunction(V.dual())
for t in timesteps:
c.assign(a*b)
Issue: When taping the forward solver, an AssembleBlock object is created at each timestep. The output and the checkpoint hold identical data, resulting in unnecessary data duplication. Although the checkpoint is cleared during checkpointing, the output data remains, causing inefficiencies.
Solution: This PR proposes using DelegatedFunctionCheckpoint for the output of AssembleBlock. This approach avoids duplicating data and improves the checkpointing algorithm performance. Importantly, this output change does not affect user-defined variables.
Description
This PR seeks the performance related to checkpointing in scenarios where the checkpointing process currently leads to data duplication for the following cases:
A new method handling clear checkpoints only for the cases where
DelegatedFunctionCheckpoint
is not set. That is because clearDelegatedFunctionCheckpoint
leads to duplicated data being stored in theTimeStep.checkpoint
set.Optimization for
Cofunction
Assignments in Timesteps:Issue: When taping the forward solver, an
AssembleBlock
object is created at each timestep. The output and the checkpoint hold identical data, resulting in unnecessary data duplication. Although the checkpoint is cleared during checkpointing, the output data remains, causing inefficiencies.Solution: This PR proposes using
DelegatedFunctionCheckpoint
for the output ofAssembleBlock
. This approach avoids duplicating data and improves the checkpointing algorithm performance. Importantly, this output change does not affect user-defined variables.This PR depends of the pyadjoint PR 160