torchinterp1d icon indicating copy to clipboard operation
torchinterp1d copied to clipboard

CUDA error: an illegal memory access was encountered when >1023 interpolations

Open stefangroha opened this issue 4 years ago • 0 comments

Example:

x = torch.tensor([0.2,0.3,0.4,0.5],device=device).float()
y = torch.tensor(np.exp([0.2,0.3,0.4,0.5]),device=device).float()

for i in range(1024):
    Interp1d()(x, y, torch.tensor([0.2,0.3,1.],device=device))

After iteration 1023 I get the following error message:

/opt/conda/lib/python3.7/site-packages/torchinterp1d/interp1d.py in forward(ctx, x, y, xnew, out)
    113         # must be inserted to preserve order. And we want the index of the
    114         # preceeding value.
--> 115         ind -= 1
    116         # we clamp the index, because the number of intervals is x.shape-1,
    117         # and the left neighbour should hence be at most number of intervals

RuntimeError: CUDA error: an illegal memory access was encountered

Thank you for the package and your time!

stefangroha avatar Jun 01 '20 16:06 stefangroha