JolifantoBambla / volume-viewer

A web-based volume viewer for large-scale multichannel volume data
MIT License
1 stars 0 forks source link

cache size considerations #8

Open JolifantoBambla opened 2 years ago

JolifantoBambla commented 2 years ago

For now I'll use a cache of size 2048x2048x512, but in the future this should be a parameter that's controllable by the user.

for a volume of 8192x8192x200 and a brick size of 128x128x128 I need 8532 bricks to represent the whole volume (1 channel!) (assuming no brick is empty w.r.t. thresholds / transfer functions) per resolution:

in a 1024x1024x1024 brick cache I can store 512 such bricks but takes 1.07 GB

in a 2048x2048x512 brick cache I can store 1024 such bricks but takes 2.15 GB

in a 2048x2048x2048 brick cache I can store 4096 such bricks but takes 8.59 GB

My laptop has ~4 GB GPU memory so 2048x2048x512 might be a good fit

-> one parameter has to be max resolution

for dataset above only use lower 4 resolutions then 1 channel (532 bricks) would fit into cache, but 2 channels (1064 bricks), or 3 channels (1596 bricks) wouldn't (but that's not the goal anyway)

-> maybe make max resolution a per channel property

JolifantoBambla commented 2 years ago

Available GPU memory can't be queried, but vendor and device id may be available which could be used to query available memory from a predefined map of known devices to their GPU mem sizes.

JolifantoBambla commented 1 year ago

this is configurable. querying gpu name and vendor is a safety issue and therefore only enabled with the appropriate developer flags enabled in the browser. however, checking for allocation errors and choosing a lower cache size in case of an error is an option