.. index:: pair: page; EDLUT Engine .. _doxid-edlut_engine: EDLUT Engine ============ The EDLUT Engine brings the possibility to connect the EDLUT simulator to NRP-core. The engine implementation is based on the :ref:`Protobuf over gRPC communication protocol ` and it accepts two distinct Datapack types which are described :ref:`below ` : EdlutDataSpikesDatapack and EdlutDataCurrentsDatapack. By default there are two datapacks registered for data exchange with an EDLUT engine: "spikes_datapack" and "currents_datapack". "spikes_datapack" is of type EdlutDataSpikesDatapack and allows users to both inject spikes into the simulated Neural Network and read spikes from it. "currents_datapack" is of type EdlutDataCurrentsDatapack and can only be used for injecting currents into the simulated Neural Network. When "currents_datapack" is requested from the Engine, an empty datapack is returned. When using the "spikes_datapack" to read spikes, which is done by using it as an input argument of a TF, the datapack contains all spike events that occurred in the EDLUT simulation during the last timestep. The "spikes_time" attribute of the datapack stores an array of spike times, while the "neuron_indexes" attribute contains an array with the indexes of the neurons that produced the spikes. On the other hand, when the "spikes_datapack" is used to inject spikes into the simulated neural network, typically when it is returned from a TF, the "spikes_time" and "neuron_indexes" attributes must be used to precisely specify which neurons should spike and when the spike events should occur. It is important to note that the "spikes_time" values must be expressed in the global simulation timeframe, rather than being relative to the current simulation time. To achieve the desired behavior, the current simulation time and the length of the Engine timestep must be considered and taken into account when computing the values of the "spikes_time" array. Similarly, the "currents_datapack" can be used to inject currents into the simulated neural network. In this case, there are also "spikes_time" and "neuron_indexes" attributes in the datapack, which still indicate which neurons should spike and when the event should occur. However, there is an additional attribute,"current_values", which specifies the amplitude of the spike, behaving the latter as a current. .. _doxid-edlut_engine_1edlut_engine_datapacks: EDLUT Datapacks ~~~~~~~~~~~~~~~ This gRPC implementation uses :ref:`Protobuf DataPacks `. Below is shown the protobuf message definition used by the EDLUT Engine: .. ref-code-block:: cpp syntax = "proto3"; package EdlutData; /* * Data coming from edlut datapack */ message Spikes { repeated float spikes_time = 5; repeated uint32 neuron_indexes = 6; } /* * Data input to edlut through currents_datapack */ message Currents { repeated float spikes_time = 5; repeated uint32 neuron_indexes = 6; repeated float current_values = 7; } ============== ===================== ========================== ================== Attribute Description Python Type C type ============== ===================== ========================== ================== spikes_time Spikes Firing Time numpy.array(numpy.float32) std::array neuron_indexes Neuron Indexes Firing numpy.array(numpy.uint32) std::array ============== ===================== ========================== ================== ============== ===================== ========================== ================== Attribute Description Python Type C type ============== ===================== ========================== ================== time Simulation Time float float spikes_time Spikes Firing Time numpy.array(numpy.float32) std::array neuron_indexes Neuron Indexes Firing numpy.array(numpy.uint32) std::array current_values Current Values numpy.array(numpy.float32) std::array ============== ===================== ========================== ================== Each of these attributes can be accessed under their respective names from the *data* attribute of both Edlut Datapack types. .. _doxid-edlut_engine_1engine_edlut_config_section: Engine Configuration Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This Engine type parameters are defined in EDLUT schema (listed :ref:`here `), which in turn is based on :ref:`EngineBase ` and :ref:`EngineGRPC ` schemas and thus inherits all parameters from them. To use this engine in an experiment, set ``EngineType`` to **"edlut_grpc_engine"**. * Parameters inherited from :ref:`EngineBase ` schema: ===================== =================================================================================================================================================== ====== ========================== ======== ===== Name Description Type Default Required Array ===================== =================================================================================================================================================== ====== ========================== ======== ===== EngineName Name of the engine string X EngineType Engine type. Used by string X EngineProcCmd Engine Process Launch command string EngineProcStartParams Engine Process Start Parameters string [] X EngineEnvParams Engine Process Environment Parameters string [] X EngineLaunchCommand object {"LaunchType":"BasicFork"} EngineTimestep Engine Timestep in seconds number 0.01 EngineCommandTimeout Engine Timeout (in seconds). It tells how long to wait for the completion of the engine runStep. 0 or negative values are interpreted as no timeout number 0.0 ===================== =================================================================================================================================================== ====== ========================== ======== ===== * Parameters inherited from the :ref:`EngineGRPC ` schema: ============= =============================================================================================== ====== ============== ======== ===== Name Description Type Default Required Array ============= =============================================================================================== ====== ============== ======== ===== ServerAddress gRPC Server address. Should this address already be in use, simulation initialization will fail string localhost:9004 ============= =============================================================================================== ====== ============== ======== ===== * Parameters specific to this engine type: ================= =============================================================================================== ======= ======= ======== ===== Name Description Type Default Required Array ================= =============================================================================================== ======= ======= ======== ===== NetworkFile Path to the storage of file with the architecture of the network string X WeightsFile Path to the storage of file containing initial weights of neurons string X NumThreads Number of threads used for parallel computing integer 1 SensorialDelay Sensorial delay needed by EDLUT to compensate delays in communication and compute future spikes float 0.00 SaveWeightsPeriod Period of time to save synaptic weights in a file float 0.00 ================= =============================================================================================== ======= ======= ======== ===== .. _doxid-edlut_engine_1engine_edlut_schema: Schema ~~~~~~ As explained above, the schema used by the EDLUT engine inherits from :ref:`EngineBase ` and :ref:`EngineGRPC ` schemas. A complete schema for the configuration of this engine is given below: .. ref-code-block:: cpp { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Edlut Grpc Engine", "description": "Edlut Grpc Engine configuration schema.", "$id": "#EdlutGRPCEngine", "allOf": [ { "$ref": "json://nrp-core/engines/engine_comm_protocols.json#/engine_grpc" }, { "properties": { "EngineType": { "enum": ["edlut_grpc_engine"] }, "ProtobufPackages": { "default": ["EdlutData"]}, "NetworkFile": { "type": "string", "description": "Path to Edlut Network configuration file" }, "WeightsFile": { "type": "string", "description": "Path to Neuron Weights file" }, "NumThreads": { "type": "integer", "default": 1, "description": "Number of threads to use if available" }, "SensorialDelay": { "type": "number", "default": 0.00, "description": "Sensorial delay used to compute future spikes" }, "SaveWeightsPeriod": { "type": "number", "default" : 0.00, "description": "Period of time to save synaptic weights in a file" } }, "required": ["NetworkFile", "WeightsFile"] } ] }