오류
RuntimeError: DataLoader worker (pid 26847) 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.
Dataloader에서 num_workers > 1일 때 multi-process를 사용해서 데이터를 로딩한다.
이때 shared memory 위에서 데이터 로딩이 진행되는데 num_workers가 많을수록 더 많은 메모리가 필요하다.
위 오류는 필요한 메모리에 비해 shared memory가 적을 때 발생한다.
해결방법
가장 쉬운 방법은 shared memory를 늘려주는 것이다.
그럴 수 없는 경우라면, num_workers의 값을 줄여가면서 shared memory의 한계를 넘지 않은 값을 찾아야 한다.
하지만 num_workers의 값을 줄인다면 처리 속도가 줄어들게 된다.
나의 경우에는 validation 과정에서 위 문제가 발생하였고 num_workers를 줄이는 대신 batch_size를 줄여 처리시간을 유지하면서 문제를 해결했다.