devitocodes / pyrevolve

Python library to manage checkpointing for adjoints
Eclipse Public License 1.0
15 stars 6 forks source link

Multistage implementation is incorrect #66

Open jrmaddison opened 4 months ago

jrmaddison commented 4 months ago

In initialization of multistage checkpointing

https://github.com/devitocodes/pyrevolve/blob/23dea91d14852b8bedb8cf59a6cebc2ca7f4e76c/src/revolve.cpp#L1170-L1185

since v is sorted this always sets the last sn_ram elements of where to true, and the other elements to false, irrespective of the result of get_write_and_read_counts.

I think v should be copied before the sort (e.g. into w), and then the conditional replaced with

if(w[i]>=mid && num<sn_ram)