need global variables for big data to put it on GPU only once
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- performance
Hướng nghiên cứu
Không có tệp mã nguồn, bài kiểm thử hoặc điểm vào nào được nêu. Hãy bắt đầu bằng việc kiểm tra các API hiện có cho đầu vào GPU/kernel và quản lý kết quả, sau đó xác định liệu dữ liệu persistent được GPU hỗ trợ và khả năng truy cập từng phần vào kết quả có phù hợp với kiến trúc của dự án hay không; được coi là hoàn tất khi việc tái sử dụng dữ liệu được yêu cầu hoạt động mà không cần truyền lặp lại hoặc cấp phát trung gian quá lớn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What i am working at?
I am developing a program to visualize voxel data by placing many canvases in space, my voxel data is stored as
[ [ Int16Array(2), Int16Array(2) ],[ Int16Array(2), Int16Array(2) ] ] (that is example for 2x2x2px voxel data)
but in real tasks data is often 512x512x512px ( so i need near 256MiB for this data)
let example of voxel data is [[ [0,1], [2,3] ],[ [4,5], [6,7] ]]

so i have 2 x layers 0: [ [0,4], [2,6] ], 1: [ [1,5], [3,7] ]
so i have 2 y layers 0: [ [0,1], [4,5] ], 1: [ [2,3], [6,7] ]
so i have 2 z layers 0: [ [0,1], [2,3] ], 1: [ [4,5], [6,7] ]
and before placing one layer of voxel data on canvas i need to replace voxel value with color
and for this i have array to replace values to color but in special way:
ColArray example:

(in program it is Uint8Array([r0,g0,b0,a0, r1,g1,b1,a1, ...]) )
What is wrong?
so to get color value i must do next operations for each voxel

which will do next

what i can do with is gpu.js is for example:
(lenM1 = colArray.lenght - 1, delta = max - min)
const calc = gpu.createKernel(function(data,min,delta,lenM1) {
return Math.round( (data[this.thread.z][this.thread.y][this.thread.x]-min)/delta*lenM1 )
}, { output: [Xsize,Ysize,Zsize] })
const ColArrayIndexes = calc(...)
but if i give data (int16 512x512x512 memory usage 256 MiB)
and i get result (float32 512x512x512 memory usage 512 MiB)
and once i get alocation error when trying to get result (and that is not PC problem it is js memory managment problem)
also i dont need all result for one layer i need only part of it
Another way to solve the problem was to calc and return only one canvas
const render = gpu.createKernel(function( data, __ ) {
this.color( __ );
}).setOutput([ __ , __ ]).setGraphical(true);
render();
const pixels = render.getPixels();
// and put pixels to canvas
buuuuuut to calc one Canvas i need parts from all data, and if for z layers i can just use js array.slice() method for x and y i need to give all data (i said what are x y and z layers for me near first img)
so when i dive all data (256 MiB) from RAM to GPU memory (if i correctly undarstand how it works) it take some time
and when i want to calc all 512 X layers + all 512 Y layers + all 512 Z layers i give same data (256 MiB) 1536 times and that is not OK and need some time
Where does it happen?
PC:
i7 9700K
RTX 3070
16GB RAM
(but my program also must work normal on mobile and so big memory changes is not good)
Expected solution
i think that my problem can have solution like this
const gpu = new GPU();
gpu.setGlobalVariable( dataName , data ) // put data to GPU memory
const render = gpu.createKernel(function( ___ ) {
return dataName[] // do some math operations (i need only read, but modify can be also cool and useful)
}).setOutput([ __ , __ ])
gpu.destroyGlobalVariable( dataName ) // delete data from GPU memory
also a little better way
const func = gpu.createKernel(function( data ) {
return data[this.thread.z][this.thread.y][this.thread.x] // some operations with given values
}).setOutput([ __ , __ ]).setOutputIsGPUglobalVariable(true) // function will save result only in GPU memory, and can return some parts of it when it is needed
const CalcResultID = func(data) //return only link on data or function to get parts
// also it is good if can get result of calculations in another GPU functions
gpu.destroyGlobalVariable( CalcResultID ) // delete data from GPU memory
- Ngôn ngữ chính
- JavaScript
- Star
- 15.5k
- Fork
- 663
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của gpujs/gpu.js
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
WebGL backend silently returns all zeros for long-running kernels (no GL error, no context loss)Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Bitwise result not correctĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Issue tương tự
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/ai#21528 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status: waiting triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
freeCodeCamp/freeCodeCamp#70412 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rohitg00/ai-engineering-from-scratch#490 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 6 ngày