Reputation: 33
This might sound like a stupid question but anyways; When I try to reference the gpu-browser.js file in my html it doesn't affect my other scripts. Its as if I never put it in, when I try to do the code snippet provided in the documentation it gives me this error:
Uncaught TypeError: GPU is not a constructor
Specifically my code looks like this:
<script src="node_modules/gpu.js/dist/gpu-browser.min.js"></script>
<script>
// GPU is a constructor and namespace for browser
const gpu = new GPU();
const multiplyMatrix = gpu.createKernel(function(a, b) {
let sum = 0;
for (let i = 0; i < 512; i++) {
sum += a[this.thread.y][i] * b[i][this.thread.x];
}
return sum;
}).setOutput([512, 512]);
const c = multiplyMatrix(a, b);
</script>
I installed gpu.js with npm --save and am using Python version 3.11.
Upvotes: 0
Views: 69