在创建docker时配置较大的共享内存,加入参数--shm-size="15g"
,设置15g(根据实际情况酌量设置)的共享内存:
nvidia-docker run -it --name [container_name] --shm-size="15g" ...
这样可以在训练神经网络时把number of workers调大一些,也不会报错:RuntimeError: DataLoader worker (pid 57431) is killed by signal: Bus error. It is possible that dataloader's workers are out of shared memory. Please try to raise your shared memory limit.