hzxie/GRNet

Error in gridding_cuda_forward: invalid device function

Closed this issue · 9 comments

hello sir,
I just test the function gridding, but failed runing:

environment: pytorch 1.5.1, cuda 10.1, gcc 5.4, python 3.6.9

code:

gridding = Gridding(scale=64)
train_on_gpu = torch.cuda.is_available()
device = torch.device("cuda:0" if train_on_gpu else "cpu")
gridding = gridding.to(device)

partial_cloud = data['partial_cloud']                      # 2048, 3
partial_cloud = partial_cloud.unsqueeze(0)           # 1, 2048, 3
pt_features_64_l = gridding(partial_cloud).view(-1, 1, 64, 64, 64)

Error:
Error in gridding_cuda_forward: invalid device function

hzxie commented

So, you are using CPU? What's the value of train_on_gpu?
Gridding is only implemented in CUDA.

No, I'm using GPU, (confirmed)

train_on_gpu is True, device is cuda:0

first, I compiled gridding:
cd extensions/gridding python setup.py install --user
I got some information:
`
...

XX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

...

**/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(14): warning: integer conversion resulted in a change of sign

...

**/lib/python3.6/site-packages/torch/include/torch/csrc/autograd/profiler.h(100): warning: attribute "visibility" does not apply here

...

**/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/enum.h(187): warning: statement is unreachable

...

**/lib/python3.6/site-packages/gridding-2.1.0-py3.6-linux-x86_64.egg
Processing dependencies for gridding==2.1.0
Finished processing dependencies for gridding==2.1.0
`

after compiled, I tested gridding function by the above code,

The data of partial_cloud and function of gridding are all to GPU. .to(device)

but failed in pt_features_64_l = gridding(partial_cloud).view(-1, 1, 64, 64, 64)

hzxie commented

How about your config.py?

How about your config.py?

I only changed the following parameters

__C.DATASETS.KITTI.PARTIAL_POINTS_PATH           = './datasets/kitti/cars/%s.pcd'
__C.DATASETS.KITTI.BOUNDING_BOX_FILE_PATH        = './datasets/kitti/bboxes/%s.txt'


__C.CONST.NUM_WORKERS                            = 1
hzxie commented

Maybe you should remove

gridding = gridding.to(device)

eh... unuseful

ok, that's all. I tested it successfully with another computer

I meet the same bug. Could you tell the version of your pytorch, cuda? @HeConnor

I hope this could help you ! @beibeirory

torch 1.3.0, cuda 10.1

thanks very much. It also works with torch 1.5.1, cuda 10.2. @HeConnor