rusty1s / pytorch_cluster

PyTorch Extension Library of Optimized Graph Cluster Algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite loop in torch_cluster.graclus_cluster on empty inputs?

ssrothman opened this issue · comments

When calling graclus_cluster(row, col, weight, numnodes) on empty input, the call hangs. In particular by "empty inputs" I mean inputs like: row=torch.Tensor([]), col=torch.Tensor([]), weight=torch.Tensor([]), numnodes=some positive integer. While the call is hanging nvidia-smi still shows substantial GPU utilization, suggesting to me that there is some unintended infinite loop running on the GPU in this case. This is probably not a super important edge case (I was only calling the function with empty inputs due to a bug in my data handling which has since been fixed), but I thought it was worth notifying the developers, as I assume this is not the intended failure mode.

My environment is:

mamba list | grep torch
ffmpeg                    4.3                  hf484d3e_0    pytorch
pyg                       2.2.0           py38_torch_1.13.0_cu116    pyg
pytorch                   1.13.1          py3.8_cuda11.6_cudnn8.3.2_0    pytorch
pytorch-cluster           1.6.0           py38_torch_1.13.0_cu116    pyg
pytorch-cuda              11.6                 h867d48c_1    pytorch
pytorch-mutex             1.0                        cuda    pytorch
pytorch-scatter           2.1.0           py38_torch_1.13.0_cu116    pyg
pytorch-sparse            0.6.15          py38_torch_1.13.0_cu116    pyg
torchaudio                0.13.1               py38_cu116    pytorch
torchvision               0.14.1               py38_cu116    pytorch

Thanks for reporting. Indeed, currently graclus_cluster assumes a well-defined graph. We could probably error out early in this we see empty inputs.