the new timing script (vs local SoftPosit, build with 'make python3')
authorBill Zorn <bill.zorn@gmail.com>
Mon, 6 Aug 2018 05:29:51 +0000 (22:29 -0700)
committerBill Zorn <bill.zorn@gmail.com>
Mon, 6 Aug 2018 05:29:51 +0000 (22:29 -0700)
timing.py

index ff13387ac114c92f2ddfe80c05a25ff1b720223d..913e9ecd1e230183343c4178d72791317554af4f 100644 (file)
--- a/timing.py
+++ b/timing.py
@@ -31,25 +31,48 @@ def ops_sec(stmt, setup):
 
 
 setup = """import sfpy
-P8 = sfpy.Posit8
-Q8 = sfpy.Quire8
-a = P8(1.3)
-b = P8(-0.5)
-c = P8(15.0)
-q = Q8()
+import SoftPosit.python.softposit as sp1
+import SoftPosit.python._softposit as sp2
 zero = 0.0
+one = 1.0
+sfpy_a = sfpy.Posit16(1.3)
+sfpy_b = sfpy.Posit16(-0.5)
+sfpy_c = sfpy.Posit16(15.0)
+sfpy_q = sfpy.Quire16(0)
+
+sp1_a = sp1.posit16(1.3)
+sp1_b = sp1.posit16(-0.5)
+sp1_c = sp1.posit16(15.0)
+sp1_q = sp1.quire16()
+"""
+"""
+sp2_a = sp2.convertDoubleToP16(1.3)
+sp2_b = sp2.convertDoubleToP16(-0.5)
+sp2_c = sp2.convertDoubleToP16(15.0)
+sp2_q = sp2.new_quire16_t()
 """
 
 ops_sec('pass', setup)
-ops_sec('P8(0)', setup)
-ops_sec('P8("0")', setup)
-ops_sec('P8.from_bits(0)', setup)
-
-ops_sec('1.1 + 2', setup)
-ops_sec('a + b', setup)
-ops_sec('a.add(b)', setup)
-ops_sec('zero += 1', setup)
-ops_sec('a += b', setup)
-ops_sec('a.iadd(b)', setup)
-
-ops_sec('q.fdp_add(b, c)', setup)
+ops_sec('sfpy.Posit16(0)', setup)
+ops_sec('sp1.posit16(0)', setup)
+#ops_sec('sp2.new_posit16_t()', setup)
+
+ops_sec('one + zero', setup)
+ops_sec('sfpy_a + sfpy_b', setup)
+ops_sec('sp1_a + sp1_b', setup)
+#ops_sec('sp2_a + sp2_b', setup)
+
+ops_sec('sfpy_c += sfpy_b', setup)
+
+# ops_sec('P8(0)', setup)
+# ops_sec('P8("0")', setup)
+# ops_sec('P8.from_bits(0)', setup)
+
+# ops_sec('1.1 + 2', setup)
+# ops_sec('a + b', setup)
+# ops_sec('a.add(b)', setup)
+# ops_sec('zero += 1', setup)
+# ops_sec('a += b', setup)
+# ops_sec('a.iadd(b)', setup)
+
+# ops_sec('q.fdp_add(b, c)', setup)