Author: Remi Meier <[email protected]>
Branch: multithread-runner
Changeset: r359:9dd673d818fb
Date: 2016-05-28 09:29 +0200
http://bitbucket.org/pypy/benchmarks/changeset/9dd673d818fb/
Log: add perlin-noise config
diff --git a/multithread/config-all-short.json
b/multithread/config-all-short.json
--- a/multithread/config-all-short.json
+++ b/multithread/config-all-short.json
@@ -55,6 +55,12 @@
"file": "raytrace/raytrace.py",
"PYTHONPATH": "..",
"args": ["128", "512"]
+ },
+
+ "perlin": {
+ "file": "perlin_noise/perlin_noise.py",
+ "PYTHONPATH": "..",
+ "args": ["4"]
}
}
diff --git a/multithread/config-perlin-noise.json
b/multithread/config-perlin-noise.json
new file mode 100644
--- /dev/null
+++ b/multithread/config-perlin-noise.json
@@ -0,0 +1,19 @@
+{
+ "defaults": {
+ "file": null,
+ "threads": [1, 2, 4, 8],
+ "vmstarts": 3,
+ "warmiters": 5,
+ "PYTHONPATH": ".",
+ "args": [],
+ "cwd": "."
+ },
+
+ "benchs": {
+ "perlin": {
+ "file": "perlin_noise/perlin_noise.py",
+ "PYTHONPATH": "..",
+ "args": ["5"]
+ }
+ }
+}
diff --git a/multithread/perlin_noise/perlin_noise.py
b/multithread/perlin_noise/perlin_noise.py
--- a/multithread/perlin_noise/perlin_noise.py
+++ b/multithread/perlin_noise/perlin_noise.py
@@ -3,7 +3,7 @@
import sys
import time, random
-from common.abstract_threading import (AtomicFuture,
+from common.abstract_threading import (
atomic, Future, set_thread_pool, ThreadPool,
hint_commit_soon, print_abort_info)
@@ -67,16 +67,15 @@
def work(n, x):
res = []
- hint_commit_soon()
- with atomic:
- for y in xrange(n):
- for z in xrange(n):
- res.append(perlin_noise(x/3., y/3., z/3.))
- hint_commit_soon()
+ #hint_commit_soon()
+ for y in xrange(n):
+ for z in xrange(n):
+ res.append(perlin_noise(x/3., y/3., z/3.))
+ #hint_commit_soon()
return res
-def run(threads=2, n=50):
+def run(threads=2, n=5):
threads = int(threads)
n = int(n)
@@ -91,5 +90,32 @@
set_thread_pool(None)
+def main(argv):
+ # warmiters threads args...
+ warmiters = int(argv[0])
+ threads = int(argv[1])
+ n = int(argv[2])
+
+ print "params (iters, threads, n):", warmiters, threads, n
+
+ print "do warmup:"
+ for i in range(2):
+ t = time.time()
+ run(threads, n)
+ print "iter", i, "time:", time.time() - t
+
+ print "turn off jitting"
+ import gc
+ turn_jitting_off()
+ print "do", warmiters, "real iters:"
+ times = []
+ for i in range(warmiters):
+ gc.collect()
+ t = time.time()
+ run(threads, n)
+ times.append(time.time() - t)
+ print "warmiters:", times
+
if __name__ == "__main__":
- run()
+ import sys
+ main(sys.argv[1:])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit