• R/O
  • SSH

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

File Info

Rev. ac99cb2923fb19a6f5ca054a70856f41ed4bb37d
Size 585 bytes
Time 2008-06-17 23:11:31
Author iselllo
Log Message

I added the code parallel_running.py which shows how to trivially use the parallel python module for executing jobs taken from a pool.

Content

import pp
 
def parallel_function():
    from subprocess import Popen, PIPE 
    p = Popen(['date', '--utc'], stdout=PIPE, stderr=PIPE)
    return p.stdout.readlines()
 
 
ppservers = ()
#pp.Server(..................., secret='password')

#job_server = pp.Server(ncpus=4, ppservers=ppservers)
job_server = pp.Server(ncpus=4, ppservers=ppservers, secret='password')
 
print "Starting pp with", job_server.get_ncpus(), "workers"
 
jobs = [] 
for job in xrange(40):
    jobs.append(job_server.submit(parallel_function, ()))
 
for job in jobs:
    print job()
 
job_server.print_stats()