lxxue / FRNN

Fixed Radius Nearest Neighbor Search on GPU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weird OOM in frnn_gather

yuhao opened this issue · comments

i am using 10M points and have a GPU memory of 11GB. The search works fine, but in points2_nn = frnn_gather(points2, idxs, lengths2) I got an OOM error.

Traceback (most recent call last):
  File "nd.py", line 131, in <module>
    validator.launch()
  File "nd.py", line 120, in launch
    dists_frnn, idxs_frnn, nn_frnn = self.frnn_grid()
  File "nd.py", line 74, in frnn_grid
    return_sorted=True)
  File "/home/vax10/u4/xx/venv/lib64/python3.6/site-packages/frnn-0.0.0-py3.6-linux-x86_64.egg/frnn/frnn.py", line 377, in frnn_grid_points
    points2_nn = frnn_gather(points2, idxs, lengths2)
  File "/home/vax10/u4/xx/venv/lib64/python3.6/site-packages/frnn-0.0.0-py3.6-linux-x86_64.egg/frnn/frnn.py", line 419, in frnn_gather
    tmp_idxs = idxs.clone().detach()
RuntimeError: CUDA out of memory. Tried to allocate 4.64 GiB (GPU 1; 10.76 GiB total capacity; 7.77 GiB already allocated; 1.84 GiB free; 7.80 GiB reserved in total by PyTorch)

Could you give me a minimal example to reproduce this memory error so that I can check which parts are too large? If the K or D is too large, it could be the case that a points2_nn of size (N, P, K, D) is just too large for the GPU.

Yeah, I think it is correct. My implementation should work for both GPU and CPU. So if the points, idxs, and the lengths are GPU tensors, this will result in a GPU OOM.