Understanding why numpy make a fork whenever it is imported

Viewed 53

Whenever I make import numpy 11 sub-processes (my CPU has 6/12 cores/threads) are created even if numpy is not used. This happens only for a moment but each sub-process receives a copy of the objects allocated in memory. It is not a big deal, since it happens at the very beginning, but I am worried about any possible side-effect. Could someone explain me why this is happening?

Here very simple piece code to reproduce the problem:

import time
import numpy

def hello_world():
    print("Hello world")
    time.sleep(10)

if __name__ == '__main__':
    print("Running")
    time.sleep(30)
    hello_world()
0 Answers
Related