Commits

Antonio Cuni committed c6b0d22 Draft

the execnet demo talk

Comments (0)

Files changed (9)

talks/pypy-course/execnet/Makefile

+# you can find rst2beamer.py here:
+# http://codespeak.net/svn/user/antocuni/bin/rst2beamer.py
+
+# WARNING: to work, it needs this patch for docutils
+# https://sourceforge.net/tracker/?func=detail&atid=422032&aid=1459707&group_id=38414
+
+talk.pdf: talk.txt author.latex title.latex stylesheet.latex
+	rst2beamer.py --stylesheet=stylesheet.latex --documentoptions=14pt talk.txt talk.latex || exit
+	sed 's/\\date{}/\\input{author.latex}/' -i talk.latex || exit
+	sed 's/\\maketitle/\\input{title.latex}/' -i talk.latex || exit
+	pdflatex talk.latex  || exit
+
+view: talk.pdf
+	evince talk.pdf &
+
+xpdf: talk.pdf
+	xpdf talk.pdf &

talks/pypy-course/execnet/author.latex

+\definecolor{rrblitbackground}{rgb}{0.0, 0.0, 0.0}
+
+\title[PyPy execnet]{PyPy and CPython through execnet}
+\author[antocuni]
+{Antonio Cuni}
+
+\institute{Big Dive 2012
+\date{October 23, 2012}

talks/pypy-course/execnet/beamerdefs.txt

+.. colors
+.. ===========================
+
+.. role:: green
+.. role:: red
+
+
+.. general useful commands
+.. ===========================
+
+.. |pause| raw:: latex
+
+   \pause
+
+.. |small| raw:: latex
+
+   {\small
+
+.. |end_small| raw:: latex
+
+   }
+
+.. |scriptsize| raw:: latex
+
+   {\scriptsize
+
+.. |end_scriptsize| raw:: latex
+
+   }
+
+
+
+.. closed bracket
+.. ===========================
+
+.. |>| raw:: latex
+
+   }
+
+
+.. example block
+.. ===========================
+
+.. |example<| raw:: latex
+
+   \begin{exampleblock}{
+
+
+.. |end_example| raw:: latex
+
+   \end{exampleblock}
+
+
+
+.. alert block
+.. ===========================
+
+.. |alert<| raw:: latex
+
+   \begin{alertblock}{
+
+
+.. |end_alert| raw:: latex
+
+   \end{alertblock}
+
+
+
+.. columns
+.. ===========================
+
+.. |column1| raw:: latex
+
+   \begin{columns}
+      \begin{column}{0.45\textwidth}
+
+.. |column2| raw:: latex
+
+      \end{column}
+      \begin{column}{0.45\textwidth}
+
+
+.. |end_columns| raw:: latex
+
+      \end{column}
+   \end{columns}

talks/pypy-course/execnet/demo-graph.pdf

Binary file added.

talks/pypy-course/execnet/py-web-new.png

Added
New image

talks/pypy-course/execnet/stylesheet.latex

+\usetheme{Boadilla}
+\usecolortheme{whale}
+\setbeamercovered{transparent}
+\setbeamertemplate{navigation symbols}{}
+
+\definecolor{darkgreen}{rgb}{0, 0.5, 0.0}
+\newcommand{\docutilsrolegreen}[1]{\color{darkgreen}#1\normalcolor}
+\newcommand{\docutilsrolered}[1]{\color{red}#1\normalcolor}
+
+\newcommand{\green}[1]{\color{darkgreen}#1\normalcolor}
+\newcommand{\red}[1]{\color{red}#1\normalcolor}

talks/pypy-course/execnet/talk.pdf.info

+AvailableTransitions=[Crossfade]
+TransitionDuration = 100
+EstimatedDuration = 60*60       # in seconds
+MinutesOnly = True
+
+PageProps = {
+    1: {
+    'reset': FirstTimeOnly,
+    'progress': False,
+    },
+}

talks/pypy-course/execnet/talk.rst

+.. include:: beamerdefs.txt
+
+=======================================
+PyPy and CPython through execnet
+=======================================
+
+Mandelbrot demo (1)
+-------------------
+
+- Django application
+
+- Mandelbrot fractal
+
+  * fished randomly on the net :-)
+
+- Run both on CPython and PyPy
+
+  * django trunk!
+
+
+Mandelbrot demo (2)
+-------------------
+
+- Works purely on PyPy
+
+- Not always the case
+
+  * missing extension modules (cpyext mitigates the problem)
+
+  * libraries that rely on CPython details
+    
+  * ...
+
+- clear performance-critical part
+
+
+CPython and PyPy side by side
+------------------------------
+
+- CPython: runs the main application
+
+- PyPy: subprocess, runs only the hotspots
+
+- How do they communicate?
+
+- execnet
+
+
+Rendering (1)
+---------------
+
+|example<| Mandelbrot |>|
+|small|
+::
+
+    def render(request):
+        w = int(request.GET.get('w', 320))
+        h = int(request.GET.get('h', 240))
+
+        from py_mandel import mandelbrot
+        img = mandelbrot(w, h)
+
+        return HttpResponse(img, content_type="image/bmp")
+
+|end_small|
+|end_example|
+
+
+Rendering (2)
+-------------
+
+|example<| Mandelbrot on PyPy |>|
+|small|
+::
+
+    def pypy_render(request):
+        w = int(request.GET.get('w', 320))
+        h = int(request.GET.get('h', 240))
+
+        channel = pypy.remote_exec("""
+            from py_mandel import mandelbrot
+            w, h = channel.receive()
+            img = mandelbrot(w, h)
+            channel.send(img)
+        """)
+        channel.send((w, h))
+        img = channel.receive()
+
+        return HttpResponse(img, content_type="image/bmp")
+
+|end_small|
+|end_example|
+
+execnet setup
+-------------
+
+|example<| At startup |>|
+|small|
+::
+
+    import execnet
+    mygroup = execnet.Group()
+    pypy = mygroup.makegateway("popen//python=pypy-c")
+    pypy.remote_exec("""
+        import sys
+        import os
+        os.chdir("mandelbrot")
+        sys.path.insert(0, '')
+    """)
+
+|end_small|
+|end_example|
+
+
+Benchmarks
+----------
+
+.. image:: demo-graph.pdf
+   :scale: 45

talks/pypy-course/execnet/title.latex

+\begin{titlepage}
+\begin{figure}[h]
+\includegraphics[width=80px]{../img/py-web.png}
+\end{figure}
+\end{titlepage}