示例#1
0
    def test_1_chip_pre_allocated_same_core(self):
        machine = VirtualMachine(width=8, height=8)
        graph = ApplicationGraph("Test")
        partitioner = PartitionAndPlacePartitioner()

        # add graph vertices which reside on 0,0
        for p in range(0, 13):
            graph.add_vertex(
                SimpleTestVertex(
                    constraints=[ChipAndCoreConstraint(x=0, y=0, p=p)],
                    n_atoms=1))

        # add pre-allocated resources for cores on 0,0
        core_pre = SpecificCoreResource(chip=machine.get_chip_at(0, 0),
                                        cores=[4])
        pre_allocated_res = PreAllocatedResourceContainer(
            specific_core_resources=[core_pre])

        # run partitioner that should go boom
        try:
            partitioner(graph, machine, pre_allocated_res)
            raise Exception("should have blown up here")
        except PacmanValueError:
            pass
        except Exception:
            raise Exception("should have blown up here")
示例#2
0
    def test_1_chip_pre_allocated_too_much_sdram(self):
        machine = VirtualMachine(width=8, height=8)
        graph = ApplicationGraph("Test")
        partitioner = PartitionAndPlacePartitioner()

        eight_meg = 8 * 1024 * 1024

        # add graph vertices which reside on 0,0
        for _ in range(0, 13):
            graph.add_vertex(
                SimpleTestVertex(constraints=[ChipAndCoreConstraint(x=0, y=0)],
                                 n_atoms=1,
                                 fixed_sdram_value=eight_meg))

        # add pre-allocated resources for cores on 0,0
        twenty_meg = 20 * 1024 * 1024
        core_pre = SpecificChipSDRAMResource(chip=machine.get_chip_at(0, 0),
                                             sdram_usage=twenty_meg)
        pre_allocated_res = PreAllocatedResourceContainer(
            specific_sdram_usage=[core_pre])

        # run partitioner that should go boom
        try:
            partitioner(graph, machine, pre_allocated_res)
            raise Exception("should have blown up here")
        except PacmanPartitionException:
            pass
        except Exception:
            raise Exception("should have blown up here")
示例#3
0
    def test_1_chip_no_pre_allocated_too_much_sdram(self):
        machine = VirtualMachine(width=8, height=8)
        graph = ApplicationGraph("Test")
        partitioner = PartitionAndPlacePartitioner()

        eight_meg = 8 * 1024 * 1024

        # add graph vertices which reside on 0,0
        for _ in range(0, 13):
            graph.add_vertex(
                SimpleTestVertex(constraints=[ChipAndCoreConstraint(x=0, y=0)],
                                 n_atoms=1,
                                 fixed_sdram_value=eight_meg))

        # add pre-allocated resources for cores on 0,0
        pre_allocated_res = PreAllocatedResourceContainer()

        # run partitioner that should go boom
        try:
            partitioner(graph, machine, pre_allocated_res)
        except Exception:
            raise Exception("should have blown up here")