Ejemplo n.º 1
0
    def __init__(self, filename):
        Pattern.__init__(self, filename)

        if self.n&1023 != 0:
            raise ValueError('Number of patterns must be a multiple of 1024.')

        self.patterns_gpu = cuda.mem_alloc(self.patterns.nbytes)
        cuda.memcpy_htod(self.patterns_gpu, self.patterns)

        self.input_gpu = cuda.mem_alloc(4*((40*8)+16))
        self.result_gpu = gpuarray.empty((40,self.n), dtype=numpy.float32, allocator=cuda.mem_alloc)
Ejemplo n.º 2
0
    def __init__(self, config, config_global):
        """Init pattern."""
        self.config_defaults = {
            'xxx': 0,
            "list": [
                [
                    1,
                    -1,
                    -1,
                    -1,
                    -1,
                    1,
                    -1,
                    -1,
                    -1,
                    -1,
                    1,
                    -1,
                    -1,
                    -1,
                    -1,
                    1
                ],
                [
                    0,
                    -1,
                    -1,
                    -1,
                    -1,
                    0,
                    -1,
                    -1,
                    -1,
                    -1,
                    0,
                    -1,
                    -1,
                    -1,
                    -1,
                    0
                ]
            ],
        }
        # python3 syntax
        # super().__init__()
        # python2 syntax
        # super(Pattern, self).__init__()
        # explicit call
        Pattern.__init__(self, config, config_global)

        # inits for this pattern
        self.strobe_state = False
Ejemplo n.º 3
0
 def __init__(self, pattern=None, pattern_file=None):
     Pattern.__init__(self,
                      pattern,
                      pattern_file,
                      aliases=GitPattern.ALIASES)