Using brian2cuda and cpp_stardalone for a brian2 script with loop of runs

When going through a loop of samples, I need to rerun a sample with different condition, e.g. stimulus rate, until the condition is satisfied before moving to the next sample. This is what we discussed in this thread:

Re-run the model in a previous time segment during a long run

I used runtime mode since then. Now trying to use brian2cuda, I might have to make changes directly in the cuda source. Further inputs would be appreciated.