Strange affinity side effect with multiprocessing.

Greg MacDonald gtmacdonald at gmail.com
Sun Nov 21 15:43:33 EST 2010


Hi Everyone,

I'm having a strange problem with the multiprocessing package and
Panda3D. Importing panda modules causes multiprocessing to only use
one of my cores.

I've created an example test case. It uses an infinite loop to ping
the cores so you'll have to manually kill the python processes.

So if I run the following I can see in my task manager that both cores
are at 100%.

Code:

#from pandac.PandaModules import Point2
from multiprocessing import Pool

def dummyWorker(a):
    while True:
        continue

class DummyTester(object):
    def __init__(self):
        self.pool = Pool(2)

    def go(self):
        result = self.pool.map_async(dummyWorker, range(2))
        result.get()

if __name__ == "__main__":
    DummyTester().go()


But if I uncomment out that one line there it only uses one of my cores.

This is with a fresh download of panda 1.7.0 on windows xp, python
2.6, and intel core2 duo.

I'm completely at a loss so any thoughts would be greatly appreciated. Thx.

-Greg



More information about the Python-list mailing list