NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.49k stars 368 forks source link

Cannot use cuda:1 as device for MinkowskiEngine #535

Open taochenshh opened 1 year ago

taochenshh commented 1 year ago

It seems that I cannot set device to 'cuda:1' for using MinkowskiEngine.

For example, I changed the device to cuda:1 in this line in the indoor.py example. However, the line of in_field.sparse() gives error as follows:

Traceback (most recent call last):
  File "indoor.py", line 150, in <module>
    sinput = in_field.sparse()
  File "/home/xyz/software/anaconda3/envs/mnmn/lib/python3.8/site-packages/MinkowskiEngine/MinkowskiTensorField.py", line 351, in sparse
    features = MinkowskiSPMMAverageFunction().apply(
  File "/home/xyz/software/anaconda3/envs/mnmn/lib/python3.8/site-packages/torch/autograd/function.py", line 506, in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
  File "/home/xyz/software/anaconda3/envs/mnmn/lib/python3.8/site-packages/MinkowskiEngine/sparse_matrix_functions.py", line 183, in forward
    result, COO, vals = spmm_average(
  File "/home/xyz/software/anaconda3/envs/mnmn/lib/python3.8/site-packages/MinkowskiEngine/sparse_matrix_functions.py", line 93, in spmm_average
    result, COO, vals = MEB.coo_spmm_average_int32(
RuntimeError: /tmp/pip-req-build-ykc_0_ql/src/spmm.cu:418, assertion (at::cuda::check_device({rows, cols, mat2})) failed. All inputs must be on the same device.

Can you help take a look? @chrischoy thanks!

EvgenyUgolkov commented 5 months ago

@taochenshh Hello! I faced the same issue. Could you tell, was you able to solve it?