CPU softlock when performing numpy operations in multiprocesses
felixbmuller opened this issue · comments
Felix B. Müller commented
I was running processes with
with get_context("spawn").Pool(cpu_count()) as p:
which query and process data from bam_poses with numpy. All processes seem to get stuck when merging small numpy arrays into larger ones (this is happening in the processes):
batched_ret = {}
for k, v in ret.items():
arr = np.empty((len(v), *v[0].shape), dtype=np.float32)
for i in range(len(v)):
arr[i] = v[i]
batched_ret[k] = arr
After a while, kernel warnings appear:
Running with --cpu=17 --gpu=0 --mem=200
Felix B. Müller commented
When in an docker environment, multiprocessing.cpu_count() still shows the total number of CPUs, not the ones available to the docker container.
This somehow causes the soft lockups when executing the code above