Changeset 1103

Show
Ignore:
Timestamp:
03/22/12 00:07:45 (14 months ago)
Author:
pierre
Message:

Use the PoissonSource? with spikes generated by the GPU, should be more efficient. Trying to make Nemo backend as fast as possible for further benchmarks

Location:
trunk/src/nemo
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/nemo/__init__.py

    r1102 r1103  
    125125            cell.parent = self 
    126126        if isinstance(celltype, SpikeSourcePoisson):     
    127             simulator.spikes_array_list += self.all_cells.tolist() 
    128             params['precision'] = simulator.state.dt 
    129             ntype = simulator.state.net.add_neuron_type('Input') 
    130             for idx in self.all_cells: 
    131                 player = SpikeSourcePoisson.spike_player(**params) 
    132                 setattr(idx, 'player', player)                 
    133             simulator.state.net.add_neuron(ntype, list(self.all_cells)) 
     127            ntype = simulator.state.net.add_neuron_type('PoissonSource') 
     128            simulator.state.net.add_neuron(ntype, list(self.all_cells), [params['rate']]*n) 
    134129        elif isinstance(celltype, SpikeSourceArray): 
    135             ### For the moment, we model spike_source_array and spike_source_poisson 
    136             ### as hyperpolarized neurons that are forced to fire, but this could be 
    137             ### enhanced. A local copy of these devices is kept on the CPU, to send the 
     130            ### For the moment, we model spike_source_array as neurons that are forced to fire,  
     131            ### but this could be enhanced. A local copy of these devices is kept on the CPU, to send the 
    138132            ### spikes 
    139133            simulator.spikes_array_list += self.all_cells.tolist() 
    140134            params['precision'] = simulator.state.dt 
    141             ntype = simulator.state.net.add_neuron_type('Input') 
     135            ntype = simulator.state.net.add_neuron_type('Input') 
    142136            for idx in self.all_cells: 
    143137                player = SpikeSourceArray.spike_player(**params) 
     
    146140        elif isinstance(celltype, cells.IF_curr_exp): 
    147141            init = celltype.default_initial_values 
    148             ntype = simulator.state.net.add_neuron_type('IF_curr_exp')    
     142            ntype = simulator.state.net.add_neuron_type('IF_curr_exp')    
    149143            simulator.state.net.add_neuron(ntype, list(self.all_cells), 
    150144                        [params['v_rest']]*n, 
     
    158152                        [params['i_offset']]*n,                         
    159153                        [init['v']]*n, [0.]*n, [0.]*n, [1000.]*n) 
    160         else:             
     154        elif isinstance(celltype, cells.Izikevich):             
    161155            init  = celltype.default_initial_values 
    162156            ntype = simulator.state.net.add_neuron_type('Izhikevich') 
  • trunk/src/nemo/simulator.py

    r1099 r1103  
    144144        if isinstance(self.celltype, SpikeSourceArray): 
    145145            return {'spike_times' : self.player.spike_times} 
    146         elif isinstance(self.celltype, SpikeSourcePoisson): 
    147             return {'rate' : self.player.rate, 'duration' : self.player.duration,  
    148                     'start' : self.player.start} 
    149146        else: 
    150147            params = {} 
     
    160157            parameters['precision'] = state.dt 
    161158            self.player.reset(**parameters) 
    162         elif isinstance(self.celltype, SpikeSourcePoisson): 
    163             parameters['precision'] = state.dt 
    164             self.player.reset(**parameters)     
    165159        else: 
    166160            indices = self.celltype.indices