Skip to content

Commit d8bc5e8

Browse files
committed
added response to question- can bokeh use a GPU? Yes!
1 parent ddec753 commit d8bc5e8

File tree

2 files changed

+597
-1
lines changed

2 files changed

+597
-1
lines changed

notebooks/SF_Python_Lightning_Talk.2020_Apr.ipynb

+43-1
Original file line numberDiff line numberDiff line change
@@ -2133,12 +2133,54 @@
21332133
"source": [
21342134
"# [Happy Birthday Python 3!](https://www.python.org/download/releases/3.0/)<br>\n",
21352135
"\n",
2136-
"### (technically yesterday - 3 Dec)\n",
2136+
"### (technically last year - 3 Dec)\n",
21372137
"<br>\n",
21382138
"\n",
21392139
"<img src=\"images/python-logo-master-v3-TM.png\" alt=\"Python Official Logo\" title=\"Python Official Logo\" style=\"float:center; height:400%\"/>"
21402140
]
21412141
},
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+
},
21422184
{
21432185
"cell_type": "markdown",
21442186
"metadata": {

0 commit comments

Comments
 (0)