Hi Karim Sorry for the chain emails, but I just realised that I mixed up x1 != x2 and x1 == x2 in my explanation. So please keep that in mind while interpreting my explanation. You can mail me if you are still confused. You can refer to https://youtube.com/playlist?list=PL8EC1756A7B1764F6 playlist (Lectures 78 onwards) to get a deeper understanding of this topic.
Thanks Setu On Fri, Mar 10, 2023, 2:04 AM Setu Gupta <setu18...@iiitd.ac.in> wrote: > Hi Karim > > Sorry I forgot to attach the picture. > > Thanks > Setu > > On Fri, Mar 10, 2023, 2:02 AM Setu Gupta <setu18...@iiitd.ac.in> wrote: > >> Hi Karim >> >> Adding to what Hoa said, the topology looks something like the topology >> I've drawn in the attached picture. >> >> The "Mesh" part of Mesh_XY specify connectivity of various routers. In >> your case, since there are 4 CPUs, there are 4 routers. Moreover since the >> number of rows specified by you is 2, you have a mesh which is 2 nodes wide >> and 2 nodes high giving a total of 2x2 = 4 nodes as expected. Note that >> mesh is simply a criss cross grid where each grid point represents a >> node/router. >> >> Each node/router has 5 connections. 4 connection out of these five are >> north, south, east and west. If a router is on the edge of the network, it >> will not have one or more of these connections. That's why your output only >> shows 3 connections for each router as all the four routers are on the edge >> in your example. These four connections connect adjacent routers, i.e >> neighbours, in a mesh topology. The fifth port is connected to what's >> called a processing element which in your case is a CPU core. This fifth >> port is called the local port as it forms a local connection between a >> router and its processing element. >> >> The "XY" part in Mesh_XY specifies the routing algorithm which in your >> case is the XY routing algorithm. The XY routing algorithm prioritises the >> transfer along X first. Other routing algorithms may chose a different >> strategy fpr routing. If a packet originates from source A and it is >> destined to destination B, the first thing that the algorithm does is >> computing the number of hops required in the X direction and the Y >> direction. >> >> For example, if a packet originates from 1 and it is destined to 2, it >> needs to hop 1 connection in the X direction and 1 connection in the Y >> direction. So the traversal can be broken down into two steps: first >> traverse along X, and then traverse along Y. >> >> Since we are following XY routing, the packet will first travel in the >> west direction from 1, and it will reach 0. Then it will travel along the Y >> direction to reach 2 from 0. As you can see, in this example, the traversal >> first happened in the X direction and then in the Y direction. >> >> Hopefully you can see from this example that the routing table is >> completed deterministic, i.e. XY is a fixed routing algorithm. Give a >> source destination pair (A ,B) the path taken by packets will always be >> exactly the same in the case of XY routing. >> >> If the current router's coordinates are (x1, y1) and the destination >> coordinates are (x2, y2), the packet will go to the north or the south >> router if and only if x1 != x2. The choice between north and south will >> depend on the ordering between x1 and x2. If x1 = x2, the packet will then >> travel either westwards or eastwards based on y1 and y2. >> >> Hopefully this clarifies your question. Please note that the topology >> that you drew is not entirely correct. So that may be the source of >> confusion. >> >> Thanks >> Setu >> >> >> On Fri, Mar 10, 2023, 1:20 AM Hoa Nguyen via gem5-users < >> gem5-users@gem5.org> wrote: >> >>> Hi Karim, >>> >>> I'm not very familiar with the Mesh_XY topology, but here is my attempt >>> to explain this. >>> >>> I think the layout of the topology looks like this, >>> >>> 2 (0,1) <-----> 3 (1,1) >>> ^ ^ >>> | | >>> v v >>> 0 (0,0) <-----> 1 (1,0) >>> >>> It's straightforward to send a packet from one node to its >>> adjacent node, such as sending a package from 2 to 3 consists of having the >>> node 2 sending a local packet to its West side. >>> >>> When the source and the destination are more than 1 hop away, it >>> involves sending a packet to immediate node. It showed in your example's >>> line 5, there's a packet that is sent from 1 (1,0) to 2 (0,1). >>> It can't be done in one hop. So, at first, the packet was sent from the >>> local of node 1 to its West side. In the next step, node 0 receives the >>> packet from its East side, and routes that packet to its North side. That >>> explains the example's line 9. >>> >>> Hope this helps! >>> >>> Regards, >>> Hoa Nguyen >>> >>> On Wed, Mar 8, 2023 at 11:25 PM Karim Soliman via gem5-users < >>> gem5-users@gem5.org> wrote: >>> >>>> Hi, for my research I'm trying to implement a custom routing algorithm >>>> in gem5/garnet. >>>> Someone from the mailing list recommended that I should go for the >>>> Mexh_XY routing algorithm to understand how it's working. >>>> >>>> The mesh topology i'm using contains only 4 cpus and 4 dirs and number >>>> of mesh rows is 2, and the routing-algorithm option is set to 1 >>>> >>>> here is the full simulation command i'm using >>>> >>>> *sudo build/NULL/gem5.debug --debug-flags=RubyNetwork >>>> configs/example/garnet_synth_traffic.py --num-cpus=4 --num-dirs=4 >>>> --mesh-rows=2 --network=garnet --routing-algorithm=1 --topology=Mesh_XY >>>> --synthetic=uniform_random --injectionrate=0.1* >>>> >>>> In the file mem/ruby/garnet/RoutingUnit.cc --> the function >>>> outportComputeXY >>>> >>>> int RoutingUnit::outportComputeXY(RouteInfo route, int inport, >>>> PortDirection inport_dirn) >>>> >>>> I'm trying to get some output during the simulation to understand the >>>> routing table at each router and how the lookup table works. >>>> >>>> The following is my code. I'm using a file to get the data during the >>>> simulation >>>> So, the file will print the following: >>>> >>>> [RouterId] [DestinationRouter] [hops_x] [hops_y] [InportDirn] --> >>>> [outport_dirn] [router_x, router_y] [des_x, dest_y]. >>>> and output the lookup table attached to the router. >>>> >>>> std::ofstream myfile; >>>> // open the file in appending mode >>>> myfile.open ("routing_output.txt", std::ios_base::app); >>>> myfile << m_router->get_id() << "\t" << route.dest_router << " | >>>> hops_x: " << x_hops << " | hops_y: " << y_hops << "\t"; >>>> myfile << inport_dirn << " --> " << outport_dirn << "\t" << >>>> m_outports_dirn2idx[outport_dirn] << "\t" << my_x << ", " << my_y; >>>> myfile << " --> "<< dest_x << ", " << dest_y << std::endl; >>>> // iterate over the outports table map and write the data to the file. >>>> std::map<std::__cxx11::basic_string<char>, int>::iterator it; >>>> for(it = m_outports_dirn2idx.begin(); it != m_outports_dirn2idx.end(); >>>> it++) >>>> { >>>> myfile << it->first << "\t" << it->second << std::endl; >>>> } >>>> myfile.close(); >>>> >>>> Here are some samples of my output file and also the full txt file is >>>> attached. >>>> >>>> [image: image.png] >>>> >>>> I don't really know how the packets are routed and also how the lookup >>>> table works. also i can't imagine the connections between the nodes i tried >>>> to draw a flow chart for each router >>>> but some of the output data doesn't match the drawing -- like a packet >>>> from router #2 will go east !! >>>> [image: image.png] >>>> Can anyone explain to me? or if there is any documentation I can check >>>> to understand this. >>>> >>>> Best Regards, >>>> *Eng. Karim Soliman* >>>> Teaching Assistant >>>> Computer Engineering Department >>>> Pharos University in Alexandria (P.U.A) >>>> _______________________________________________ >>>> gem5-users mailing list -- gem5-users@gem5.org >>>> To unsubscribe send an email to gem5-users-le...@gem5.org >>>> >>> _______________________________________________ >>> gem5-users mailing list -- gem5-users@gem5.org >>> To unsubscribe send an email to gem5-users-le...@gem5.org >>> >>>
_______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org