import pp , and then (the first option): ppservers = ()
job_server = pp.Server (ppservers = ppservers)
job_server.set_ncpus (2)
print "Starting pp with", job_server.get_ncpus (), "workers"
jobs = [job_server.submit (tighina_check, (), (find_geo_coords, compare, get_dist_bearing,), ("math",)) for i in range (3)]
for job in jobs:
job ()
job_server.print_stats () jobs = [job_server.submit(tighina_check, (), (find_geo_coords, compare, get_dist_bearing,), ("math", "psyco", )) for i in range(3)] def tighina_check ():
psyco.full ()
# and here is a lot of math def tighina_check ():
psyco.full ()
math_func_imports = ['sin', 'cos', 'asin', 'acos', 'sqrt', 'pow', 'fabs']
for func in math_func_imports:
setattr (__builtins__, func, getattr (math, func))
import psyco psyco.full ()
eval (__ fobj)on
exec __fobj
Starting pp with 2 workers
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
100 | 100.00 | 389.8933 | 3.898933 | local
Time elapsed since server creation 195.12789011 Starting pp with 4 workers
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
100 | 100.00 | 592.9463 | 5.929463 | local
Time elapsed since server creation 148.77167201 Starting pp with 8 workers
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
100 | 100.00 | 1072.3920 | 10.723920 | local
Time elapsed since server creation 137.681350946 Starting pp with 16 workers
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
100 | 100.00 | 2050.8158 | 20.508158 | local
Time elapsed since server creation 133.345046043
Starting pp with 32 workers
Job execution statistics:
job count | % of all jobs | job time sum | time per job | job server
100 | 100.00 | 4123.8550 | 41.238550 | local
Time elapsed since server creation 136.022897005 ppservers = ()
job_server = pp.Server (ppservers = ppservers)
job_server.set_ncpus (16)
print "Starting pp with", job_server.get_ncpus (), "workers"
jobs = [job_server.submit (tighina_check, (), (find_geo_coords, compare, get_dist_bearing,), ("math",)) for i in range (3)]
for job in jobs:
job ()
job_server.print_stats () def tighina_check ():
math_func_imports = ['sin', 'cos', 'asin', 'acos', 'sqrt', 'pow', 'fabs']
for func in math_func_imports:
setattr (__builtins__, func, getattr (math, func))
# and here is a lot of math Source: https://habr.com/ru/post/61916/
All Articles