3

On my windows 7 machine, this piece of code

import numpy as np
np.random.seed(1)
import time

def main():
    for i in range(0, 1000):
        A = np.random.rand(100, 100)
        t = time.time()
        A_inv = np.linalg.inv(A)
        print 'TAKING', time.time() - t, 'per INVERSE'

if __name__=='__main__':
    main()

runs perfectly fine if called just once, with one inversion call taking about 0.01 seconds.

If I run the same script twice, so that two (separate) instances are running in parallel, some of the inversion calls are taking more than 10 seconds. I have noticed similar behaviour with np.linalg.solve - I'm assuming it's calling some same underlying functions. The same script(s) ran on MacOS don't display this type of blocking behaviour

JerryE
  • 31
  • 2

0 Answers0