def __init__(self, send_buffers, resources_required, label, constraints): PartitionedVertex.__init__(self, resources_required, label, constraints) RequiresRoutingInfoPartitionedVertex.__init__(self) SendsBuffersFromHostPartitionedVertexPreBufferedImpl.__init__( self, send_buffers) self._base_key = None
def __init__(self, send_buffers, resources_required, label, constraints): PartitionedVertex.__init__(self, resources_required, label, constraints) RequiresRoutingInfoPartitionedVertex.__init__(self) SendsBuffersFromHostPartitionedVertexPreBufferedImpl.__init__( self, send_buffers) AbstractEIEIOSpikeRecordable.__init__(self) self._base_key = None self._region_size = None
def __init__(self, label, region_files_tuples): """ :param label: The label of the vertex :param region_files_dict: A dictionary of region id -> file name """ self._label = label self._send_buffers = dict() for (region_id, filename, max_size_of_buffer) in region_files_tuples: send_buffer = BufferedSendingRegion(max_size_of_buffer) reader = open(filename, "r") line = reader.readline() while line != "": bits = line.split(":") send_buffer.add_key(int(bits[0]), int(bits[1])) line = reader.readline() self._send_buffers[region_id] = send_buffer SendsBuffersFromHostPartitionedVertexPreBufferedImpl.__init__(self, self._send_buffers)
def __init__( self, n_keys, resources_required, machine_time_step, timescale_factor, label, constraints=None, # General input and output parameters board_address=None, # Live input parameters receive_port=None, receive_sdp_port=( constants.SDP_PORTS.INPUT_BUFFERING_SDP_PORT.value), receive_tag=None, # Key parameters virtual_key=None, prefix=None, prefix_type=None, check_keys=False, # Send buffer parameters send_buffer_times=None, send_buffer_max_space=( constants.MAX_SIZE_OF_BUFFERED_REGION_ON_CHIP), send_buffer_space_before_notify=640, send_buffer_notification_ip_address=None, send_buffer_notification_port=None, send_buffer_notification_tag=None): """ :param n_keys: The number of keys to be sent via this multicast source :param resources_required: The resources required by the vertex :param machine_time_step: The time step to be used on the machine :param timescale_factor: The time scaling to be used in the simulation :param label: The label of this vertex :param constraints: Any initial constraints to this vertex :param board_address: The IP address of the board on which to place\ this vertex if receiving data, either buffered or live (by\ default, any board is chosen) :param receive_port: The port on the board that will listen for\ incoming event packets (default is to disable this feature;\ set a value to enable it) :param receive_sdp_port: The SDP port to listen on for incoming event\ packets (defaults to 1) :param receive_tag: The IP tag to use for receiving live events\ (uses any by default) :param virtual_key: The base multicast key to send received events\ with (assigned automatically by default) :param prefix: The prefix to "or" with generated multicast keys\ (default is no prefix) :param prefix_type: Whether the prefix should apply to the upper or\ lower half of the multicast keys (default is upper half) :param check_keys: True if the keys of received events should be\ verified before sending (default False) :param send_buffer_times: An array of arrays of times at which keys\ should be sent (one array for each key, default disabled) :param send_buffer_max_space: The maximum amount of space to use of\ the SDRAM on the machine (default is 1MB) :param send_buffer_space_before_notify: The amount of space free in\ the sending buffer before the machine will ask the host for\ more data (default setting is optimised for most cases) :param send_buffer_notification_ip_address: The IP address of the host\ that will send new buffers (must be specified if a send buffer\ is specified) :param send_buffer_notification_port: The port that the host that will\ send new buffers is listening on (must be specified if a\ send buffer is specified) :param send_buffer_notification_tag: The IP tag to use to notify the\ host about space in the buffer (default is to use any tag) """ # Set up super types AbstractDataSpecableVertex.__init__( self, machine_time_step, timescale_factor) PartitionedVertex.__init__( self, resources_required, label, constraints) AbstractProvidesOutgoingEdgeConstraints.__init__(self) ReceiveBuffersToHostBasicImpl.__init__(self) # Set up for receiving live packets if receive_port is not None: self.add_constraint(TagAllocatorRequireReverseIptagConstraint( receive_port, receive_sdp_port, board_address, receive_tag)) # Work out if buffers are being sent self._first_machine_time_step = 0 self._send_buffer = None if send_buffer_times is None: self._send_buffer_times = None SendsBuffersFromHostPartitionedVertexPreBufferedImpl.__init__( self, None) else: self._send_buffer = BufferedSendingRegion(send_buffer_max_space) self._send_buffer_times = send_buffer_times self.add_constraint(TagAllocatorRequireIptagConstraint( send_buffer_notification_ip_address, send_buffer_notification_port, True, board_address, send_buffer_notification_tag)) SendsBuffersFromHostPartitionedVertexPreBufferedImpl.__init__( self, {self._REGIONS.SEND_BUFFER.value: self._send_buffer}) # buffered out parameters self._send_buffer_space_before_notify = send_buffer_space_before_notify self._send_buffer_notification_ip_address = \ send_buffer_notification_ip_address self._send_buffer_notification_port = send_buffer_notification_port self._send_buffer_notification_tag = send_buffer_notification_tag if self._send_buffer_space_before_notify > send_buffer_max_space: self._send_buffer_space_before_notify = send_buffer_max_space # Set up for recording (if requested) self._record_buffer_size = 0 self._buffer_size_before_receive = 0 # Sort out the keys to be used self._n_keys = n_keys self._virtual_key = virtual_key self._mask = None self._prefix = prefix self._prefix_type = prefix_type self._check_keys = check_keys # Work out the prefix details if self._prefix is not None: if self._prefix_type is None: self._prefix_type = EIEIOPrefix.UPPER_HALF_WORD if self._prefix_type == EIEIOPrefix.UPPER_HALF_WORD: self._prefix = prefix << 16 # If the user has specified a virtual key if self._virtual_key is not None: # check that virtual key is valid if self._virtual_key < 0: raise ConfigurationException( "Virtual keys must be positive") # Get a mask and maximum number of keys for the number of keys # requested self._mask, max_key = self._calculate_mask(n_keys) # Check that the number of keys and the virtual key don't interfere if n_keys > max_key: raise ConfigurationException( "The mask calculated from the number of keys will " "not work with the virtual key specified") if self._prefix is not None: # Check that the prefix doesn't change the virtual key in the # masked area masked_key = (self._virtual_key | self._prefix) & self._mask if self._virtual_key != masked_key: raise ConfigurationException( "The number of keys, virtual key and key prefix" " settings don't work together") else: # If no prefix was generated, generate one self._prefix_type = EIEIOPrefix.UPPER_HALF_WORD self._prefix = self._virtual_key