4f822e1turing-surface-cache: reaction-diffusion solutions at a chosen end time, shared through a cloud cacheJeremy Magland 1
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><circle cx=%2250%22 cy=%2250%22 r=%2245%22 fill=%22%232a5f7f%22/><circle cx=%2235%22 cy=%2238%22 r=%2211%22 fill=%22%23f5d547%22/><circle cx=%2265%22 cy=%2258%22 r=%229%22 fill=%22%23f5d547%22/><circle cx=%2248%22 cy=%2274%22 r=%227%22 fill=%22%23f5d547%22/><circle cx=%2268%22 cy=%2230%22 r=%226%22 fill=%22%23f5d547%22/></svg>" />
7 <title>turing-surface-cache — reaction-diffusion solutions from a shared cloud cache</title>
e53205fShow one parameter across its range, not only at a pointJeremy Magland 8 <link rel="stylesheet" href="/src/styles.css" />
4f822e1turing-surface-cache: reaction-diffusion solutions at a chosen end time, shared through a cloud cacheJeremy Magland 9 </head>
10 <body>
11 <main>
12 <h1>turing-surface-cache</h1>
13 <p class="sub">
14 Reaction-diffusion (Turing patterns) on curved surfaces, evaluated at a
15 chosen end time. Every setting is a choice from a short list, so each
16 combination names one exact solution. Solutions already in the shared
17 cloud cache load by themselves as you browse the choices; a
18 combination no one has computed shows empty surfaces until you press
19 <b>Compute solution</b>, which runs it here (with WebGPU, via
20 <a href="https://github.com/concept-collection/turing-surface">turing-surface</a>'s
e53205fShow one parameter across its range, not only at a pointJeremy Magland 21 spectral solver). Drag to rotate. Or take one parameter through its
22 whole range on the <a id="sweeplink" href="sweep.html">parameter
23 sweep</a> page.
4f822e1turing-surface-cache: reaction-diffusion solutions at a chosen end time, shared through a cloud cacheJeremy Magland 24 </p>
26 <label title="The reaction-diffusion system being solved">model
27 <select id="model"></select>
28 </label>
29 <span id="params" class="controls" style="padding: 0"></span>
30 </div>
4f822e1turing-surface-cache: reaction-diffusion solutions at a chosen end time, shared through a cloud cacheJeremy Magland 31 <div class="controls">
32 <label title="The surface the pattern is solved on">geometry
33 <select id="geometry"></select>
34 </label>
35 <span id="geomparams" class="controls" style="padding: 0"></span>
36 </div>
37 <div class="controls">
38 <label title="Which random initial perturbation to start from">seed
39 <select id="seed"></select>
40 </label>
41 <label title="The solution is reported at this simulation time">end time
42 <select id="tend"></select>
43 </label>
44 <button id="solve" class="primary"
45 title="Compute the selected solution in your browser. Cached solutions load by themselves as you change the selection.">Compute solution</button>
46 <button id="stop" hidden>Stop</button>
47 <button id="reset" title="Set every selection back to its default">Reset to defaults</button>
48 <span id="cachenote"></span>
49 </div>
50 <p id="status"></p>
51 <div id="panels"></div>
52 <div class="controls">
53 <button id="resetview">Reset view</button>
54 <a id="download" hidden download>Download .h5</a>
55 </div>
56 <p class="stats" id="stats"></p>
57 <div class="cloud">
58 <span>Solutions computed here can be contributed back to the shared
59 cache, so the next visitor gets them instantly. Contributing
60 requires an upload API key.</span>
61 <div class="controls">
62 <label>upload API key
63 <input id="apikey" type="password" autocomplete="off" placeholder="(optional)" />
64 </label>
65 <span id="uploadnote"></span>
66 </div>
1a1e473Add auto-fill: work through the parameter space on an idle machineJeremy Magland 67 <div class="controls" id="autobar" hidden>
68 <button id="auto"
69 title="Work through the parameter space on this machine, nearest the defaults first, computing and uploading whatever is not cached yet. Runs until stopped.">Auto-fill the cache</button>
70 <span id="autonote"></span>
71 </div>
b32cc02Offer the fill command in the page, ready to copyJeremy Magland 72 <div class="controls" id="clibar" hidden>
73 <span>or on a machine with no browser on it:</span>
74 <code id="clicmd"></code>
75 <button id="clicopy"
76 title="Copies the command with your key in it. The key is masked here so that it stays out of screenshots.">Copy command (includes your key)</button>
77 <span id="clicopied"></span>
78 </div>
d71391eFold the troubleshooting into the page, beside the commandJeremy Magland 79 <details id="clihelp" hidden>
80 <summary>if that command does not run on the other machine</summary>
81 <p><code>Unexpected token {</code>, or another syntax error, means that
82 machine's node is too old to read the program at all: node 18 or newer
83 is needed. nodejs.org has current builds, and nvm, fnm and asdf install
84 one per user without touching what the system depends on; where a
85 cluster uses environment modules, <code>module load node</code> may be
86 all it takes.</p>
87 <p><code>the webgpu package is installed but did not load … GLIBC_2.34
88 not found</code> means the machine's distribution is older than the
89 prebuilt Dawn binary — ordinary on a long-lived Linux workstation, since
90 Rocky and RHEL 8 have glibc 2.28 and Dawn wants 2.34. Running the
91 command inside a container is the obvious answer and the wrong one:
92 there the NVIDIA driver declines to bring up its Vulkan driver, while
93 on the host it comes up fine. What does work is borrowing a newer
94 userland from a container image and running node through <em>that</em>
95 loader, still on the host, so the GPU, <code>/dev</code> and
96 <code>/proc</code> are exactly what they were:</p>
97 <pre># 1. borrow a userland — podman or docker unpacks it; nothing runs inside it
98mkdir -p ~/turing-userland
99podman create --name u docker.io/library/node:22-bookworm-slim true
100podman export u | tar -x -C ~/turing-userland
101podman rm u
103# 2. a node that uses it, running on the host rather than in a container
104U=~/turing-userland; mkdir -p ~/turing-bin
105printf '#!/bin/sh\nexec %s --library-path %s %s "$@"\n' \
106 $U/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \
107 $U/usr/lib/x86_64-linux-gnu:$U/lib/x86_64-linux-gnu:/usr/lib64 \
108 $U/usr/local/bin/node > ~/turing-bin/node
109chmod +x ~/turing-bin/node
7df2a28Borrow npx along with node, since the recipe needs bothJeremy Magland 111# 3. and the borrowed npx, which is a script rather than part of node
112printf '#!/bin/sh\nexec ~/turing-bin/node %s "$@"\n' \
113 $U/usr/local/lib/node_modules/npm/bin/npx-cli.js > ~/turing-bin/npx
114chmod +x ~/turing-bin/npx
116# 4. run the command above, with those found first
d71391eFold the troubleshooting into the page, beside the commandJeremy Magland 117export PATH=~/turing-bin:$PATH</pre>
118 <p>The host's own <code>/usr/lib64</code> stays last on that library
119 path, and is where the NVIDIA libraries and the Vulkan loader come
120 from: those have to match the running kernel module, so they must be
121 the machine's own. If podman's storage lives on NFS it will fail to
122 unpack the image, which
123 <code>--root /tmp/$USER/store --runroot /tmp/$USER/run</code> on each
124 podman command works around.</p>
7df2a28Borrow npx along with node, since the recipe needs bothJeremy Magland 125 <p>Note that <code>npx</code> has to be borrowed as well as
126 <code>node</code>. It is not part of node but a script beside it,
127 so a machine whose own node is too old has an <code>npx</code> too
128 old to go with it, and putting only a node on the path leaves that
129 old one to be found. Its symptoms are its own rather than the
130 version error above, since it is a different program from the npx
131 of any current node.</p>
d71391eFold the troubleshooting into the page, beside the commandJeremy Magland 132 <p><code>WebGPU is not available</code>, or no adapter at all, means
133 there is no GPU to reach: Dawn goes through Vulkan on Linux and Metal
134 on macOS, so a machine without a GPU, or with one whose driver is not
135 installed, has nothing to offer.
136 <code>DAWN_FLAGS='backend=vulkan'</code> makes it say more about why.</p>
137 <p>A rate of a few steps per second rather than a few hundred means a
138 software rasterizer has stood in for the GPU. The command names its
139 adapter on the first line and says so when it notices, but it does not
140 refuse to run — a slow contribution is still a contribution, if that is
141 what you meant.</p>
142 </details>
4f822e1turing-surface-cache: reaction-diffusion solutions at a chosen end time, shared through a cloud cacheJeremy Magland 143 </div>
144 <p id="err"></p>
145 </main>
146 <script type="module" src="/src/main.ts"></script>
147 </body>
148</html>