症状
DeepspeedをDockerコンテナを使ってマルチGPUで学習しようとしたところ,以下のようなエラーを出して止まってしまった.
RuntimeError: NCCL error in: /pytorch/torch/lib/c10d/ProcessGroupNCCL.cpp:825, unhandled system error, NCCL version 2.7.8
ncclSystemError: System call (socket, malloc, munmap, etc) failed.
当初,nccl系のエラーだと思いバージョンを変えてみたが,改善しなかった.
解決方法
どうやら,Dockerコンテナに割り当てられているshared memoryが64MBと少なすぎたのが原因っぽい.わりあてられているめもりりょうはコンテナ内で以下を実行するとshmの行から確認できる.
$ df -h
shm 64M 0 64M 0% /dev/shm
なので,Dockerコンテナを起動させるときのコマンドで下記のように割り当てるメモリ量を増やすと解決した.
docker run --rm --it --gpus all \
--shm-size=1g \
--hoge:latest