in subprocess can't use cuda
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).
### Describe the issue
when I import open3d, subprocess can't use cuda
while without import open3d, it runs
### Steps to reproduce the bug
```python
import torch
from torch.multiprocessing import Process
import open3d # without this, cuda both available in main process and subprocess
class MyProcess(Process):
def __init__(self):
super(MyProcess, self).__init__()
def run(self):
print('subprocess:', torch.cuda.is_available())
if __name__ == '__main__':
p = MyProcess()
p.start()
print('mainprocess:', torch.cuda.is_available())
```
### Error message
mainprocess: True
/root/miniconda3/envs/dp3/lib/python3.8/site-packages/torch/cuda/__init__.py:128: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at /opt/conda/conda-bld/pytorch_1724789115405/work/c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() > 0
subprocess: False
### Expected behavior
mainprocess: True
subprocess: True
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8.20
- Open3D version: output from python: 0.18.0
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: both tried on conda & build from source
- Compiler version (if built from source): gcc 9.4.0
```
### Additional information
pytorch: 2.4.1
NVIDIA-SMI 550.107.02
Driver Version: 550.107.02
CUDA Version: 12.4
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.