diff --git a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataGatherer.java b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataGatherer.java index c801c3ae7d..0b4ee89ed1 100644 --- a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataGatherer.java +++ b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataGatherer.java @@ -267,6 +267,11 @@ private Map> discoverActualWork( storeData(r, allocate(0)); } } + for (var dr : p.getVertex().getDownloadRegions()) { + regions.add(new Region(p, dr.getIndex(), + dr.getAddress(), dr.getSize())); + count++; + } workitems.add(new WorkItems(m, regions)); } diff --git a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataReceiver.java b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataReceiver.java index ea5167fa2b..f7aa246352 100644 --- a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataReceiver.java +++ b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/DataReceiver.java @@ -142,6 +142,12 @@ public void getDataForPlacements(List placements) .getRecordedRegionIds()) { getDataForPlacement(placement, recordingRegionId); } + for (var region : placement.getVertex().getDownloadRegions()) { + var location = new RegionLocation(placement, + region.getIndex()); + readSomeData(location, region.getAddress(), + region.getSize()); + } } } } diff --git a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/DownloadRegion.java b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/DownloadRegion.java new file mode 100644 index 0000000000..495203891e --- /dev/null +++ b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/DownloadRegion.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024 The University of Manchester + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.ac.manchester.spinnaker.front_end.download.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonFormat.Shape; + +import uk.ac.manchester.spinnaker.machine.MemoryLocation; + +/** + * A non-recording region to be downloaded. + */ +@JsonFormat(shape = Shape.OBJECT) +public class DownloadRegion { + + private final int index; + + private final MemoryLocation address; + + private final int size; + + public DownloadRegion() { + this.index = 0; + this.address = new MemoryLocation(0); + this.size = 0; + } + + /** + * Constructs a new download region. + * + * @param index + * The index of the region. + * @param address + * The address of the region. + * @param size + * The size of the region. + */ + public DownloadRegion( + @JsonProperty(value = "index", required = true) int index, + @JsonProperty(value = "address", required = true) long address, + @JsonProperty(value = "size", required = true) int size) { + this.index = index; + this.address = new MemoryLocation(address); + this.size = size; + } + + /** + * @return The index of the region. + */ + public int getIndex() { + return index; + } + + /** + * @return The address of the region. + */ + public MemoryLocation getAddress() { + return address; + } + + /** + * @return The size of the region. + */ + public int getSize() { + return size; + } +} diff --git a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/Vertex.java b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/Vertex.java index 63da678050..666a2863ee 100644 --- a/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/Vertex.java +++ b/SpiNNaker-front-end/src/main/java/uk/ac/manchester/spinnaker/front_end/download/request/Vertex.java @@ -64,6 +64,10 @@ public class Vertex { @NotNull private final int[] recordedRegionIds; + /** The non-recording regions to download. */ + @NotNull + private final DownloadRegion[] downloadRegions; + /** * Create a minimal vertex, possibly using an unmarshaller. * @@ -75,16 +79,21 @@ public class Vertex { * execution process. * @param recordedRegionIds * The IDs of the regions doing recording. + * @param downloadRegions + * The non-recording regions to download. */ public Vertex(@JsonProperty(value = "label", required = true) String label, @JsonProperty(value = "recordingRegionBaseAddress", required = true) long recordingRegionBaseAddress, @JsonProperty(value = "recordedRegionIds", required = true) - int[] recordedRegionIds) { + int[] recordedRegionIds, + @JsonProperty(value = "downloadRegions", required = true) + DownloadRegion[] downloadRegions) { this.label = label; this.recordingRegionBaseAddress = recordingRegionBaseAddress; this.recordedRegionIds = recordedRegionIds; this.base = new MemoryLocation(recordingRegionBaseAddress); + this.downloadRegions = downloadRegions; } /** @@ -123,4 +132,11 @@ public MemoryLocation getBase() { public String getLabel() { return label; } + + /** + * @return The non-recording regions to download. + */ + public DownloadRegion[] getDownloadRegions() { + return downloadRegions; + } } diff --git a/SpiNNaker-front-end/src/test/resources/gather.json b/SpiNNaker-front-end/src/test/resources/gather.json index 5165c09f03..abe60dbbb5 100644 --- a/SpiNNaker-front-end/src/test/resources/gather.json +++ b/SpiNNaker-front-end/src/test/resources/gather.json @@ -1 +1 @@ -[{"x": 0, "y": 0, "p": 1, "iptag": {"x": 0, "y": 0, "boardAddress": "192.168.240.253", "targetAddress": "localhost", "stripSDP": true, "tagID": 1, "trafficIdentifier": "DATA_SPEED_UP"}, "monitors": [{"x": 0, "y": 0, "p": 2, "placements": [{"x": 0, "y": 0, "p": 3, "vertex": {"label": "pop_1:0:2", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1614021536}}, {"x": 0, "y": 0, "p": 4, "vertex": {"label": "input:0:0", "recordedRegionIds": [], "recordingRegionBaseAddress": 1612972308}}]}]}] +[{"x": 0, "y": 0, "p": 1, "iptag": {"x": 0, "y": 0, "boardAddress": "192.168.240.253", "targetAddress": "localhost", "stripSDP": true, "tagID": 1, "trafficIdentifier": "DATA_SPEED_UP"}, "monitors": [{"x": 0, "y": 0, "p": 2, "placements": [{"x": 0, "y": 0, "p": 3, "vertex": {"label": "pop_1:0:2", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1614021536, "downloadRegions": [{"index": 2, "address": 12345678, "size": 10000}]}}, {"x": 0, "y": 0, "p": 4, "vertex": {"label": "input:0:0", "recordedRegionIds": [], "recordingRegionBaseAddress": 1612972308, "downloadRegions": []}}]}]}] diff --git a/SpiNNaker-front-end/src/test/resources/placement.json b/SpiNNaker-front-end/src/test/resources/placement.json index 0f00fc7518..f222a49359 100644 --- a/SpiNNaker-front-end/src/test/resources/placement.json +++ b/SpiNNaker-front-end/src/test/resources/placement.json @@ -1,2 +1,2 @@ -{"x": 1, "y": 2, "p": 3, "vertex": {"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372}} +{"x": 1, "y": 2, "p": 3, "vertex": {"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372, "downloadRegions": [{"index": 2, "address": 12345678, "size": 10000}]}} diff --git a/SpiNNaker-front-end/src/test/resources/simple.json b/SpiNNaker-front-end/src/test/resources/simple.json index 035b20721e..da03ced33b 100644 --- a/SpiNNaker-front-end/src/test/resources/simple.json +++ b/SpiNNaker-front-end/src/test/resources/simple.json @@ -1,2 +1,2 @@ -[{"x": 0, "y": 0, "p": 1, "vertex": {"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372}}, - {"x": 0, "y": 0, "p": 2, "vertex": {"label": "input:0:0", "recordedRegionIds": [], "recordingRegionBaseAddress": 1612972632}}] +[{"x": 0, "y": 0, "p": 1, "vertex": {"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372, "downloadRegions": []}}, +{"x": 0, "y": 0, "p": 2, "vertex": {"label": "input:0:0", "recordedRegionIds": [], "recordingRegionBaseAddress": 1612972632, "downloadRegions": [{"index": 2, "address": 12345678, "size": 10000}]}}] diff --git a/SpiNNaker-front-end/src/test/resources/vertex.json b/SpiNNaker-front-end/src/test/resources/vertex.json index fc63d85ad1..1ce1f9a0ee 100644 --- a/SpiNNaker-front-end/src/test/resources/vertex.json +++ b/SpiNNaker-front-end/src/test/resources/vertex.json @@ -1 +1 @@ -{"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372} +{"label": "pop_1:0:0", "recordedRegionIds": [0, 1], "recordingRegionBaseAddress": 1612972372, "downloadRegions": [{"index": 2, "address": 12345678, "size": 10000}]}