{ "metadata": { "name": "", "signature": "sha256:1b9049fa9ffcbe897d7fd9f304cb30db37154a95c4cd37a5d70c0773613f3e81" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Parallel - Parallel Python\n", "\n", "Lecturer:\n", "*\u00c1lvaro Leitao*[2](http://www.cwi.nl/people/2687) - [A.Leitao_at_cwi.nl](mailto:A.Leitao_at_cwi.nl)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#####Hello World\n", "- [Hello World](#pp_hello_world)\n", "\n", "#####Sum of Primes\n", "- [Serial](#sum_primes)\n", "- [Parallel](#pp_sum_primes)\n", "- [Parallel ntimes](#pp_sum_primes_ntimes)\n", "\n", "#####Monte Carlo $\\pi$\n", "- [Serial](#montecarlo_pi)\n", "- [Parallel](#pp_montecarlo_pi)\n", "\n", "##### Midpoint Integration\n", "- [Serial](#midpoint_integration)\n", "- [Parallel](#pp_midpoint_integration)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "cd ./PP/" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "/home/jpsilva/Lisbon1214/notebooks/PP\n" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Hello World" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load pp_hello_world.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "import pp\n", "\n", "def build_hello():\n", "\treturn \"h\"+\"e\"+\"l\"+\"l\"+\"o\"\n", "\n", "def build_world():\n", "\treturn \"w\"+\"o\"+\"r\"+\"l\"+\"d\"\n", "\n", "\n", "job_server = pp.Server()\n", "\n", "print \"Starting pp with\", job_server.get_ncpus(), \"workers.\"\n", "\n", "job1 = job_server.submit(build_hello)\n", "job2 = job_server.submit(build_world)\n", "\n", "result1 = job1()\n", "result2 = job2()\n", "\n", "print result1 + \" \" + result2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Starting pp with 4 workers.\n", "hello world\n" ] } ], "prompt_number": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Sum of Primes - Serial" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load sum_primes.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import time\n", "\n", "def isprime(n):\n", "\t#Returns True if n is prime and False otherwise\n", "\tif not isinstance(n, int):\n", "\t\traise TypeError(\"argument passed to is_prime is not of 'int' type\")\n", "\tif n < 2:\n", "\t\treturn False\n", "\tif n == 2:\n", "\t\treturn True\n", "\tmax = int(math.ceil(math.sqrt(n)))\n", "\ti = 2\n", "\twhile i <= max:\n", "\t\tif n % i == 0:\n", "\t\t\treturn False\n", "\t\ti += 1\n", "\treturn True\n", "\n", "def sum_primes(n):\n", "\t#Calculates sum of all primes until given integer n\n", "\treturn sum([x for x in xrange(2,n+1) if isprime(x)])\n", "\n", "\n", "n = 1000000\n", "\n", "start_time = time.time()\n", "\n", "result = sum_primes(n)\n", "print \"Sum of primes until\", n, \"is\", result\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import time\n", "\n", "def isprime(n):\n", "\t#Returns True if n is prime and False otherwise\n", "\tif not isinstance(n, int):\n", "\t\traise TypeError(\"argument passed to is_prime is not of 'int' type\")\n", "\tif n < 2:\n", "\t\treturn False\n", "\tif n == 2:\n", "\t\treturn True\n", "\tmax = int(math.ceil(math.sqrt(n)))\n", "\ti = 2\n", "\twhile i <= max:\n", "\t\tif n % i == 0:\n", "\t\t\treturn False\n", "\t\ti += 1\n", "\treturn True\n", "\n", "def sum_primes(n):\n", "\t#Calculates sum of all primes until given integer n\n", "\treturn sum([x for x in xrange(2,n+1) if isprime(x)])\n", "\n", "\n", "n = 1000000\n", "\n", "start_time = time.time()\n", "\n", "result = sum_primes(n)\n", "print \"Sum of primes until\", n, \"is\", result\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Sum of primes until 1000000 is 37550402023\n", "Time elapsed: 7.96832108498 s\n" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Sum of Primes - Parallel" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load pp_sum_primes.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "import sys\n", "import math\n", "import time\n", "import pp\n", "\n", "def isprime(n):\n", "\t#Returns True if n is prime and False otherwise\n", "\tif not isinstance(n, int):\n", "\t\traise TypeError(\"argument passed to is_prime is not of 'int' type\")\n", "\tif n < 2:\n", "\t\treturn False\n", "\tif n == 2:\n", "\t\treturn True\n", "\tmax = int(math.ceil(math.sqrt(n)))\n", "\ti = 2\n", "\twhile i <= max:\n", "\t\tif n % i == 0:\n", "\t\t\treturn False\n", "\t\ti += 1\n", "\treturn True\n", "\n", "def sum_primes(n1, n2):\n", "\t# Calculates sum of all primes between given integers n1 and n2\n", "\tif n1 >= n2:\n", "\t print \"Second argument has to be greater than the first one.\"\n", "\t return 0\n", "\treturn sum([x for x in xrange(n1, n2+1) if isprime(x)])\n", "\n", "\n", "if len(sys.argv) > 1:\n", "\tncpus = int(sys.argv[1])\n", "\t# Creates jobserver with ncpus workers\n", "\tjob_server = pp.Server(ncpus)\n", "else:\n", "\t# Creates jobserver with automatically detected number of workers\n", "\tjob_server = pp.Server()\n", "\tncpus = job_server.get_ncpus()\n", "\n", "print \"Starting pp with\", ncpus, \"workers\"\n", "\n", "n = 1000000\n", "\n", "inputs = [( i*n/ncpus + 1, (i+1)*n/ncpus ) for i in range(0,ncpus)]\n", "\n", "start_time = time.time()\n", "\n", "jobs = [(input, job_server.submit(sum_primes, input, (isprime,), (\"math\",))) for input in inputs]\n", "\n", "total_sum = 0\n", "for input, job in jobs:\n", "\tprint \"Sum of primes between\", input, \"is\", job()\n", "\ttotal_sum += job()\n", "\n", "print \"Total sum of primes until\", n, \"is\", total_sum\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"\n", "\n", "job_server.print_stats()" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%run pp_sum_primes.py 4" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Starting pp with 4 workers\n", "Sum of primes between (1, 250000) is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "2623031151\n", "Sum of primes between (250001, 500000) is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "7291205044\n", "Sum of primes between (500001, 750000) is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "11674022830\n", "Sum of primes between (750001, 1000000) is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "15962142998\n", "Total sum of primes until 1000000 is 37550402023\n", "Time elapsed: 4.41727805138 s\n", "Job execution statistics:\n", " job count | % of all jobs | job time sum | time per job | job server\n", " 4 | 100.00 | 14.4278 | 3.606950 | local\n", "Time elapsed since server creation 4.41744089127\n", "0 active tasks, 4 cores\n", "\n" ] } ], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load pp_sum_primes_ntimes.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": [ "import sys\n", "import math\n", "import time\n", "import pp\n", "\n", "def isprime(n):\n", "\t# Returns True if n is prime and False otherwise\n", "\tif not isinstance(n, int):\n", "\t\traise TypeError(\"argument passed to is_prime is not of 'int' type\")\n", "\tif n < 2:\n", "\t\treturn False\n", "\tif n == 2:\n", "\t\treturn True\n", "\tmax = int(math.ceil(math.sqrt(n)))\n", "\ti = 2\n", "\twhile i <= max:\n", "\t\tif n % i == 0:\n", "\t\t\treturn False\n", "\t\ti += 1\n", "\treturn True\n", "\n", "def sum_primes(n):\n", "\t# Calculates sum of all primes until given integer n\n", "\treturn sum([x for x in xrange(2,n+1) if isprime(x)])\n", "\n", "\n", "\n", "if len(sys.argv) > 1:\n", "\tncpus = int(sys.argv[1])\n", "\t# Creates jobserver with ncpus workers\n", "\tjob_server = pp.Server(ncpus)\n", "else:\n", "\t# Creates jobserver with automatically detected number of workers\n", "\tjob_server = pp.Server()\n", "\n", "print \"Starting pp with\", job_server.get_ncpus(), \"workers\"\n", "\n", "# The following submits 8 jobs and then retrieves the results\n", "inputs = (1000, 100100, 100200, 100300, 100400, 100500, 100600, 100700)\n", "\n", "start_time = time.time()\n", "\n", "jobs = [(input, job_server.submit(sum_primes,(input,), (isprime,), (\"math\",))) for input in inputs]\n", "for input, job in jobs:\n", "\tprint \"Sum of primes until\", input, \"is\", job()\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"\n", "\n", "job_server.print_stats()\n" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%run pp_sum_primes_ntimes.py 4" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Starting pp with 4 workers\n", "Sum of primes until 1000 is 76127\n", "Sum of primes until 100100 is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "454996777\n", "Sum of primes until 100200 is 455898156\n", "Sum of primes until 100300 is 456700218\n", "Sum of primes until 100400 is 457603451\n", "Sum of primes until 100500 is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "458407033\n", "Sum of primes until 100600 is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "459412387\n", "Sum of primes until 100700 is 460217613\n", "Time elapsed: 1.30422210693 s\n", "Job execution statistics:\n", " job count | % of all jobs | job time sum | time per job | job server\n", " 8 | 100.00 | 4.4084 | 0.551054 | local\n", "Time elapsed since server creation 1.30437898636\n", "0 active tasks, 4 cores\n", "\n" ] } ], "prompt_number": 11 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Monte Carlo $\\pi$ - Serial" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load montecarlo_pi.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import random\n", "import time\n", "\n", "def MC_Pi(n):\n", "\tcounter = 0\n", "\tfor i in range(n):\n", "\t\tif math.pow(random.random(), 2.0) + math.pow(random.random(), 2.0) <= 1.0:\n", "\t\t\tcounter += 1\n", "\treturn counter\n", " \n", "n = 1000000\n", "start_time = time.time()\n", "\n", "ctr = MC_Pi(n)\n", "\n", "print \"PI = \", 4.0*ctr/n\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import random\n", "import time\n", "\n", "def MC_Pi(n):\n", "\tcounter = 0\n", "\tfor i in range(n):\n", "\t\tif math.pow(random.random(), 2.0) + math.pow(random.random(), 2.0) <= 1.0:\n", "\t\t\tcounter += 1\n", "\treturn counter\n", " \n", "n = 1000000\n", "start_time = time.time()\n", "\n", "ctr = MC_Pi(n)\n", "\n", "print \"PI = \", 4.0*ctr/n\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "PI = 3.1392\n", "Time elapsed: 0.598618030548 s\n" ] } ], "prompt_number": 13 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Monte Carlo $\\pi$ - Parallel" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load pp_montecarlo_pi.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "import sys\n", "import math\n", "import random\n", "import time\n", "import pp\n", "\n", "def MC_Pi(n):\n", "\tcounter = 0\n", "\tfor i in range(n):\n", "\t\tif math.pow(random.random(), 2.0) + math.pow(random.random(), 2.0) <= 1.0:\n", "\t\t\tcounter += 1\n", "\treturn counter\n", "\n", "if len(sys.argv) > 1:\n", "\tncpus = int(sys.argv[1])\n", "\t# Creates jobserver with ncpus workers\n", "\tjob_server = pp.Server(ncpus)\n", "else:\n", "\t# Creates jobserver with automatically detected number of workers\n", "\tjob_server = pp.Server()\n", "\tncpus = job_server.get_ncpus()\n", "\n", "print \"Starting pp with\", ncpus, \"workers\"\n", "\n", "n = 1000000\n", "\n", "start_time = time.time()\n", "\n", "ln = n/ncpus\n", "\n", "jobs = [job_server.submit(MC_Pi, (ln,), modules = (\"math\",'random')) for i in range(ncpus)]\n", "\n", "ctr = 0\n", "for job in jobs:\n", "\tctr += job()\n", "\n", "print \"PI = \", 4.0*ctr/n\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"\n" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%run pp_montecarlo_pi.py 4" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Starting pp with 4 workers\n", "PI = " ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 3.143692\n", "Time elapsed: 0.327872037888 s\n" ] } ], "prompt_number": 20 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Midpoint Integration - Serial" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load midpoint_integration.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 21 }, { "cell_type": "code", "collapsed": false, "input": [ "import time\n", "\n", "def func_val(x):\n", "\t# return pow(sin(x)+cos(x),1/3.0)\n", "\t# return sin(x)\n", "\t# return pow(x,3)+pow(x,2)+3*x+4;\n", "\t# return 2*pow(x,2)/ (3*pow(x,5)+4);\n", "\treturn 4/(1+x*x) # should return Pi for int from 0 .. 1 = (4 * atan(1) )\n", "\n", "def simpleint(a, m, h):\n", "\tresult = 0\n", "\t\n", "\t# This is simple midpoint integration\n", "\tfor x in range(0,m):\n", "\t\tresult += func_val(a + x*h + h/2) # average function value between a and a+h\n", "\t\t\n", "\treturn result * h # multiply with width=h to compute surface\n", "\n", "\n", "a = 0\n", "b = 1\n", "m = 1000000\n", "\n", "i = float(b - a)\n", "h = i/m\n", "\n", "start_time = time.time()\n", "\n", "print \"Integral of f between\", (a,b), \"is\", simpleint(a, m, h)\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "import time\n", "\n", "def func_val(x):\n", "\t# return pow(sin(x)+cos(x),1/3.0)\n", "\t# return sin(x)\n", "\t# return pow(x,3)+pow(x,2)+3*x+4;\n", "\t# return 2*pow(x,2)/ (3*pow(x,5)+4);\n", "\treturn 4/(1+x*x) # should return Pi for int from 0 .. 1 = (4 * atan(1) )\n", "\n", "def simpleint(a, m, h):\n", "\tresult = 0\n", "\t\n", "\t# This is simple midpoint integration\n", "\tfor x in range(0,m):\n", "\t\tresult += func_val(a + x*h + h/2) # average function value between a and a+h\n", "\t\t\n", "\treturn result * h # multiply with width=h to compute surface\n", "\n", "\n", "a = 0\n", "b = 1\n", "m = 1000000\n", "\n", "i = float(b - a)\n", "h = i/m\n", "\n", "start_time = time.time()\n", "\n", "print \"Integral of f between\", (a,b), \"is\", simpleint(a, m, h)\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Integral of f between (0, 1) is " ] }, { "output_type": "stream", "stream": "stdout", "text": [ "3.14159265359\n", "Time elapsed: 0.437613010406 s\n" ] } ], "prompt_number": 22 }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "heading", "level": 5, "metadata": {}, "source": [ "Midpoint Integration - Parallel" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%load pp_midpoint_integration.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 23 }, { "cell_type": "code", "collapsed": false, "input": [ "import sys\n", "import time\n", "import pp\n", "\n", "def func_val(x):\n", "\t# return pow(sin(x)+cos(x),1/3.0)\n", "\t# return sin(x)\n", "\t# return pow(x,3)+pow(x,2)+3*x+4;\n", "\t# return 2*pow(x,2)/ (3*pow(x,5)+4);\n", "\treturn 4/(1+x*x) # should return Pi for int from 0 .. 1 = (4 * atan(1) )\n", "\n", "def simpleint(a, m, h):\n", "\tresult = 0\n", "\t\n", "\t# This is simple midpoint integration\n", "\tfor x in range(0,m):\n", "\t\tresult += func_val(a + x*h + h/2) # average function value between a and a+h\n", "\t\t\n", "\treturn result * h # multiply with width=h to compute surface\n", "\n", "\n", "if len(sys.argv) > 1:\n", "\tncpus = int(sys.argv[1])\n", "\t# Creates jobserver with ncpus workers\n", "\tjob_server = pp.Server(ncpus)\n", "else:\n", "\t# Creates jobserver with automatically detected number of workers\n", "\tjob_server = pp.Server()\n", "\tncpus = job_server.get_ncpus()\n", "\n", "print \"Starting pp with\", ncpus, \"workers\"\n", "\n", "a = 0\n", "b = 1\n", "m = 1000000\n", "\n", "i = float(b - a)\n", "h = i/m\n", "\n", "start_time = time.time()\n", "\n", "lm = m/ncpus\n", "if(lm == 0):\n", "\tlm = 1\n", "local_a = [( a + j*i/ncpus) for j in range(0,ncpus)]\n", "\n", "jobs = [job_server.submit(simpleint, (la,lm,h), (func_val,)) for la in local_a]\n", "\n", "total_sum = 0\n", "for job in jobs:\n", "\ttotal_sum += job()\n", "\n", "print \"Integral of f between\", (a,b), \"is\", total_sum\n", "\n", "print \"Time elapsed: \", time.time() - start_time, \"s\"\n", "\n", "job_server.print_stats()" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%run pp_midpoint_integration.py 4" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Starting pp with 4 workers\n", "Integral of f between" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " (0, 1) is 3.14159265359\n", "Time elapsed: 0.223114967346 s\n", "Job execution statistics:\n", " job count | % of all jobs | job time sum | time per job | job server\n", " 4 | 100.00 | 0.8653 | 0.216336 | local\n", "Time elapsed since server creation 0.223268985748\n", "0 active tasks, 4 cores\n", "\n" ] } ], "prompt_number": 24 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%load_ext version_information\n", "%version_information pp" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
SoftwareVersion
Python2.7.9 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
IPython2.3.1
OSLinux 3.16.0 28 generic x86_64 with debian jessie sid
pp1.6.4
Wed Dec 17 12:03:33 2014 CET
" ], "json": [ "{\"Software versions\": [{\"version\": \"2.7.9 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]\", \"module\": \"Python\"}, {\"version\": \"2.3.1\", \"module\": \"IPython\"}, {\"version\": \"Linux 3.16.0 28 generic x86_64 with debian jessie sid\", \"module\": \"OS\"}, {\"version\": \"1.6.4\", \"module\": \"pp\"}]}" ], "latex": [ "\\begin{tabular}{|l|l|}\\hline\n", "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", "Python & 2.7.9 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] \\\\ \\hline\n", "IPython & 2.3.1 \\\\ \\hline\n", "OS & Linux 3.16.0 28 generic x86\\_64 with debian jessie sid \\\\ \\hline\n", "pp & 1.6.4 \\\\ \\hline\n", "\\hline \\multicolumn{2}{|l|}{Wed Dec 17 12:03:33 2014 CET} \\\\ \\hline\n", "\\end{tabular}\n" ], "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "Software versions\n", "Python 2.7.9 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]\n", "IPython 2.3.1\n", "OS Linux 3.16.0 28 generic x86_64 with debian jessie sid\n", "pp 1.6.4\n", "Wed Dec 17 12:03:33 2014 CET" ] } ], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.core.display import HTML\n", "def css_styling():\n", " styles = open(\"./styles/custom.css\", \"r\").read()\n", " return HTML(styles)\n", "css_styling()" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", "\n", "\n", "\n", "\n" ], "metadata": {}, "output_type": "pyout", "prompt_number": 1, "text": [ "" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }