This example uses the same code, but in this case the kernel is configured to be restart and run for three iterations and then stop. The only required change is to specify the number of iterations as shown in the code example below.
Tip: In the counted auto-restart case, there is
no need to use the
abort()
, because the host will know
when to stop.143 xrt::kernel incr(device, uuid, "increment");
144 int adder1 = 20; // arbitrarily chosen to be different from 0
145 int adder2 = 10; // arbitrarily chosen to be different from 0
151 // start the incr kernel in auto restart mode with default adders
152 // since it is a streaming kernel it will be stalled waiting for
153 // input
154 auto incr_run = incr(xrt::autostart{3}, nullptr, nullptr, adder1);