PyTorch👩🏻💻
[PyTorch] Multi-GPU 사용하기 (torch.distributed.launch)
당니이
2022. 6. 10. 21:08
반응형
PyTorch 환경에서 train 할 때, CUDA OOM(Out Of Memory) 에러 때문에 여러개의 gpu로 동시에 병렬적으로 train 하고싶을 때가 있다. 이때는 torch.distributed.launch 를 사용하면 되는데 이는 다음과 같다.
$ python -m torch.distributed.launch --nproc_per_node=2 train.py --launcher pytorch
참고로 위에서 --launcher는 내가 사용하는 code의 argments 중 하나이다!
반응형