def __init__(self, size, buffer_length, dtype=np.double, init=None): self.size = size if not isinstance(dtype, np.dtype): dtype = np.dtype(dtype) self.dtype = dtype self.buffer_length = buffer_length if init: try: init = dtype(init) self.parr = parray.ones( (buffer_length, size), dtype) * init except: self.parr = parray.zeros( (buffer_length, size), dtype) else: self.parr = parray.zeros( (buffer_length, size), dtype) self.current = 0 self.gpudata = self.parr.gpudata self.ld = self.parr.ld
def __init__(self, num_gpot_neurons, gpot_delay_steps, rest, num_spike_neurons, spike_delay_steps): self.num_gpot_neurons = num_gpot_neurons if num_gpot_neurons > 0: self.dtype = np.double self.gpot_delay_steps = gpot_delay_steps self.gpot_buffer = parray.empty((gpot_delay_steps, num_gpot_neurons),np.double) self.gpot_current = 0 for i in range(gpot_delay_steps): cuda.memcpy_dtod(int(self.gpot_buffer.gpudata) + \ self.gpot_buffer.ld * i * self.gpot_buffer.dtype.itemsize,\ rest.gpudata, rest.nbytes) self.num_spike_neurons = num_spike_neurons if num_spike_neurons > 0: self.spike_delay_steps = spike_delay_steps self.spike_buffer = parray.zeros((spike_delay_steps,num_spike_neurons),np.int32) self.spike_current = 0
def __init__(self, num_gpot_neurons, gpot_delay_steps, rest, num_spike_neurons, spike_delay_steps): self.num_gpot_neurons = num_gpot_neurons if num_gpot_neurons > 0: self.dtype = np.double self.gpot_delay_steps = gpot_delay_steps self.gpot_buffer = parray.empty( (gpot_delay_steps, num_gpot_neurons), np.double) self.gpot_current = 0 for i in range(gpot_delay_steps): cuda.memcpy_dtod( int(self.gpot_buffer.gpudata) + self.gpot_buffer.ld * i * self.gpot_buffer.dtype.itemsize, rest.gpudata, rest.nbytes) self.num_spike_neurons = num_spike_neurons if num_spike_neurons > 0: self.spike_delay_steps = spike_delay_steps self.spike_buffer = parray.zeros( (spike_delay_steps, num_spike_neurons), np.int32) self.spike_current = 0