from multiprocessing import Pool
...
pool = Pool(processes=2) # start 2 worker processes
<<
Wow, cool, is this part of parallel python? Does this only work on a
multi-core PC or can this be made to work over a cluster as well?
TIA,
A. Jorge Garcia
http://calcpage.tripod.com
Teacher & Professor
Applied Mathematics, Physics & Computer Science
Baldwin Senior High School & Nassau Community College
-----Original Message-----
From: Gokhan Sever <gokhanse...@gmail.com>
To: sage-support <sage-support@googlegroups.com>
Sent: Sun, Mar 7, 2010 12:23 am
Subject: [sage-support] Simple multiprocessing example in Sage-Notebook
Hello,
I am executing this example in Sage Notebook v4.3.3
from timeit import default_timer as clock
from multiprocessing import Pool
def f(x):
return x**3 + x**2 + x
if __name__ == '__main__':
t1 = clock()
pool = Pool(processes=2) # start 2 worker processes
pool.map(f, range(1000000));
t2 = clock()
print "Elapsed time using two processes:", t2-t1
When I run the code in shell using "python file.py" I don't get any
results from function mapping printed out however in Sage-Notebook I
see a huge output with WARNING: Output truncated!
Any ideas what might be causing this issue?
Thanks.
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org