For finite graph execution, the graph state is maintained across the
graph.run(n)
. The AI Engine is not reinitialized and memory contents are not cleared after
graph.run(n)
. In the following code example, after
the first run of three invocations, the AI Engine main()
wrapper code
is left in a state where the kernel will start with the pong buffer in the next run (of
ten iterations). The ping-pong buffer selector state is left as-is. graph.end()
does not clean up the graph state
(specifically, does not re-initialize global variables), nor clean up stream switch
configurations. It merely exits the core-main. To re-run the graph, you must reload the
PDI/XCLBIN.Important: A
graph.wait()
must be followed by either a graph.run()
or graph.resume()
prior to a graph.end()
. Failing to do so means that a graph could wait forever, and
graph.end()
never executes. See Graph Objects for more details on the use of
these APIs.#include "project.h"
simpleGraph mygraph;
int main(void) {
mygraph.init();
mygraph.run(3); // run 3 iterations
mygraph.wait(); // wait for 3 iterations to finish
mygraph.run(10); // run 10 iterations
mygraph.end(); // wait for 10 iterations to finish
return 0;
}