We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0388ab commit 734eddcCopy full SHA for 734eddc
examples/json-saving.js
@@ -0,0 +1,17 @@
1
+const { GPU } = require('../src');
2
+const gpu1 = new GPU();
3
+
4
+const kernel1 = gpu1.createKernel(function(value) {
5
+ return value * 100;
6
+}, { output: [1] });
7
8
+const resultFromRegularKernel = kernel1(42);
9
+const json = kernel1.toJSON();
10
+console.log(resultFromRegularKernel);
11
12
+// Use bin/gpu-browser-core.js to get "CORE" mode, which works only with JSON
13
+const gpu2 = new GPU();
14
+const kernel2 = gpu2.createKernel(json);
15
+const resultFromJsonKernel = kernel2(42);
16
+console.log(resultFromJsonKernel);
17
0 commit comments