예제 #1
0
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping  = new NodeMapping_AllCPU_SharedCache();

            links    = new List <Link>();
            _routers = new BufRingNetwork_Router[Config.N];

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n]    = new Node(mapping, c);
                _routers[n] = new BufRingNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            int B = Config.bufrings_branching;

            // create the NICs and IRIs
            _nics = new BufRingNetwork_NIC[Config.N * Config.bufrings_n];
            _iris = new BufRingNetwork_IRI[B * Config.bufrings_n];

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++)
            {
                // for each local ring...
                for (int ring = 0; ring < B; ring++)
                {
                    // create global ring interface
                    _iris[copy * B + ring] = new BufRingNetwork_IRI(ring);

                    // create local NICs (ring stops)
                    for (int local = 0; local < B; local++)
                    {
                        _nics[copy * Config.N + ring * B + local] = new BufRingNetwork_NIC(ring, local);
                    }
                    // connect with links
                    for (int local = 1; local < B; local++)
                    {
                        Link l = new Link(Config.bufrings_locallat - 1);
                        links.Add(l);
                        _nics[copy * Config.N + ring * B + local - 1].setOutput(l,
                                                                                _nics[copy * Config.N + ring * B + local]);
                        _nics[copy * Config.N + ring * B + local].setInput(l);
                    }
                    Link iriIn = new Link(Config.bufrings_locallat - 1), iriOut = new Link(Config.bufrings_locallat - 1);
                    links.Add(iriIn);
                    links.Add(iriOut);
                    _nics[copy * Config.N + ring * B + B - 1].setOutput(iriIn,
                                                                        _iris[copy * B + ring]);
                    _nics[copy * Config.N + ring * B + 0].setInput(iriOut);

                    _iris[copy * B + ring].setLocalInput(iriIn);
                    _iris[copy * B + ring].setLocalOutput(iriOut,
                                                          _nics[copy * Config.N + ring * B + 0]);
                }

                // connect IRIs with links to make up global ring
                for (int ring = 0; ring < B; ring++)
                {
                    Link globalLink = new Link(Config.bufrings_globallat - 1);
                    links.Add(globalLink);
                    _iris[copy * B + ring].setGlobalOutput(globalLink,
                                                           _iris[copy * B + (ring + 1) % B]);
                    _iris[copy * B + (ring + 1) % B].setGlobalInput(globalLink);
                }

                // add the corresponding NIC to each node/router
                for (int id = 0; id < Config.N; id++)
                {
                    int ring, local;
                    BufRingNetwork_NIC.Map(id, out ring, out local);

                    _routers[id].addNIC(_nics[copy * Config.N + ring * B + local]);
                    _nics[copy * Config.N + ring * B + local].setRouter(_routers[id]);
                }
            }
        }
예제 #2
0
 public void setRouter(BufRingNetwork_Router router)
 {
     _router = router;
 }
예제 #3
0
 public void setRouter(BufRingNetwork_Router router)
 {
     _router = router;
 }
예제 #4
0
        public override void setup()
        {
            // boilerplate
            nodes = new Node[Config.N];
            cache = new CmpCache();
            ParseFinish(Config.finish);
            workload = new Workload(Config.traceFilenames);
            mapping = new NodeMapping_AllCPU_SharedCache();

            links = new List<Link>();
            _routers = new BufRingNetwork_Router[Config.N];

            // create routers and nodes
            for (int n = 0; n < Config.N; n++)
            {
                Coord c = new Coord(n);
                nodes[n] = new Node(mapping, c);
                _routers[n] = new BufRingNetwork_Router(c);
                _routers[n].setNode(nodes[n]);
                nodes[n].setRouter(_routers[n]);
            }

            int B = Config.bufrings_branching;

            // create the NICs and IRIs
            _nics = new BufRingNetwork_NIC[Config.N * Config.bufrings_n];
            _iris = new BufRingNetwork_IRI[B * Config.bufrings_n];

            // for each copy of the network...
            for (int copy = 0; copy < Config.bufrings_n; copy++) {

                // for each local ring...
                for (int ring = 0; ring < B; ring++) {

                    // create global ring interface
                    _iris[copy*B + ring] = new BufRingNetwork_IRI(ring);

                    // create local NICs (ring stops)
                    for (int local = 0; local < B; local++)
                        _nics[copy*Config.N + ring*B + local] = new BufRingNetwork_NIC(ring, local);
                    // connect with links
                    for (int local = 1; local < B; local++)
                    {
                        Link l = new Link(Config.bufrings_locallat - 1);
                        links.Add(l);
                        _nics[copy*Config.N + ring*B + local - 1].setOutput(l,
                                _nics[copy*Config.N + ring*B + local]);
                        _nics[copy*Config.N + ring*B + local].setInput(l);
                    }
                    Link iriIn = new Link(Config.bufrings_locallat - 1), iriOut = new Link(Config.bufrings_locallat - 1);
                    links.Add(iriIn);
                    links.Add(iriOut);
                    _nics[copy*Config.N + ring*B + B-1].setOutput(iriIn,
                            _iris[copy*B + ring]);
                    _nics[copy*Config.N + ring*B + 0].setInput(iriOut);

                    _iris[copy*B + ring].setLocalInput(iriIn);
                    _iris[copy*B + ring].setLocalOutput(iriOut,
                            _nics[copy*Config.N + ring*B + 0]);

                }

                // connect IRIs with links to make up global ring
                for (int ring = 0; ring < B; ring++) {
                    Link globalLink = new Link(Config.bufrings_globallat - 1);
                    links.Add(globalLink);
                    _iris[copy*B + ring].setGlobalOutput(globalLink,
                            _iris[copy*B + (ring+1)%B]);
                    _iris[copy*B + (ring+1)%B].setGlobalInput(globalLink);
                }

                // add the corresponding NIC to each node/router
                for (int id = 0; id < Config.N; id++) {
                    int ring, local;
                    BufRingNetwork_NIC.Map(id, out ring, out local);

                    _routers[id].addNIC(_nics[copy * Config.N + ring*B + local]);
                    _nics[copy * Config.N + ring*B + local].setRouter(_routers[id]);
                }
            }

        }