gem5-users@gem5.org

The gem5 Users mailing list

View all threads

gem5 routing fault

Y
Y阿Z阿
Wed, May 29, 2024 10:51 AM

Hello everyone, I rewrote the XY routing algorithm to the YX routing algorithm,
I rewrote RoutingUnit.cc and Mesh_YX.py.
The files have been rewritten as follows.
Mesh_YX.py
class Mesh_YX(SimpleTopology):
    description = "Mesh_YX"

    def init(self, controllers):
        self.nodes = controllers

    # Makes a generic mesh
    # assuming an equal number of cache and directory cntrls

    def makeTopology(self, options, network, IntLink, ExtLink, Router):
        nodes = self.nodes

        num_routers = options.num_cpus
        num_rows = options.mesh_rows
        num_columns = int(num_routers / num_rows)
        # default values for link latency and router latency.
        # Can be over-ridden on a per link/router basis
        link_latency = options.link_latency  # used by simple and garnet
        router_latency = options.router_latency  # only used by garnet

        # There must be an evenly divisible number of cntrls to routers
        # Also, obviously the number or rows must be <= the number of routers
        cntrls_per_router, remainder = divmod(len(nodes), num_routers)
        assert num_columns > 0 and num_columns <= num_routers
        assert num_columns * num_rows == num_routers

        # Create the routers in the mesh
        routers = [
            Router(router_id=i, latency=router_latency)
            for i in range(num_routers)
        ]
        network.routers = routers

        # link counter to set unique link ids
        link_count = 0

        # Add all but the remainder nodes to the list of nodes to be uniformly
        # distributed across the network.
        network_nodes = []
        remainder_nodes = []
        for node_index in range(len(nodes)):
            if node_index < (len(nodes) - remainder):
                network_nodes.append(nodes[node_index])
            else:
                remainder_nodes.append(nodes[node_index])

        # Connect each node to the appropriate router
        ext_links = []
        for i, n in enumerate(network_nodes):
            cntrl_level, router_id = divmod(i, num_routers)
            assert cntrl_level < cntrls_per_router
            ext_links.append(
                ExtLink(
                    link_id=link_count,
                    ext_node=n,
                    int_node=routers[router_id],
                    latency=link_latency,
                )
            )
            link_count += 1

        # Connect the remainding nodes to router 0.  These should only be
        # DMA nodes.
        for i, node in enumerate(remainder_nodes):
            assert node.type == "DMA_Controller"
            assert i < remainder
            ext_links.append(
                ExtLink(
                    link_id=link_count,
                    ext_node=node,
                    int_node=routers[0],
                    latency=link_latency,
                )
            )
            link_count += 1

        network.ext_links = ext_links

        # Create the mesh links.
        int_links = []

        # North output to South input links (weight = 2)
        for col in range(num_columns):
            for row in range(num_rows):
                if row + 1 < num_rows:
                    north_out = col + (row * num_columns)
                    south_in = col + ((row + 1) * num_columns)
                    int_links.append(
                        IntLink(
                            link_id=link_count,
                            src_node=routers[north_out],
                            dst_node=routers[south_in],
                            src_outport="North",
                            dst_inport="South",
                            latency=link_latency,
                            weight=1,
                        )
                    )
                    link_count += 1

        # South output to North input links (weight = 2)
        for col in range(num_columns):
            for row in range(num_rows):
                if row + 1 < num_rows:
                    north_in = col + (row * num_columns)
                    south_out = col + ((row + 1) * num_columns)
                    int_links.append(
                        IntLink(
                            link_id=link_count,
                            src_node=routers[south_out],
                            dst_node=routers[north_in],
                            src_outport="South",
                            dst_inport="North",
                            latency=link_latency,
                            weight=1,
                        )
                    )
                    link_count += 1

        # East output to West input links (weight = 1)
        for row in range(num_rows):
            for col in range(num_columns):
                if col + 1 < num_columns:
                    east_out = col + (row * num_columns)
                    west_in = (col + 1) + (row * num_columns)
                    int_links.append(
                        IntLink(
                            link_id=link_count,
                            src_node=routers[east_out],
                            dst_node=routers[west_in],
                            src_outport="East",
                            dst_inport="West",
                            latency=link_latency,
                            weight=2,
                        )
                    )
                    link_count += 1

        # West output to East input links (weight = 1)
        for row in range(num_rows):
            for col in range(num_columns):
                if col + 1 < num_columns:
                    east_in = col + (row * num_columns)
                    west_out = (col + 1) + (row * num_columns)
                    int_links.append(
                        IntLink(
                            link_id=link_count,
                            src_node=routers[west_out],
                            dst_node=routers[east_in],
                            src_outport="West",
                            dst_inport="East",
                            latency=link_latency,
                            weight=2,
                        )
                    )
                    link_count += 1

        network.int_links = int_links

    # Register nodes with filesystem
    def registerTopology(self, options):
        for i in range(options.num_cpus):
            FileSystemConfig.register_node(
                [i], MemorySize(options.mem_size) // options.num_cpus, i
            )
RoutingUnit.CC
int
RoutingUnit::outportComputeYX(RouteInfo route,
                              int inport,
                              PortDirection inport_dirn)
{
    PortDirection outport_dirn = "Unknown";

    [[maybe_unused]] int num_rows = m_router->get_net_ptr()->getNumRows();
    int num_cols = m_router->get_net_ptr()->getNumCols();
    assert(num_rows > 0 && num_cols > 0);

    int my_id = m_router->get_id();
    int my_x = my_id % num_cols;
    int my_y = my_id / num_cols;

    int dest_id = route.dest_router;
    int dest_x = dest_id % num_cols;
    int dest_y = dest_id / num_cols;

    int x_hops = abs(dest_x - my_x);
    int y_hops = abs(dest_y - my_y);

    bool x_dirn = (dest_x >= my_x);
    bool y_dirn = (dest_y >= my_y);

    // already checked that in outportCompute() function
    assert(!(x_hops == 0 && y_hops == 0));
    if (y_hops > 0) {
        if (y_dirn) {
            assert(inport_dirn == "Local" || inport_dirn == "North");
            outport_dirn = "South";
        } else {
            assert(inport_dirn == "Local" || inport_dirn == "South");
            outport_dirn = "North";
        } 
    }
    else if (x_hops > 0) {
        if (x_dirn) {
            // "Local" or "South" or "West" or "East"
            assert(inport_dirn != "West");
            outport_dirn = "West";
        } else {
            // "Local" or "North" or "West" or "East"
            assert(inport_dirn != "East");
            outport_dirn = "East";
        } 
    }
    else {
        // x_hops == 0 and y_hops == 0
        // this is not possible
        // already checked that in outportCompute() function
        panic("x_hops == y_hops == 0");
    }

    return m_outports_dirn2idx[outport_dirn];
}

 and this is my command line.
#!/bin/bash
gem5path=/home/zr/gem5
spec2006path=$gem5path/CPU2006
outdir=/home/zr/gem5/m5out429
bench=429.mcf
ben_suffix=run/run_base_ref_amd64-m64-gcc42-nn.0000
exe=mcf_base.amd64-m64-gcc42-nn
$gem5path/build/X86/gem5.opt
--outdir=$outdir
$gem5path/configs/example/se.py
-c "$spec2006path/$bench/$ben_suffix/$exe"
--ruby
--network=garnet
--num-cpus=64
--num-dirs=64
--num-l2caches=64
--topology=Mesh_YX
--routing-algorithm=2
--mesh-rows=8

the following bug appeared.

system.remote_gdb: Listening for connections on port 7000
**** REAL SIMULATION ****
src/sim/simulate.cc:199: info: Entering event queue @ 0.  Starting simulation...
gem5 has encountered a segmentation fault!

I would like to ask everyone, Why did this error occur. Thank you very much for your help.

Y阿Z阿
1765197550@qq.com

Hello everyone, I rewrote the XY routing algorithm to the YX routing algorithm, I rewrote RoutingUnit.cc and Mesh_YX.py. The files have been rewritten as follows. Mesh_YX.py class Mesh_YX(SimpleTopology): &nbsp; &nbsp; description = "Mesh_YX" &nbsp; &nbsp; def __init__(self, controllers): &nbsp; &nbsp; &nbsp; &nbsp; self.nodes = controllers &nbsp; &nbsp; # Makes a generic mesh &nbsp; &nbsp; # assuming an equal number of cache and directory cntrls &nbsp; &nbsp; def makeTopology(self, options, network, IntLink, ExtLink, Router): &nbsp; &nbsp; &nbsp; &nbsp; nodes = self.nodes &nbsp; &nbsp; &nbsp; &nbsp; num_routers = options.num_cpus &nbsp; &nbsp; &nbsp; &nbsp; num_rows = options.mesh_rows &nbsp; &nbsp; &nbsp; &nbsp; num_columns = int(num_routers / num_rows) &nbsp; &nbsp; &nbsp; &nbsp; # default values for link latency and router latency. &nbsp; &nbsp; &nbsp; &nbsp; # Can be over-ridden on a per link/router basis &nbsp; &nbsp; &nbsp; &nbsp; link_latency = options.link_latency &nbsp;# used by simple and garnet &nbsp; &nbsp; &nbsp; &nbsp; router_latency = options.router_latency &nbsp;# only used by garnet &nbsp; &nbsp; &nbsp; &nbsp; # There must be an evenly divisible number of cntrls to routers &nbsp; &nbsp; &nbsp; &nbsp; # Also, obviously the number or rows must be <= the number of routers &nbsp; &nbsp; &nbsp; &nbsp; cntrls_per_router, remainder = divmod(len(nodes), num_routers) &nbsp; &nbsp; &nbsp; &nbsp; assert num_columns &gt; 0 and num_columns <= num_routers &nbsp; &nbsp; &nbsp; &nbsp; assert num_columns * num_rows == num_routers &nbsp; &nbsp; &nbsp; &nbsp; # Create the routers in the mesh &nbsp; &nbsp; &nbsp; &nbsp; routers = [ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Router(router_id=i, latency=router_latency) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(num_routers) &nbsp; &nbsp; &nbsp; &nbsp; ] &nbsp; &nbsp; &nbsp; &nbsp; network.routers = routers &nbsp; &nbsp; &nbsp; &nbsp; # link counter to set unique link ids &nbsp; &nbsp; &nbsp; &nbsp; link_count = 0 &nbsp; &nbsp; &nbsp; &nbsp; # Add all but the remainder nodes to the list of nodes to be uniformly &nbsp; &nbsp; &nbsp; &nbsp; # distributed across the network. &nbsp; &nbsp; &nbsp; &nbsp; network_nodes = [] &nbsp; &nbsp; &nbsp; &nbsp; remainder_nodes = [] &nbsp; &nbsp; &nbsp; &nbsp; for node_index in range(len(nodes)): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if node_index < (len(nodes) - remainder): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; network_nodes.append(nodes[node_index]) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; remainder_nodes.append(nodes[node_index]) &nbsp; &nbsp; &nbsp; &nbsp; # Connect each node to the appropriate router &nbsp; &nbsp; &nbsp; &nbsp; ext_links = [] &nbsp; &nbsp; &nbsp; &nbsp; for i, n in enumerate(network_nodes): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cntrl_level, router_id = divmod(i, num_routers) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert cntrl_level < cntrls_per_router &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ext_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ExtLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ext_node=n, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_node=routers[router_id], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; # Connect the remainding nodes to router 0. &nbsp;These should only be &nbsp; &nbsp; &nbsp; &nbsp; # DMA nodes. &nbsp; &nbsp; &nbsp; &nbsp; for i, node in enumerate(remainder_nodes): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert node.type == "DMA_Controller" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert i < remainder &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ext_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ExtLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ext_node=node, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_node=routers[0], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; network.ext_links = ext_links &nbsp; &nbsp; &nbsp; &nbsp; # Create the mesh links. &nbsp; &nbsp; &nbsp; &nbsp; int_links = [] &nbsp; &nbsp; &nbsp; &nbsp; # North output to South input links (weight = 2) &nbsp; &nbsp; &nbsp; &nbsp; for col in range(num_columns): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for row in range(num_rows): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if row + 1 < num_rows: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; north_out = col + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; south_in = col + ((row + 1) * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_node=routers[north_out], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_node=routers[south_in], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_outport="North", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_inport="South", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; weight=1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; # South output to North input links (weight = 2) &nbsp; &nbsp; &nbsp; &nbsp; for col in range(num_columns): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for row in range(num_rows): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if row + 1 < num_rows: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; north_in = col + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; south_out = col + ((row + 1) * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_node=routers[south_out], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_node=routers[north_in], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_outport="South", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_inport="North", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; weight=1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; # East output to West input links (weight = 1) &nbsp; &nbsp; &nbsp; &nbsp; for row in range(num_rows): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for col in range(num_columns): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if col + 1 < num_columns: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; east_out = col + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; west_in = (col + 1) + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_node=routers[east_out], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_node=routers[west_in], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_outport="East", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_inport="West", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; weight=2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; # West output to East input links (weight = 1) &nbsp; &nbsp; &nbsp; &nbsp; for row in range(num_rows): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for col in range(num_columns): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if col + 1 < num_columns: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; east_in = col + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; west_out = (col + 1) + (row * num_columns) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int_links.append( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntLink( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_id=link_count, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_node=routers[west_out], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_node=routers[east_in], &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_outport="West", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dst_inport="East", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; latency=link_latency, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; weight=2, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; link_count += 1 &nbsp; &nbsp; &nbsp; &nbsp; network.int_links = int_links &nbsp; &nbsp; # Register nodes with filesystem &nbsp; &nbsp; def registerTopology(self, options): &nbsp; &nbsp; &nbsp; &nbsp; for i in range(options.num_cpus): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileSystemConfig.register_node( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [i], MemorySize(options.mem_size) // options.num_cpus, i &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) RoutingUnit.CC int RoutingUnit::outportComputeYX(RouteInfo route, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int inport, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PortDirection inport_dirn) { &nbsp; &nbsp; PortDirection outport_dirn = "Unknown"; &nbsp; &nbsp; [[maybe_unused]] int num_rows = m_router-&gt;get_net_ptr()-&gt;getNumRows(); &nbsp; &nbsp; int num_cols = m_router-&gt;get_net_ptr()-&gt;getNumCols(); &nbsp; &nbsp; assert(num_rows &gt; 0 &amp;&amp; num_cols &gt; 0); &nbsp; &nbsp; int my_id = m_router-&gt;get_id(); &nbsp; &nbsp; int my_x = my_id % num_cols; &nbsp; &nbsp; int my_y = my_id / num_cols; &nbsp; &nbsp; int dest_id = route.dest_router; &nbsp; &nbsp; int dest_x = dest_id % num_cols; &nbsp; &nbsp; int dest_y = dest_id / num_cols; &nbsp; &nbsp; int x_hops = abs(dest_x - my_x); &nbsp; &nbsp; int y_hops = abs(dest_y - my_y); &nbsp; &nbsp; bool x_dirn = (dest_x &gt;= my_x); &nbsp; &nbsp; bool y_dirn = (dest_y &gt;= my_y); &nbsp; &nbsp; // already checked that in outportCompute() function &nbsp; &nbsp; assert(!(x_hops == 0 &amp;&amp; y_hops == 0)); &nbsp; &nbsp; if (y_hops &gt; 0) { &nbsp; &nbsp; &nbsp; &nbsp; if (y_dirn) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert(inport_dirn == "Local" || inport_dirn == "North"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outport_dirn = "South"; &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert(inport_dirn == "Local" || inport_dirn == "South"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outport_dirn = "North"; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; else if (x_hops &gt; 0) { &nbsp; &nbsp; &nbsp; &nbsp; if (x_dirn) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // "Local" or "South" or "West" or "East" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert(inport_dirn != "West"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outport_dirn = "West"; &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // "Local" or "North" or "West" or "East" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assert(inport_dirn != "East"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outport_dirn = "East"; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; else { &nbsp; &nbsp; &nbsp; &nbsp; // x_hops == 0 and y_hops == 0 &nbsp; &nbsp; &nbsp; &nbsp; // this is not possible &nbsp; &nbsp; &nbsp; &nbsp; // already checked that in outportCompute() function &nbsp; &nbsp; &nbsp; &nbsp; panic("x_hops == y_hops == 0"); &nbsp; &nbsp; } &nbsp; &nbsp; return m_outports_dirn2idx[outport_dirn]; } &nbsp;and this is my command line. #!/bin/bash gem5path=/home/zr/gem5 spec2006path=$gem5path/CPU2006 outdir=/home/zr/gem5/m5out429 bench=429.mcf ben_suffix=run/run_base_ref_amd64-m64-gcc42-nn.0000 exe=mcf_base.amd64-m64-gcc42-nn $gem5path/build/X86/gem5.opt \ --outdir=$outdir \ $gem5path/configs/example/se.py \ -c "$spec2006path/$bench/$ben_suffix/$exe" \ --ruby \ --network=garnet \ --num-cpus=64 \ --num-dirs=64 \ --num-l2caches=64 \ --topology=Mesh_YX \ --routing-algorithm=2 \ --mesh-rows=8 the following bug appeared. system.remote_gdb: Listening for connections on port 7000 **** REAL SIMULATION **** src/sim/simulate.cc:199: info: Entering event queue @ 0. &nbsp;Starting simulation... gem5 has encountered a segmentation fault! I would like to ask everyone, Why did this error occur. Thank you very much for your help. Y阿Z阿 1765197550@qq.com