On 9 Feb, 12:24, Gerhard Häring <g...@ghaering.de> wrote:
> http://objectmix.com/python/631346-parallel-python.html
>

Hmm. In fact, this doesn't seem to work for pp. When I run the code
below, it says everything is running on the one core.

import pp
import random
import time
from string import lowercase

ncpus = 3

def timedCharDump(waittime, char):
        time.sleep(waittime)
        mycore = open("/proc/%i/stat" % os.getpid()).read().split()[39]
        print "I'm doing stuff!", mycore, char
        return char

job_server = pp.Server(ncpus, ppservers=())

jobdetails = [ (random.random(), letter) for letter in lowercase ]

jobs = [ job_server.submit(timedCharDump,(jinput1, jinput2), (),
("os", "time",)) for jinput1, jinput2 in jobdetails ]

for job in jobs:
        print job()


Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to