If I run the following python code
def dummy(t):
A = np.random.rand(10000, 10000)
inv = np.linalg.inv(A)
return np.linalg.norm(inv)
if __name__ == "__main__":
with multiprocessing.Pool(2) as pool:
print(pool.map(dummy, range(20)))
more than the specified 2 processes are spawned, or at least it seems that way. More specifically, when I use htop
to monitor the system, it shows all threads as busy, i.e. 100% CPU usage.
I would expect that only 2 threads show full 100% usage, but perhaps that assumption is wrong.
Curiously enough, if the matrix size is increased (by a factor of 10), only the 2 specified threads are busy.
Used python version: 3.6.9 / 3.8.5. Machine: skylake server with 40 cores.