Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: 
Changeset: r262:5bc3db97089a
Date: 2014-05-28 17:02 +0200
http://bitbucket.org/pypy/benchmarks/changeset/5bc3db97089a/

Log:    jython compat

diff --git a/multithread/mandelbrot/mandelbrot.py 
b/multithread/mandelbrot/mandelbrot.py
--- a/multithread/mandelbrot/mandelbrot.py
+++ b/multithread/mandelbrot/mandelbrot.py
@@ -52,14 +52,14 @@
     return res
 
 
-def run(threads=2, stripes=16):
+def run(threads=2, stripes=64, w=4096, h=4096):
     global out_image
     threads = int(threads)
     stripes = int(stripes)
     assert stripes >= threads
     ar, ai = -2.0, -1.5
     br, bi = 1.0, 1.5
-    width, height = 4096, 4096
+    width, height = int(w), int(h)
 
     set_thread_pool(ThreadPool(threads))
     step = (bi - ai) / stripes
diff --git a/multithread/multithread-richards.py 
b/multithread/multithread-richards.py
--- a/multithread/multithread-richards.py
+++ b/multithread/multithread-richards.py
@@ -106,13 +106,13 @@
         self.task_waiting = False
         self.task_holding = False
         return self
-        
+
     def waitingWithPacket(self):
         self.packet_pending = True
         self.task_waiting = True
         self.task_holding = False
         return self
-        
+
     def isPacketPending(self):
         return self.packet_pending
 
@@ -236,7 +236,7 @@
         if t is None:
             raise Exception("Bad task id %d" % id)
         return t
-            
+
 
 # DeviceTask
 
@@ -310,7 +310,7 @@
         else:
             i.control = i.control/2 ^ 0xd008
             return self.release(I_DEVB)
-            
+
 
 # WorkTask
 
@@ -372,7 +372,7 @@
         self.finished_lock.acquire()
 
     def run_and_unlock(self, to_do):
-        os.write(1, 'running...\n')
+        print 'running...'
         iterations = 0
         self.result = True
         while 1:
@@ -382,7 +382,7 @@
                 break
             iterations += 1
             self.result = self.run()
-        os.write(1, 'done, iterations=%d, result=%r\n' % (iterations, 
self.result))
+        print 'done, iterations=%d, result=%r' % (iterations, self.result)
         self.finished_lock.release()
 
     def run(self):
@@ -415,7 +415,7 @@
                        taskWorkArea)
             DeviceTask(I_DEVB, 5000, wkq, TaskState().waiting(), 
DeviceTaskRec(),
                        taskWorkArea)
-            
+
             schedule(taskWorkArea)
 
             if taskWorkArea.holdCount == 9297 and taskWorkArea.qpktCount == 
23246:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to