# for hicann in p.hicann: # if hicann not in hicanns_in_use: # continue # _BSS_set_hicann_sthal_params(wafer, hicann, 1023) for hicann in hicanns_in_use: print("\n\n\n\n") print(wafer, hicann) _BSS_set_hicann_sthal_params(wafer, hicann, 1023) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = pysthal.ParallelHICANNv4Configurator() set_digital_weights(start_w, projs, n_input, n_mid * n_per_mid, runtime, digital_w=15) sim.run(duration) in_spikes = [p.getSpikes() for p in in_pops] spikes = [p.getSpikes() for p in mid_pops] for s in in_spikes: print(len(s)) for popid, s in enumerate(spikes): print(popid, len(s)) # print(s)
import Coordinate as C import pysthal # configure logging pylogging.reset() pylogging.default_config(level=pylogging.LogLevel.INFO, fname="logfile.txt", dual=False) # Mapping config marocco = PyMarocco() marocco.backend = PyMarocco.ESS # choose Executable System Specification instead of real hardware marocco.calib_backend = PyMarocco.CalibBackend.Default marocco.defects.backend = Defects.Backend.None marocco.neuron_placement.skip_hicanns_without_neuron_blacklisting(False) marocco.hicann_configurator = pysthal.HICANNConfigurator() marocco.experiment_time_offset = 5.e-7 # can be low for ESS, as no repeater locking required marocco.neuron_placement.default_neuron_size(4) # default number of hardware neuron circuits per pyNN neuron marocco.persist = "nmpm1_adex_neuron_ess.bin" marocco.param_trafo.use_big_capacitors = False # set-up the simulator pynn.setup(marocco=marocco) neuron_count = 1 # size of the Population we will create # Set the neuron model class neuron_model = pynn.EIF_cond_exp_isfa_ista # an Adaptive Exponential I&F Neuron neuron_parameters = { 'a' : 4.0, # adaptation variable a in nS
from pymarocco import PyMarocco, Defects import pylogging import pysthal # configure logging pylogging.reset() pylogging.default_config(level=pylogging.LogLevel.INFO, fname="logfile.txt", dual=False) # Mapping config marocco = PyMarocco() marocco.backend = PyMarocco.ESS # choose Executable System Specification instead of real hardware marocco.calib_backend = PyMarocco.CalibBackend.Default marocco.defects.backend = Defects.Backend.None marocco.hicann_configurator = pysthal.HICANNConfigurator() marocco.experiment_time_offset = 5.e-7 # can be low for ESS, as no repeater locking required marocco.neuron_placement.default_neuron_size( 4) # default number of hardware neuron circuits per pyNN neuron marocco.persist = "nmpm1_adex_neuron_ess.bin" marocco.param_trafo.use_big_capacitors = False # set-up the simulator pynn.setup(marocco=marocco) neuron_count = 1 # size of the Population we will create # Set the neuron model class neuron_model = pynn.EIF_cond_exp_isfa_ista # an Adaptive Exponential I&F Neuron neuron_parameters = {
for driver in C.iter_all(C.SynapseDriverOnHICANN): for row in C.iter_all(C.RowOnSynapseDriver): wafer[hicann].synapses[driver][row].set_gmax_div( C.left, gmax_div) wafer[hicann].synapses[driver][row].set_gmax_div( C.right, gmax_div) set_sthal_params(runtime.wafer(), gmax=1023, gmax_div=1) # ——— configure hardware —————————————————————————————————————————————————————— marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = PyMarocco.HICANNv4Configurator for digital_weight in [5, 10, 15]: logger.info("running measurement with digital weight {}".format(digital_weight)) for proj in projections: proj_item, = runtime.results().synapse_routing.synapses().find(proj) synapse = proj_item.hardware_synapse() proxy = runtime.wafer()[synapse.toHICANNOnWafer()].synapses[synapse] proxy.weight = HICANN.SynapseWeight(digital_weight) pynn.run(duration) np.savetxt("membrane_w{}.txt".format(digital_weight), pop.get_v()) np.savetxt("spikes_w{}.txt".format(digital_weight), pop.getSpikes()) pynn.reset()
# call at least once set_sthal_params(runtime.wafer(), gmax=1023, gmax_div=1) # ——— configure hardware —————————————————————————————————————————————————————— for proj in projections: proj_item, = runtime.results().synapse_routing.synapses().find(proj) synapse = proj_item.hardware_synapse() proxy = runtime.wafer()[synapse.toHICANNOnWafer()].synapses[synapse] proxy.weight = HICANN.SynapseWeight(15) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = pysthal.ParallelHICANNv4Configurator() fgs = runtime.wafer()[hicann].floating_gates calibrated_E_l_DACs = {} for neuron in pop: for item in runtime.results().placement.find(neuron): for denmem in item.logical_neuron(): calibrated_E_l_DACs[denmem] = fgs.getNeuron(denmem, HICANN.E_l) for n, delta_E_l_DAC in enumerate([-200, -100, 0, 100, 200]): for denmem, original_E_l in calibrated_E_l_DACs.iteritems(): E_l_DAC = min(max(0, original_E_l + delta_E_l_DAC), 1023) logger.info("running measurement with E_l {} DAC for {}".format(
# call at least once set_sthal_params(runtime.wafer(), gmax=1023, gmax_div=1) # ——— configure hardware —————————————————————————————————————————————————————— for proj in projections: proj_item, = runtime.results().synapse_routing.synapses().find(proj) synapse = proj_item.hardware_synapse() proxy = runtime.wafer()[synapse.toHICANNOnWafer()].synapses[synapse] proxy.weight = HICANN.SynapseWeight(15) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = pysthal.ParallelHICANNv4Configurator() for n, spike_times in enumerate([[100,110], [200,210], [300,310]]): runtime.results().spike_times.set(stimulus_neuron, spike_times) pynn.run(duration) np.savetxt("membrane_n{}.txt".format(n), pop.get_v()) np.savetxt("spikes_n{}.txt".format(n), pop.getSpikes()) pynn.reset() # only change digital parameters from now on marocco.hicann_configurator = pysthal.NoResetNoFGConfigurator() # skip checks marocco.verification = PyMarocco.Skip
import pylogging import Coordinate as C # configure logging pylogging.reset() pylogging.default_config(level=pylogging.LogLevel.INFO, fname="logfile.txt", dual=False) # Mapping config marocco = PyMarocco() marocco.backend = PyMarocco.ESS # choose Executable System Specification instead of real hardware marocco.calib_backend = PyMarocco.CalibBackend.Default marocco.defects.backend = Defects.Backend.None marocco.neuron_placement.skip_hicanns_without_neuron_blacklisting(False) marocco.hicann_configurator = PyMarocco.HICANNConfigurator marocco.experiment_time_offset = 5.e-7 # can be low for ESS, as no repeater locking required marocco.neuron_placement.default_neuron_size( 4) # default number of hardware neuron circuits per pyNN neuron marocco.persist = "nmpm1_adex_neuron_ess.bin" marocco.param_trafo.use_big_capacitors = False # set-up the simulator pynn.setup(marocco=marocco) neuron_count = 1 # size of the Population we will create # Set the neuron model class neuron_model = pynn.EIF_cond_exp_isfa_ista # an Adaptive Exponential I&F Neuron neuron_parameters = {
# call at least once set_sthal_params(runtime.wafer(), gmax=1023, gmax_div=1) # ——— configure hardware —————————————————————————————————————————————————————— for proj in projections: proj_item, = runtime.results().synapse_routing.synapses().find(proj) synapse = proj_item.hardware_synapse() proxy = runtime.wafer()[synapse.toHICANNOnWafer()].synapses[synapse] proxy.weight = HICANN.SynapseWeight(15) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = PyMarocco.ParallelHICANNv4Configurator fgs = runtime.wafer()[hicann].floating_gates calibrated_E_l_DACs = {} for neuron in pop: for item in runtime.results().placement.find(neuron): for denmem in item.logical_neuron(): calibrated_E_l_DACs[denmem] = fgs.getNeuron(denmem, HICANN.E_l) for n, delta_E_l_DAC in enumerate([-200, -100, 0, 100, 200]): for denmem, original_E_l in calibrated_E_l_DACs.iteritems(): E_l_DAC = min(max(0, original_E_l + delta_E_l_DAC), 1023) logger.info("running measurement with E_l {} DAC for {}".format(
projections = [ pynn.Projection(stimulus_exc, pop, connector, target='excitatory'), pynn.Projection(stimulus_inh, pop, connector, target='inhibitory'), ] # ——— run mapping ————————————————————————————————————————————————————————————— # fill results marocco.skip_mapping = False marocco.backend = PyMarocco.None pynn.run(0) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware marocco.verification = PyMarocco.Skip for n, neuron in enumerate(pop): item = runtime.results().placement.find(neuron)[0] logical_neuron = item.logical_neuron() runtime.results().analog_outputs.record(logical_neuron) pynn.run(duration) np.savetxt("membrane_n{}.txt".format(n), pop.get_v()) np.savetxt("spikes_n{}.txt".format(n), pop.getSpikes()) pynn.reset() runtime.results().analog_outputs.unrecord(logical_neuron) marocco.hicann_configurator = pysthal.OnlyNeuronNoResetNoFGConfigurator()
# call at least once set_sthal_params(runtime.wafer(), gmax=1023, gmax_div=1) # ——— configure hardware —————————————————————————————————————————————————————— for proj in projections: proj_item, = runtime.results().synapse_routing.synapses().find(proj) synapse = proj_item.hardware_synapse() proxy = runtime.wafer()[synapse.toHICANNOnWafer()].synapses[synapse] proxy.weight = HICANN.SynapseWeight(15) marocco.skip_mapping = True marocco.backend = PyMarocco.Hardware # Full configuration during first step marocco.hicann_configurator = pysthal.ParallelHICANNv4Configurator() fgs = runtime.wafer()[hicann].floating_gates calibrated_E_l_DACs = {} for neuron in pop: for item in runtime.results().placement.find(neuron): for denmem in item.logical_neuron(): calibrated_E_l_DACs[denmem] = fgs.getNeuron(denmem, HICANN.E_l) for n, delta_E_l_DAC in enumerate([-200,-100,0,100,200]): for denmem, original_E_l in calibrated_E_l_DACs.iteritems(): E_l_DAC = min(max(0, original_E_l + delta_E_l_DAC), 1023) logger.info("running measurement with E_l {} DAC for {}".format(E_l_DAC, denmem))