sst-elements icon indicating copy to clipboard operation
sst-elements copied to clipboard

Help: Regarding the methods used in router topology class

Open saichenna opened this issue 2 years ago • 1 comments

Hello SST team, I’m trying to add a new network topology into merlin. As the team mentioned before, I have generated a python build file that instantiates the routers and connects them to the network endpoints according to our topology definition. I was able to verify the topology build by dumping the simulation graph(in dot format using –output-dot argument). However, while implementing the routing logic (i.e., C++ subcomponent) I have some questions which need your help. By looking at the various topology routing implementation files (e.g., mesh.cc/h,fattree.cc/h, hyperx.cc/h etc..), I found that the following are the mandatory methods you need to implement in your topology:

  1. Route_packet()
  2. Process_input()
  3. routeInitData()
  4. process_InitData_input()
  5. getPortState()

I understand the purpose of route_packet() and getPortState() methods.

  1. Can you specify what is being done in process_input(), routeInitData() and process_InitData_input() functions? I have looked into function definitions for these methods for different topologies and it is hard to understand what is being done in these methods.
  2. I understand we create our own derived class of router event (like topo_hyperx_event for hyperx topology) in order to pad additional details to the router event which are used while routing the packet. But, can you specify the purpose of having “serialize_order” override method in our router_event class? I’m not familiar with SST Core, so I’m not sure of the purpose of having this method in my topology router event class.

Thanks in advance.

saichenna avatar Apr 19 '22 23:04 saichenna

The purpose for process_input() is to wrap the RtrEvent with your topology specific event derived from internal_router_event. This class also sets the VC of the packet based on the incoming virtual network. You can also do anything else that is needs for routing on the topology, for example, most topologies will map the destination id to a tuple that makes routing the packet more efficient (mesh/torus/hyperx will compute the index in dimension, dragonfly computes the group id, router id and router port). This function is only called on packets entering the network from the endpoint and not on ports that connect two routers.

The routeInitData() and process_InitData_input() are the equivalent functions to route_packet and process_input used in the untimed phases of simulation (init and complete). The one big different with routeInitData() is that it needs to support broadcasting of packets to all endpoints in the network. At each stage, the routeInitData will return a vector of ports to send the packet on. For a given broadcast, all ports in the network, except the sending port, should receive exactly one copy of the packet.

The serialize_order function is used to serialize/deserialize the event when sent between MPI ranks in the simulation. The same function is called for both serialization and deserialization. You need to make sure that all the data members of the function are serialized in order for the event to be properly reconstructed on the remote rank. Without this function, none of the variables defined in your topology specific event will get set after being sent to another MPI rank.

feldergast avatar Apr 20 '22 17:04 feldergast