pyopencl
pyopencl copied to clipboard
Arithmetic overflow when passing large integer range to RNG
Running this snippet results in the following error:
File "test.py", line 11, in <module>
rand(q, shape=(), a=np.iinfo(dt).min, b=np.iinfo(dt).max, dtype=dt)
File "/home/matt/src/pyopencl/pyopencl/clrandom.py", line 741, in rand
gen.fill_uniform(result, a=a, b=b))
File "/home/matt/src/pyopencl/pyopencl/clrandom.py", line 651, in fill_uniform
scale=(b-a), shift=a, queue=queue)
File "/home/matt/src/pyopencl/pyopencl/clrandom.py", line 638, in _fill
evt = knl(queue, gsize, lsize, *args)
File "/home/matt/src/pyopencl/pyopencl/cffi_cl.py", line 1964, in __call__
return self._enqueue(self, queue, global_size, local_size, *args, **kwargs)
File "<generated function enqueue_knl_generate>", line 81, in enqueue_knl_generate
struct.error: 'i' format requires -2147483648 <= number <= 2147483647
This is probably due to the fact that b-a
is out of range.