-
when I tried to load cachedataset to GPU,there is an error.
errors:RuntimeError Traceback (most recent call last) /kaggle/input/monai-v081/monai/utils/misc.py in first(iterable, default) /opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py in next(self) /opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _next_data(self) /opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _process_data(self, data) /opt/conda/lib/python3.7/site-packages/torch/_utils.py in reraise(self) RuntimeError: Caught RuntimeError in DataLoader worker process 0. The above exception was the direct cause of the following exception: Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @lg2578 , As your error log shows: RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method Thanks. |
Beta Was this translation helpful? Give feedback.
Hi @lg2578 ,
As your error log shows: RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method
CUDA can't work with forked multi-processing, please set the
num_workers
of DataLoader to 0.Suggest to use
ThreadDataLoader
for this case, refer to:https://github.com/Project-MONAI/tutorials/blob/main/acceleration/distributed_training/brats_training_ddp.py#L220
Thanks.