Hi!
I am currently implementing a custom kernel in numba that at some point performs n
increments on a local/register variable. However, the kernel produces a segmentation fault when I specify the number of increments as an argument, instead of at compile time. A minimal working example:
from numba import cuda
import numpy as np
from numba import cuda
@cuda.jit(debug=True)
def f(b, n):
result = 0
for i in range(n):
result += b
f[1, 1](1, 2)
Alternatively, changing the increment to a reassignment: result = b
works fine too.
I am reasonably new to numba, so I could be missing something dramatically obvious, but the behaviour feels a bit odd: either specifying n
at compile time, or changing the update to a reassignment produces no issues.
It is a pretty basic problem, so I imagine it’s my understanding that is failing here. Any comments on why this produces a segmentation fault are appreciated!