Skip to content

Commit

Permalink
This has to be done this way
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 10, 2024
1 parent eb560f8 commit 4fc9f33
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
5 changes: 3 additions & 2 deletions spinn_gym/games/breakout/breakout_machine_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.models.common import PopulationApplicationVertex
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex
Expand Down Expand Up @@ -149,8 +150,8 @@ def generate_data_specification(
spec.switch_write_focus(
BreakoutMachineVertex._BREAKOUT_REGIONS.BREAKOUT.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))
if self.app_vertex.source_vertex is None:
raise ValueError(
"The breakout vertex doesn't have a source vertex!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# sPyNNaker imports
from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex
Expand Down Expand Up @@ -166,8 +167,8 @@ def generate_data_specification(
spec.switch_write_focus(
self._DOUBLE_PENDULUM_REGIONS.PENDULUM.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))

# Write recording region for score
spec.comment("\nWriting double pendulum recording region:\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

# sPyNNaker imports
from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex
Expand Down Expand Up @@ -164,8 +165,8 @@ def generate_data_specification(
spec.switch_write_focus(
self._PENDULUM_REGIONS.PENDULUM.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))

# Write recording region for score
spec.comment("\nWriting pendulum recording region:\n")
Expand Down
6 changes: 4 additions & 2 deletions spinn_gym/games/logic/logic_machine_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

# sPyNNaker imports
from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex

Expand Down Expand Up @@ -148,8 +150,8 @@ def generate_data_specification(
spec.switch_write_focus(
self._LOGIC_REGIONS.LOGIC.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))

# Write recording region for score
spec.comment("\nWriting logic recording region:\n")
Expand Down
5 changes: 3 additions & 2 deletions spinn_gym/games/multi_arm_bandit/bandit_machine_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

# sPyNNaker imports
from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex
Expand Down Expand Up @@ -159,8 +160,8 @@ def generate_data_specification(
spec.switch_write_focus(
self._BANDIT_REGIONS.BANDIT.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))

# Write recording region for score
spec.comment("\nWriting bandit recording region:\n")
Expand Down
5 changes: 3 additions & 2 deletions spinn_gym/games/store_recall/store_recall_machine_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

# sPyNNaker imports
from spynnaker.pyNN.data import SpynnakerDataView
from spynnaker.pyNN.utilities.constants import SPIKE_PARTITION_ID

# spinn_gym imports
from spinn_gym.games import SpinnGymMachineVertex
Expand Down Expand Up @@ -153,8 +154,8 @@ def generate_data_specification(
spec.switch_write_focus(
self._RECALL_REGIONS.RECALL.value)
routing_info = SpynnakerDataView.get_routing_infos()
spec.write_value(routing_info.get_single_first_key_from_pre_vertex(
vertex))
spec.write_value(routing_info.get_safe_first_key_from_pre_vertex(
vertex, SPIKE_PARTITION_ID))

# Write recording region for score
spec.comment("\nWriting recall recording region:\n")
Expand Down

0 comments on commit 4fc9f33

Please sign in to comment.