def launch(self, duration, stepsize=1 * second): if stepsize is None: self.kernel_func(int32(0), int32(duration / self.dt), *self.kernel_func_args, **self.kernel_func_kwds) pycuda.context.synchronize() else: stepsize = int(stepsize / self.dt) duration = int(duration / self.dt) for Tstart in xrange(0, duration, stepsize): Tend = Tstart + min(stepsize, duration - Tstart) self.kernel_func(int32(Tstart), int32(Tend), int32(duration), *self.kernel_func_args, **self.kernel_func_kwds) pycuda.context.synchronize()
def initialize_kernel_arguments(self): self.kernel_func_args = [ self.statevars_arr, self.I, self.I_offset, self.spikedelay_arr, self.refractory_arr, self.next_allowed_spiketime_arr ] self.kernel_func_args += self.criterion.get_kernel_arguments() if self.criterion.type == 'spikes': self.kernel_func_args += [self.spiketimes, self.spiketime_indices] if self.criterion.type == 'traces': self.kernel_func_args += [self.traces, self.traces_offset] if self.statemonitor_var is not None: self.kernel_func_args += [ self.statemonitor_values, self.statemonitor_offsets ] self.kernel_func_args += [int32(rint(self.onset / self.dt))]
def initialize_kernel_arguments(self): self.kernel_func_args = [self.statevars_arr, self.I, self.I_offset, self.spikedelay_arr, self.refractory_arr, self.next_allowed_spiketime_arr] self.kernel_func_args += self.criterion.get_kernel_arguments() if self.criterion.type == 'spikes': self.kernel_func_args += [self.spiketimes, self.spiketime_indices] if self.criterion.type == 'traces': self.kernel_func_args += [self.traces, self.traces_offset] if self.statemonitor_var is not None: self.kernel_func_args += [self.statemonitor_values, self.statemonitor_offsets] self.kernel_func_args += [int32(rint(self.onset / self.dt))]