Top Question How to run parallel computation on GPU javascript?

T

TSR

Guest
I am trying to understand how to run computation for image processing on Javascript using GPU.

I have two list of bytes, 24 millions bytes each, each images are 4_000 by 6_000 = 24_000_000.

I want to just compare image1 with image2 pixel by pixel.

I do with CPU like this:

Mã:
    let image1: number[] = [
        // 24 millions bytes
    ]
    let image2: number[] = [
        // another 24 millions bytes
    ]
    let difference = 0
    for (let i = 0; i < image1.length; i ++){
        if (image1[1] === image2[2]) continue
        difference ++
    }
    console.log(`Diffence is ${(difference /image1.length).toFixed(2) }`)

This takes a few seconds on CPU.

But how to do it on GPU to make it faster? We could breakdown the list into chunks and do the comparison of each chunk on a GPU core.

I could not find an example code online

Answer for: "How to run parallel computation on GPU javascript?"...
 

Similar threads

A
Trả lời
0
Lượt xem
72
Al-Zubair
A
U
Trả lời
0
Lượt xem
88
user16733810
U
Top