25 questions
2
votes
0
answers
253
views
Getting a gl error when trying to install gpu.js
I'm trying to install gpu.js, but I keep getting error:
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /Users/lukelin/...
0
votes
0
answers
92
views
How do I correctly reference gpu-browser.js?
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 ...
1
vote
0
answers
113
views
Simple average calculation using GPU.js
I’m trying to adapt a fairly simple old function to use the GPU.js library and make it faster. Hopefully, once I’ve got my head around some of the concepts I can build on it to speed up the ...
0
votes
1
answer
157
views
Calculations in GPU.js giving different results in CPU and GPU modes
I'm trying to use GPU.js to draw the Mandelbrot set.
A problem I'm having though is math within the kernel function is giving different results when run in CPU mode vs GPU mode. Here's the kernel ...
0
votes
1
answer
472
views
gpu.js with BigDecimal or float64array possible?
I am writing a mandelbrot-calculator with the help of gpu.js and till now, everything works perfectly fine. The only issue I am facing is, that the GPU only wants to compute 32-Bit floats. Or at least ...
1
vote
1
answer
223
views
How to implement a for loop inside a combineKernel in GPU.js
I'm new to gpu.js and I need help. Basically I want to access my two kernel functions but I don't know how without sacrificing the expense of calling createKernel each time. I know there is ...
1
vote
1
answer
388
views
How can I access the values given by gpu.js
I am learning to use gpu.js to do calculations in the GPU. I am able to do my calculations for two JavaScript matrices a and b and to display the result as a canvas image.
Question: How can I access ...
1
vote
0
answers
166
views
how can we use native methods of array in gpu js like length push pop. It gives me an error of unexpected expression
const A = [9, 2];
const test = gpu
.createKernel(function (A) {
return A.length;
})
.setOutput([1]);
console.log(test(A));
ERROR:
throw this.astErrorOutput('Unexpected expression', ast);
^
...
1
vote
1
answer
251
views
GPU.js calculating distance between multi objects xyz?
I try to write some very fast logic to detect all collisions in game.
So I using GPU.js for this and my code was crashing because I trying to create new array variable inside function?
I need list of ...
0
votes
1
answer
424
views
React asynchronously rendering multiple components with states
I'm trying to make use of GPU.js in a sample CRA React project. I'm trying to make a visible comparison between CPU & GPU calculations, but React "waits" for CPU calculations to finish ...
0
votes
1
answer
1k
views
How do I run this function with GPU.js?
I want to run this permutations function on GPU.
function* permute(permutation) {
var length = permutation.length;
var c = Array(length).fill(0);
var i = 1;
var k;
var p;
yield ...
2
votes
0
answers
238
views
gpu.js "Error: not enough arguments for kernel"
I have some heavily calculating canvas effects in a react app that I'm making. I have been trying to figure out how to do it for about 2 days, and It's almost working but I have this one error that I ...
1
vote
0
answers
290
views
How to efficiently feed the output of a GPU JS function back into it?
I am attempting to use GPU JS to accelerate the performance of a dynamic programming algorithm.
Here is my current code:
let pixels = new Uint32Array(5 * 5);
for (let i = 0; i < pixels.length; i++)...
0
votes
0
answers
649
views
Wrong values with using gpu.js
I use my code in modes 'dev', 'gpu' and 'cpu'. When I run up my code in 'dev' mode I had right number of results word 'more' in almost 100mb file. There is 259200 words 'more'. But when I run it up in ...
0
votes
3
answers
107
views
Is there a better way of finding solution than using nested loops?
I am looking to speed up the process of testing all the combinations based on the nested loops in the piece of code included.
I am currently stuck with JavaScript and NodeJS on Windows 10.
Is there a ...
1
vote
2
answers
2k
views
How to pass off heavy JavaScript math operations to GPU with GPU.js
Background
I've built a little web based application that pops up windows to display your webcam(s). I wanted to add the ability to chroma key your feed and have been successful in getting several ...
7
votes
1
answer
565
views
How do I know how many matrix operations a GPU can do in parallel?
I'm using a JS library called GPU.js. Used like so:
const gpu = new GPU();
const multiplyMatrix = gpu.createKernel(function(a, b) {
let sum = 0;
for (let i = 0; i < 512; i++) {
sum +...
1
vote
0
answers
456
views
"Identifier is not defined" when using variable in gpu.js - why?
I am puzzled by an error I get with gpu.js. I am trying to do GPU-based calculations of nearest point on line, as I have to process hundreds of points against a line with thousands of segments.
See in-...
2
votes
0
answers
125
views
How does 'gpu.js' manipulate GPU threads?
I am working on an arbitrary-precision Mandelbrot fractal browser, and I want to take advantage of the GPU in order to do so. However; I don't really want to use anyone else's library for a few ...
0
votes
1
answer
332
views
Using gpu.js for cellular automata
I'm trying to run 1D cellular automata using gpu.js, but it looks that my code without gpu.js is 20 times faster. I cannot understand where is the issue.
The code below runs cellular automata for ...
0
votes
1
answer
273
views
Why is conversion from an untyped array to Uint8ClampedArray so slow?
I've got a rendering pipeline where I'm trying out gpu.js as my shader mechanism. From what I can tell though, while gpu.js can take a typed array buffer as input, there's no way to output to a typed ...
0
votes
1
answer
233
views
Algorithm for this gpu operation?
I'm using a library that allows computing large matrix operations on the GPU, gpu.js. What I'm trying to do is not really hard I don't think but I can't seem to begin to figure out the algorithm for ...
3
votes
1
answer
535
views
gpus.js (webgl?) float32 issue
I'm probably missing something obvious, but i'm experimenting with gpu.js and getting some strange results. I just want to make sure i'm not doing something obviously stupid (which is likely).
Not ...
2
votes
0
answers
1k
views
gpu.js in web worker
I'm trying to run gpu.js in a web worker, but can't seem to get it to work at all.
I'm running importScripts to load the library within the worker, but I'm not getting the GPU object in the worker ...
4
votes
3
answers
1k
views
GPU Parallelism in Javascript going slower
This is kind of a specific problem. I have recently tested out gpu.js. This library is supposed to accelerate computations by using webgl to parallelize computations. I made a quick test:
var gpu = ...