X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=tools%2FNumericalOperationsPerformanceTests.ipynb;fp=tools%2FNumericalOperationsPerformanceTests.ipynb;h=7f53a5ece176dd09c1c9138f2466ed474326e5a1;hp=0000000000000000000000000000000000000000;hb=03cc1b0a0d0705e0b1d92e13fdb18608c7a00272;hpb=ea748154f1bc7dbc81cb52611a52865e63109439;ds=sidebyside diff --git a/tools/NumericalOperationsPerformanceTests.ipynb b/tools/NumericalOperationsPerformanceTests.ipynb new file mode 100644 index 0000000..7f53a5e --- /dev/null +++ b/tools/NumericalOperationsPerformanceTests.ipynb @@ -0,0 +1,166 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Test the performance of numerical operations" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from common import *" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for b in [\"single\", \"double\", \"GMPrat\", \"ParanoidNumber\"]:\n", + " os.system(\"make -C %s clean\" % options[\"ipdf_src\"])\n", + " os.system(\"make -C %s REALTYPE=%d tests/identitytests\" % (options[\"ipdf_src\"], options[\"real_names\"].index(b)))\n", + " os.system(\"mv %s/tests/identitytests %s/identity-%s\" % (options[\"ipdf_src\"], options[\"local_bin\"], b))\n", + " display(\"Built %s\" % b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'Built single'" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'Built double'" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'Built GMPrat'" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'Built ParanoidNumber'" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def IdentityTest(real):\n", + " start = time.time()\n", + " display(\"%s starts at %d\" % (b, start))\n", + " p = subprocess.Popen(\"./identity-%s\" % real, bufsize=0, stdin=subprocess.PIPE, \\\n", + " stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n", + " p.wait()\n", + " display(\"%s completed, took %d\" % (real,time.time() - start))\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 30 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import threading" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 31 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for b in [\"single\", \"double\", \"GMPrat\", \"ParanoidNumber\"]:\n", + " threading.Thread(target=IdentityTest, args=(b,)).start()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'double starts at 1411243678'" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'GMPrat starts at 1411243678'" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "text": [ + "'ParanoidNumber starts at 1411243678'" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file