From: Bill Zorn Date: Mon, 6 Aug 2018 05:29:51 +0000 (-0700) Subject: the new timing script (vs local SoftPosit, build with 'make python3') X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b81630a5e6c6ab3a9174a61c469198425746bb7;p=sfpy.git the new timing script (vs local SoftPosit, build with 'make python3') --- diff --git a/timing.py b/timing.py index ff13387..913e9ec 100644 --- 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)