This example program of using the multiprocessing is crashing my i7 4 core windows7 64 bit computer (32 bit enthought Python 2.7), but is running fine in virtual machine Ubuntu with 4 cores assigned. Can anyone run it in their commputer in Windows7. My system memory (8 GB) is totally eaten by the program and mouse moves but I can not do anything with computer, even ctrl-alt-del to get to task manager.
# -*- coding: utf-8 -*-
from numpy import arange,sqrt, random, linalg
from multiprocessing import Pool
global counter
counter = 0
def cb(r):
global counter
print counter, r
counter +=1
def det(M):
return linalg.det(M)
po = Pool()
for i in xrange(1,300):
j = random.normal(1,1,(100,100))
po.apply_async(det,(j,),callback=cb)
po.close()
po.join()
print counter
http://pyinsci.blogspot.fi/2009/02/usage-pattern-for-multiprocessing.html