예제 #1
0
    def run(self):
        self._init_gpu()

        # Replace port mappers with GPUPortMapper instances:
        self.pm['gpot'] = GPUPortMapper.from_pm(self.pm['gpot'])
        self.pm['spike'] = GPUPortMapper.from_pm(self.pm['spike'])

        super(MyModule, self).run()
예제 #2
0
    def run(self):
        self._init_gpu()

        # Replace port mappers with GPUPortMapper instances:
        self.pm['gpot'] = GPUPortMapper.from_pm(self.pm['gpot'])
        self.pm['spike'] = GPUPortMapper.from_pm(self.pm['spike'])

        super(MyModule, self).run()
예제 #3
0
    def test_from_pm_nongpu(self):
        # Empty:
        pm0 = PortMapper('/foo[0:3]')
        pm1 = GPUPortMapper.from_pm(pm0)
        assert_series_equal(pm0.portmap, pm1.portmap)

        # Nonempty:
        data = np.random.rand(3)
        pm0 = PortMapper('/foo[0:3]', data)
        pm1 = GPUPortMapper.from_pm(pm0)
        assert_array_equal(pm0.data, pm1.data.get())
        assert_series_equal(pm0.portmap, pm1.portmap)