inducer / inducer/pyopencl

Arithmetic overflow when passing large integer range to RNG

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
247
Avg merge
7h 2m
Merged PRs (30d)
6

Description

Running [this snippet](https://gist.github.com/mattwala/f131a2587f5ed597c2fde2cac998c0d3) results in the following error:

File "test.py", line 11, in
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 "", 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.