Hacker News new | past | comments | ask | show | jobs | submit login
Gpu.js: GPU Accelerated JavaScript (github.com/gpujs)
106 points by nateb2022 on Jan 22, 2023 | hide | past | favorite | 10 comments



This library transpiles JS to WebGL which allows computations to run in parallel on the GPU instead of one by one on the main JS thread.

I used this library to prototype shademap but I think it's no longer maintained. I PRed a fix to correct atan2 over a year ago and no movement [1].

Because this library optimized for simplicity over performance, switching to vanilla WebGL will get you better performance (especially with textures) in the long run.

I do highly recommend it if you're a web developer interested in harnessing parallel processing.

[1] https://github.com/gpujs/gpu.js/pull/683


The repo shows activity within the last two months. Might need to ping a maintainer with your PR number.


Related:

Gpu.js – GPU Accelerated JavaScript - https://news.ycombinator.com/item?id=19264154 - Feb 2019 (113 comments)

Gpu.js – GPU Accelerated JavaScript - https://news.ycombinator.com/item?id=14773964 - July 2017 (77 comments)


I assume that any general purpose user should probably begin with web workers? I’m guessing this is very fast for specific kinds of processing tasks?


Is there an equivalent for Python? Which one is most widely used?


You can use Numba which is for generic accelerated work, or really any ML library will have math primatives you can use just fine for non ML purposes. That said there are overhead considerations and restrictions compared to normal Python programming for any of these solutions so make sure you really need the GPU.


And how about Ruby anyone?


I wish NumPy had it built in.


has someone taken this to its logical conclusion and made a way to run models from PyTorch etc?


So, kinda like CUDA but works in browsers. Cool!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: