Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Mar 7, 2024
2 parents 65091c2 + 45f5281 commit fdeaed6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 48 deletions.
38 changes: 0 additions & 38 deletions spinn_machine/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,6 @@ def y(self) -> int:
"""
return self[1]

@property
def processors(self) -> Iterator[Processor]:
"""
An iterable of available all processors.
Deprecated: There are many more efficient methods instead.
- all_processor_ids
- n_processors
- n_user_processors
- user_processors
- user_processors_ids
- n_monitor_processors
- monitor_processors
- monitor_processors_ids
:rtype: iterable(Processor)
"""
yield from self._scamp_processors.values()
yield from self._placable_processors.values()

@property
def all_processor_ids(self) -> Iterator[int]:
"""
Expand All @@ -231,15 +211,6 @@ def n_processors(self) -> int:
"""
return len(self._scamp_processors) + len(self._placable_processors)

@property
def placeable_processors(self) -> Iterator[Processor]:
"""
An iterable of available placable/ none scamp processors.
:rtype: iterable(Processor)
"""
yield from self._placable_processors.values()

@property
def placable_processors_ids(self) -> Iterator[int]:
"""
Expand All @@ -258,15 +229,6 @@ def n_placable_processors(self) -> int:
"""
return len(self._placable_processors)

@property
def scamp_processors(self) -> Iterator[Processor]:
"""
An iterable of available scamp processors.
:rtype: iterable(Processor)
"""
return self._scamp_processors.values()

@property
def scamp_processors_ids(self) -> Iterator[int]:
"""
Expand Down
12 changes: 4 additions & 8 deletions unittests/test_chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,16 @@ def test_1_chip(self):
with self.assertRaises(Exception):
new_chip.get_first_none_monitor_processor()


def test_processors(self):
new_chip = self._create_chip(self._x, self._y, self.n_processors,
self._router, self._sdram, self._ip)
all_p = set(new_chip.processors)
all_p = set(new_chip.all_processor_ids)
self.assertEqual(len(all_p), new_chip.n_processors)
self.assertEqual(len(all_p), len(set(new_chip.all_processor_ids)))
users = set(new_chip.placeable_processors)
users = set(new_chip.placable_processors_ids)
self.assertEqual(len(users), new_chip.n_placable_processors)
self.assertEqual(len(users),
len(set(new_chip.placable_processors_ids)))
monitors = set(new_chip.scamp_processors)
monitors = set(new_chip.scamp_processors_ids)
self.assertEqual(users.union(monitors), all_p)
self.assertEqual(len(monitors),
len(set(new_chip.scamp_processors_ids)))

def test_is_xy(self):
chip24 = self._create_chip(
Expand Down
4 changes: 2 additions & 2 deletions unittests/test_virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def test_new_vm_with_max_cores(self):
self.assertEqual(n_cpus, _chip.n_processors)
self.assertEqual(n_cpus - 1, _chip.n_placable_processors)
self.assertEqual(1, _chip.n_scamp_processors)
self.assertEqual(n_cpus - 1, len(list(_chip.placeable_processors)))
self.assertEqual(1, len(list(_chip.scamp_processors)))
self.assertEqual(n_cpus - 1, len(list(_chip.placable_processors_ids)))
self.assertEqual(1, len(list(_chip.scamp_processors_ids)))
count = sum(_chip.n_processors for _chip in vm.chips)
self.assertEqual(count, 4 * n_cpus)

Expand Down

0 comments on commit fdeaed6

Please sign in to comment.