Commit 7f4be3e7f95 by Pierre Augier

Notebooks and nbsphinx

parent 4679be99b35
......@@ -14,21 +14,8 @@
# import sys
# import os
# to be able to build the doc without h5py with Read the docs
# import fluiddoc
# if fluiddoc.on_rtd:
# print('Mock modules to build the documentation on READTHEDOCS.')
# # this package comes from fluiddyn
# fluiddoc.mock_modules([])
import transonic
from fluiddoc.ipynb_maker import ipynb_to_rst
# ipynb_to_rst()
ipynb_to_rst("ipynb/executed", executed=True)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
......@@ -52,6 +39,7 @@ extensions = [
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"numpydoc",
"nbsphinx",
# 'mathmacro',
]
......@@ -101,7 +89,7 @@ exclude_patterns = [
"_build",
"**.ipynb_checkpoints",
"for_dev/cython_bugs/**/*.md",
"for_dev/scikit-image/README.md"
"for_dev/scikit-image/README.md",
]
# The reST default role (used for this markup: `text`) to use for all
......
......@@ -10,4 +10,4 @@ dependencies:
- sphinx_rtd_theme
- sphinx
- numpydoc
- fluiddyn
- nbsphinx
......@@ -28,3 +28,11 @@ The last command gives something like::
For the solution with loops, the 2 backends are equally good.
For Pythran, it is much faster with the high level implementation!
See also how to accelerate the same function in a Jupyter notebook with the
``jit`` decorator:
.. toctree::
:maxdepth: 1
../../ipynb/executed/fxfy
\ No newline at end of file
......@@ -114,6 +114,13 @@
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Module /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/tmp.py has not been compiled for Transonic-Pythran\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
......@@ -174,8 +181,23 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running transonic on file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/tmp.py... Done!\n",
"Running transonic on file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/tmp.py... "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Schedule pythranization of file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/__pythran__/tmp.py\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done!\n",
"Launching Pythran to compile a new extension...\n",
"compile extension\n",
"result func(1): 2\n"
]
}
......@@ -193,7 +215,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"__pycache__/ tmp.py\n"
"__pycache__/ tmp.py tmp.pythran\n"
]
}
],
......@@ -265,7 +287,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2,2,2,2,2,"
"2,2,2,2,"
]
}
],
......@@ -315,8 +337,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"__pycache__/ tmp.py\n",
"tmp_26ab178b59974a4f661ae5399989c3f1.cpython-36m-x86_64-linux-gnu.so\n"
"__pycache__/\n",
"tmp_1d6e23bef2cfcc6433ed9fb72bfc237b.cpython-37m-x86_64-linux-gnu.so\n",
"tmp.py\n",
"tmp.pythran\n"
]
}
],
......@@ -412,8 +436,23 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running transonic on file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/tmp.py... Done!\n",
"Running transonic on file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/tmp.py... "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Schedule pythranization of file /home/users/augier3pi/Dev/transonic/doc/ipynb/executed/__pythran__/tmp.py\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done!\n",
"Launching Pythran to compile a new extension...\n",
"compile extension\n",
"result func(1): 4\n"
]
}
......@@ -465,7 +504,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"4,4,4,4,4,"
"4,4,4,4,"
]
}
],
......@@ -485,9 +524,10 @@
"output_type": "stream",
"text": [
"__pycache__/\n",
"tmp_26ab178b59974a4f661ae5399989c3f1.cpython-36m-x86_64-linux-gnu.so\n",
"tmp_5a9e4142c349b2479b238a14d1369378.cpython-36m-x86_64-linux-gnu.so\n",
"tmp.py\n"
"tmp_1d6e23bef2cfcc6433ed9fb72bfc237b.cpython-37m-x86_64-linux-gnu.so\n",
"tmp_8f26902a8535affef02e7e4b9b7f4283.cpython-37m-x86_64-linux-gnu.so\n",
"tmp.py\n",
"tmp.pythran\n"
]
}
],
......@@ -631,9 +671,10 @@
"output_type": "stream",
"text": [
"__pycache__/\n",
"tmp_26ab178b59974a4f661ae5399989c3f1.cpython-36m-x86_64-linux-gnu.so\n",
"tmp_5a9e4142c349b2479b238a14d1369378.cpython-36m-x86_64-linux-gnu.so\n",
"tmp.py\n"
"tmp_1d6e23bef2cfcc6433ed9fb72bfc237b.cpython-37m-x86_64-linux-gnu.so\n",
"tmp_8f26902a8535affef02e7e4b9b7f4283.cpython-37m-x86_64-linux-gnu.so\n",
"tmp.py\n",
"tmp.pythran\n"
]
}
],
......@@ -687,9 +728,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
......@@ -17,15 +17,8 @@
"source": [
"import numpy as np\n",
"\n",
"from transonic import jit"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from transonic import jit\n",
"\n",
"@jit\n",
"def laplace_pythran(image):\n",
" \"\"\"Laplace operator in NumPy for 2D images.\"\"\"\n",
......@@ -39,15 +32,21 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32mINFO \u001b[0m \u001b[34mwrite Pythran signature in file /home/users/augier3pi/.transonic/__jit__/__ipython__2823fa65cda0fe3f58b60391a9d2e13b/laplace_pythran.pythran with types\n",
"['float64[:, :]']\u001b[0m\n"
"INFO: Schedule pythranization of file /home/users/augier3pi/.transonic/pythran/__jit__/__ipython__47f8727e8bd9e9dff2a4415001759d2d/laplace_pythran.py\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"compile extension\n"
]
},
{
......@@ -62,7 +61,7 @@
" [False, False, False, ..., True, True, False]])"
]
},
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
......@@ -101,9 +100,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Benchmark in Jupyter with the `jit` decorator"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
......
......@@ -40,7 +40,7 @@ doc =
numpydoc
ipython
jupyter
fluiddyn
nbsphinx
recommonmark
dev =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment