def reserve_memory_regions(self, spec, placement, graph_mapper): """ Reserve memory regions for Poisson source parameters and output\ buffer. :param spec: the data specification writer :param placement: the location this vertex resides on in the machine :param graph_mapper: the mapping between app and machine graphs :return: None """ spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region(region=_REGIONS.SYSTEM_REGION.value, size=SIMULATION_N_BYTES, label='setup') # reserve poisson parameters and rates DSG region self._reserve_poisson_params_rates_region(placement, graph_mapper, spec) spec.reserve_memory_region( region=_REGIONS.SPIKE_HISTORY_REGION.value, size=recording_utilities.get_recording_header_size(1), label="Recording") profile_utils.reserve_profile_region(spec, _REGIONS.PROFILER_REGION.value, self.__n_profile_samples) placement.vertex.reserve_provenance_data_region(spec)
def _write_common_data_spec(self, spec, rec_regions): """ Write the data specification for the common regions :param ~data_specification.DataSpecificationGenerator spec: The data specification to write to :param list(int) rec_regions: A list of sizes of each recording region (including empty ones) """ # Write the setup region spec.reserve_memory_region(region=self.__regions.system, size=SIMULATION_N_BYTES, label='System') spec.switch_write_focus(self.__regions.system) spec.write_array(get_simulation_header_array(self.__binary_file_name)) # Reserve memory for provenance self.reserve_provenance_data_region(spec) # Write profile data reserve_profile_region(spec, self.__regions.profile, self._app_vertex.n_profile_samples) write_profile_region_data(spec, self.__regions.profile, self._app_vertex.n_profile_samples) # Set up for recording spec.reserve_memory_region(region=self.__regions.recording, size=get_recording_header_size( len(rec_regions)), label="Recording") spec.switch_write_focus(self.__regions.recording) spec.write_array(get_recording_header_array(rec_regions))
def reserve_memory_regions(self, spec, placement): """ Reserve memory regions for Poisson source parameters and output\ buffer. :param ~data_specification.DataSpecification spec: the data specification writer :param ~pacman.models.placements.Placement placement: the location this vertex resides on in the machine :return: None """ spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region(region=_REGIONS.SYSTEM_REGION.value, size=SIMULATION_N_BYTES, label='setup') # reserve poisson parameters and rates DSG region self._reserve_poisson_params_rates_region(placement, spec) spec.reserve_memory_region( region=_REGIONS.SPIKE_HISTORY_REGION.value, size=recording_utilities.get_recording_header_size(1), label="Recording") profile_utils.reserve_profile_region(spec, _REGIONS.PROFILER_REGION.value, self.__n_profile_samples) spec.reserve_memory_region(region=_REGIONS.TDMA_REGION.value, label="tdma_region", size=self.tdma_sdram_size_in_bytes) placement.vertex.reserve_provenance_data_region(spec)
def _reserve_memory_regions(self, spec, vertex_slice, vertex, machine_graph, n_key_map): """ Reserve the DSG data regions. :param ~.DataSpecificationGenerator spec: the spec to write the DSG region to :param ~pacman.model.graphs.common.Slice vertex_slice: the slice of atoms from the application vertex :param ~.MachineVertex vertex: this vertex :param ~.MachineGraph machine_graph: machine graph :param n_key_map: nkey map :return: None """ spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region( region=POPULATION_BASED_REGIONS.SYSTEM.value, size=common_constants.SIMULATION_N_BYTES, label='System') self._reserve_neuron_params_data_region(spec, vertex_slice) spec.reserve_memory_region( region=POPULATION_BASED_REGIONS.NEURON_RECORDING.value, size=self._neuron_recorder.get_static_sdram_usage(vertex_slice), label="neuron recording") profile_utils.reserve_profile_region( spec, POPULATION_BASED_REGIONS.PROFILING.value, self.__n_profile_samples) # reserve bit field region bit_field_utilities.reserve_bit_field_regions( spec, machine_graph, n_key_map, vertex, POPULATION_BASED_REGIONS.BIT_FIELD_BUILDER.value, POPULATION_BASED_REGIONS.BIT_FIELD_FILTER.value, POPULATION_BASED_REGIONS.BIT_FIELD_KEY_MAP.value) vertex.reserve_provenance_data_region(spec)
def _reserve_memory_regions(self, spec, vertex_slice, vertex): spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region( region=constants.POPULATION_BASED_REGIONS.SYSTEM.value, size=common_constants.SYSTEM_BYTES_REQUIREMENT, label='System') self._reserve_neuron_params_data_region(spec, vertex_slice) spec.reserve_memory_region( region=constants.POPULATION_BASED_REGIONS.RECORDING.value, size=recording_utilities.get_recording_header_size( self.N_RECORDING_REGIONS)) profile_utils.reserve_profile_region( spec, constants.POPULATION_BASED_REGIONS.PROFILING.value, self._n_profile_samples) vertex.reserve_provenance_data_region(spec)
def _reserve_memory_regions(self, spec, vertex_slice, vertex): spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region( region=constants.POPULATION_BASED_REGIONS.SYSTEM.value, size=common_constants.SIMULATION_N_BYTES, label='System') self._reserve_neuron_params_data_region(spec, vertex_slice) spec.reserve_memory_region( region=constants.POPULATION_BASED_REGIONS.RECORDING.value, size=recording_utilities.get_recording_header_size( len(self._neuron_impl.get_recordable_variables()) + 1)) profile_utils.reserve_profile_region( spec, constants.POPULATION_BASED_REGIONS.PROFILING.value, self._n_profile_samples) vertex.reserve_provenance_data_region(spec)
def _reserve_memory_regions(self, spec, vertex_slice, vertex): spec.comment("\nReserving memory space for data regions:\n\n") # Reserve memory: spec.reserve_memory_region( region=POPULATION_BASED_REGIONS.SYSTEM.value, size=common_constants.SIMULATION_N_BYTES, label='System') self._reserve_neuron_params_data_region(spec, vertex_slice) spec.reserve_memory_region( region=POPULATION_BASED_REGIONS.NEURON_RECORDING.value, size=self._neuron_recorder.get_static_sdram_usage(vertex_slice), label="neuron recording") profile_utils.reserve_profile_region( spec, POPULATION_BASED_REGIONS.PROFILING.value, self.__n_profile_samples) vertex.reserve_provenance_data_region(spec)
def _reserve_profile_memory_regions(self, spec): # only reserve if using if self._profile: # reserve profile region profile_utils.reserve_profile_region(spec, self._profile_region, self._n_profile_samples)