If your python version is earlier than 3.9, consider updating a newer one. Follow tutorial here.
Run the following script
source venv_script.sh
python3 -m pytest tests
An application is defined using the DiGraph()
object from the NetworkX library. The following conditions must be met when designing the application graph:
- Each node should be initialized with a unique node id and a
processing_time
attribute. - Dependencies between nodes are represented by edges, where the
weight
attribute indicates the number of packets required by the destination node from the source node. - The sink node (or terminal node) in the graph must include a
generate
attribute.
# from demo.py
import networkx as nx
from src.simulator import Simulator
graph = nx.DiGraph()
graph.add_node( 0, processing_time=5 )
graph.add_node( 1, processing_time=4, generate=2 )
graph.add_edge( 0, 1, weight=2 )
sim = Simulator( num_rows=3, num_cols=3, debug_mode=False )
sim.graph_to_task( graph )
sim.get_random_mapping( do_map=True )
sim.run()
sim.get_tasks_status( show=True )
sim.clear()
$ python3 demo.py
---------Final Report---------
Task PE Start End
0 (1, 1) 1 18
1 (0, 1) 34 42
For a detailed usage example, refer to the main function in src/simulator.py.
When the debug=True
for Simulator, the flit movement in the NoC can be visualized like below.