neurokernel.core.Module

class neurokernel.core.Module(sel, sel_in, sel_out, sel_gpot, sel_spike, data_gpot, data_spike, columns=['interface', 'io', 'type'], ctrl_tag=1, gpot_tag=2, spike_tag=3, id=None, device=None, routing_table=None, rank_to_id=None, debug=False, time_sync=False)[source]

Processing module.

This class repeatedly executes a work method until it receives a quit message via its control network port.

Parameters:
  • sel (str, unicode, or sequence) – Path-like selector describing the module’s interface of exposed ports.
  • sel_out, sel_gpot, sel_spike (sel_in,) – Selectors respectively describing all input, output, graded potential, and spiking ports in the module’s interface.
  • data_spike (data_gpot,) – Data arrays associated with the graded potential and spiking ports in the . Array length must equal the number of ports in a module’s interface.
  • columns (list of str) – Interface port attributes. Network port for controlling the module instance.
  • gpot_tag, spike_tag (ctrl_tag,) – MPI tags that respectively identify messages containing control data, graded potential port values, and spiking port values transmitted to worker nodes.
  • id (str) – Module identifier. If no identifier is specified, a unique identifier is automatically generated.
  • device (int) – GPU device to use. May be set to None if the module does not perform GPU processing.
  • routing_table (neurokernel.routing_table.RoutingTable) – Routing table describing data connections between modules. If no routing table is specified, the module will be executed in isolation.
  • rank_to_id (bidict.bidict) – Mapping between MPI ranks and module object IDs.
  • debug (bool) – Debug flag. When True, exceptions raised during the work method are not be suppressed.
  • time_sync (bool) – Time synchronization flag. When True, debug messages are not emitted during module synchronization and the time taken to receive all incoming data is computed.
interface

Interface – Object containing information about a module’s ports.

pm

dictpm[‘gpot’] and pm[‘spike’] are instances of neurokernel.pm.PortMapper that map a module’s ports to the contents of the values in data.

data

dictdata[‘gpot’] and data[‘spike’] are arrays of data associated with a module’s graded potential and spiking ports.

__init__(sel, sel_in, sel_out, sel_gpot, sel_spike, data_gpot, data_spike, columns=['interface', 'io', 'type'], ctrl_tag=1, gpot_tag=2, spike_tag=3, id=None, device=None, routing_table=None, rank_to_id=None, debug=False, time_sync=False)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__(sel, sel_in, sel_out, sel_gpot, …) x.__init__(…) initializes x; see help(type(x)) for signature
do_work() Work method.
post_run() Code to run after main loop.
pre_run() Code to run before main loop.
recv_parent([tag]) Receive data from parent process.
recv_peer([source, tag])
run() Body of process.
run_step() Module work method.
send_parent(data[, tag]) Send data to parent process.
send_peer(data, dest[, tag]) Send data to peer process.

Attributes

intercomm Intercommunicator to access parent process.
intracomm Intracommunicator to access peer processes.
log_on Logger switch.
max_steps Maximum number of steps to execute.
rank MPI process rank.
size Number of peer processes.