{ "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": {} } ] }