こすたろーんエンジニアの試行錯誤部屋

作成物の備忘録を書いていきますー

【docker】how to solve "Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm)"

スポンサーリンク

I created a docker that can use pytorch and when I run it, I get
Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm)
This article is a reminder of how to deal with it.

contents

スポンサーリンク

abstract

how to solve "Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm)"

1. cause

Not enough shared memory in docker container.
Default is 64M.

2. how to solve

Extend shared memory by adding --shm-size=[size] when creating docker containers.

command example

sudo docker run -it --rm --runtime nvidia -v /path/to/workdir/:/workspace --workdir /workspace --network host --shm-size=256mb --name your_container_name your_image

4.refarence

qiita.com