create_fifobench_async.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Include definition of the nodes
  2. from nodes import *
  3. # Include definition of the graph
  4. from graph_bench_async import *
  5. # Create a configuration object
  6. conf=Configuration()
  7. # The number of schedule iteration is limited to 1
  8. # to prevent the scheduling from running forever
  9. # (which should be the case for a stream computation)
  10. conf.debugLimit=10
  11. conf.asynchronous = True
  12. conf.customCName = "custom_bench.h"
  13. conf.appNodesCName = "BenchAppNodes.h"
  14. conf.cOptionalArgs=["float32_t* inputArray",
  15. "float32_t* outputArray"
  16. ]
  17. # Compute a static scheduling of the graph
  18. # The size of FIFO is also computed
  19. scheduling = the_graph.computeSchedule(config=conf)
  20. # Print some statistics about the compute schedule
  21. # and the memory usage
  22. print("Schedule length = %d" % scheduling.scheduleLength)
  23. print("Memory usage %d bytes" % scheduling.memory)
  24. # Generate the C++ code for the static scheduler
  25. scheduling.ccode("fifobench_async",conf)
  26. # Generate a graphviz representation of the graph
  27. with open("dot/fifobench_async.dot","w") as f:
  28. scheduling.graphviz(f)