question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashes on inputs with numel == 0

See original GitHub issue

Hi, thanks so much for providing this package–it’s very useful. I am running torch 1.0.1.post2 on Ubuntu 16.04 with NVIDIA Quadro P4000 and with torch_scatter installed recently via pip. Please see my minimum working example below which demonstrates what I feel is a bug. Notice that num_vals == 0.

import torch
from torch_scatter import scatter_mean, scatter_max

num_vals = 0
m, n, k = 4, 5, 6

src = torch.zeros((m, n, num_vals)).cuda()
index = torch.zeros((m, n, num_vals)).long().cuda()
kwargs = dict(src=src, index=index, dim=2, dim_size=k)

for _ in range(2):
    out = scatter_mean(**kwargs)
    
for _ in range(2):
    out, argmax = scatter_max(**kwargs)
  • scatter_mean, which I understand is mostly just a wrapper for torch.scatter_add_, handles the tensor.numel() == 0 case gracefully.

  • But scatter_max fails with RuntimeError: cuda runtime error (9) : invalid configuration argument at /.../aten/src/THC/generic/THCTensorMath.cu:14.

I guess the culprit is #define BLOCKS(N) (N + THREADS - 1) / THREADS in scatter_kernel.cu which doesn’t work so well for N == 0.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
rusty1scommented, Apr 12, 2019

Fixed in master 😃

0reactions
rusty1scommented, Apr 13, 2019

Great! Fixed in master 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Let users enter integer, warn them if they enter anything else
From the documentation of input: "The response to the input prompt can be any MATLAB expression, which is evaluated using the variables in...
Read more >
unexpected crash when overloading subsasgn
It seems that Matlab crashes after the call to numel.m but before it enters the overloaded subasgn.m. ... [obj.field(1)] = deal(0) % SEGMENTATION...
Read more >
Code debugging in MATLAB
This error occurs when you are calling a function but did not enter the correct entries. For example, the function should take 4...
Read more >
Source code for deepspeed.runtime.zero.stage3
For more details please see ZeRO: Memory Optimization Towards Training A ... 0 for tensor in tensors: tensor_numel = tensor.numel() # move the...
Read more >
Program crashes on large inputs (C) - Stack Overflow
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i, n, q = 0, k, *array2; printf("Geben Sie eine natuerliche ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found