Closed FrancescoMandru closed 3 years ago
From the readme of spconv (https://github.com/traveller59/spconv), it seems that spconv requires cuda library to perform the cuda hash implementation.
In fact, I do not have a try on CPU only.
Hi @xinge008, I tought it was an option to enjoy the speed up the GPU but not a necessary requirement. Usually modules work also in CPU but they are much slower. To prove this you can use a simple example with a fake dataset and it perfectly works. So no, I don't think that Spconv works only in GPU mode, I think that the problem comes from the fact that we are passinga data structure which is not suitable for this module. train_pt_fea_ten
and train_grid_ten
are two list and for sure they don't have a device parameter.
My only aim is to understand in detail how to prepare the input data point cloud for spconv modules and I'm struggling on this thing but honestly I'm surrending to solve this task.
Hi @FrancescoMandru,
The whole codebase is actually able to work in CPU, but, as you imagine, it takes a tremendous amount of time to even pass one epoch (126 hours in my case 😄 ).
To be able to work in the CPU, you should install all the dependencies in CPU mode. In this case, torch and torch-scatter can be installed easily. On the other hand, spconv can also be installed for CPU; it automatically detects your system information and shapes its build procedure according to that.
Additionally, you need to specify your CPU as the main device in the code. To do that, you should change the following line:
pytorch_device = torch.device('cuda:0')
as it is:
pytorch_device = torch.device("cpu")
Also, in cylinder_fea_generator.py file, you should change the line:
shuffled_ind = torch.randperm(pt_num, device=cur_dev)
as it is:
shuffled_ind = torch.randperm(pt_num)
After all of this, you should be able to run the code in CPU.
I'm building a small network following your code which is the following:
where TestModel is built as follows:
However when I try to test this code I get a strange error from spconv module:
Anyway I think that is related with the input data format. I need to built a network with only these modules, in particolar looking at the forward module function of spconv: