jutanke / rp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPU softlock when performing numpy operations in multiprocesses

felixbmuller opened this issue · comments

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:

Screenshot from 2023-02-18 13-14-17

Running with --cpu=17 --gpu=0 --mem=200

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