|
2133 | 2133 | "source": [
|
2134 | 2134 | "# [Happy Birthday Python 3!](https://www.python.org/download/releases/3.0/)<br>\n",
|
2135 | 2135 | "\n",
|
2136 |
| - "### (technically yesterday - 3 Dec)\n", |
| 2136 | + "### (technically last year - 3 Dec)\n", |
2137 | 2137 | "<br>\n",
|
2138 | 2138 | "\n",
|
2139 | 2139 | "<img src=\"images/python-logo-master-v3-TM.png\" alt=\"Python Official Logo\" title=\"Python Official Logo\" style=\"float:center; height:400%\"/>"
|
2140 | 2140 | ]
|
2141 | 2141 | },
|
| 2142 | + { |
| 2143 | + "cell_type": "code", |
| 2144 | + "execution_count": 6, |
| 2145 | + "metadata": { |
| 2146 | + "slideshow": { |
| 2147 | + "slide_type": "slide" |
| 2148 | + } |
| 2149 | + }, |
| 2150 | + "outputs": [], |
| 2151 | + "source": [ |
| 2152 | + "# Audience Question: Can Bokeh use GPU?\n", |
| 2153 | + "\n", |
| 2154 | + "# Updated response: Yes - Bokeh can leverage the GPU with release 2.0.1 on 2020.03.31\n", |
| 2155 | + "# example from this page: https://docs.bokeh.org/en/latest/docs/user_guide/webgl.html\n", |
| 2156 | + "\n", |
| 2157 | + "# setup a lot of points to graph\n", |
| 2158 | + "import numpy as np\n", |
| 2159 | + "\n", |
| 2160 | + "from bokeh.plotting import figure, show, output_file\n", |
| 2161 | + "\n", |
| 2162 | + "N = 10000\n", |
| 2163 | + "\n", |
| 2164 | + "x = np.random.normal(0, np.pi, N)\n", |
| 2165 | + "y = np.sin(x) + np.random.normal(0, 0.2, N)\n", |
| 2166 | + "\n", |
| 2167 | + "# run without webGL\n", |
| 2168 | + "output_file(\"scatter10k.html\", title=\"scatter 10k points (no WebGL)\")\n", |
| 2169 | + "\n", |
| 2170 | + "p = figure(output_backend=\"canvas\")\n", |
| 2171 | + "p.scatter(x, y, alpha=0.1)\n", |
| 2172 | + "show(p)\n", |
| 2173 | + "\n", |
| 2174 | + "# run with webGL\n", |
| 2175 | + "output_file(\"scatter10k.html\", title=\"scatter 10k points (with WebGL)\")\n", |
| 2176 | + "\n", |
| 2177 | + "p = figure(output_backend=\"webgl\")\n", |
| 2178 | + "p.scatter(x, y, alpha=0.1)\n", |
| 2179 | + "show(p)\n", |
| 2180 | + "\n", |
| 2181 | + "# for fun - create a timing decorator, and run both of these on a machine with a GPU, some new cells comparing runtimes " |
| 2182 | + ] |
| 2183 | + }, |
2142 | 2184 | {
|
2143 | 2185 | "cell_type": "markdown",
|
2144 | 2186 | "metadata": {
|
|
0 commit comments