clij / clij2

GPU-accelerated image processing for everyone
https://clij.github.io/clij2
Other
48 stars 14 forks source link

CLIJ issue in applying non local means filter on GPU #46

Closed muntahi398 closed 2 years ago

muntahi398 commented 2 years ago

Hello, I am trying to apply non local means filter on my 3D CT images which are 1GB files. I have GPU rtx 2080 with 8GB memory installed and CLIJ GUI shows right GPU. But when I try to apply this filter, it says,

package net.haesleinhuepf.clij2.plugins, clij2, version 0.0 Overwriting image in cache. CLIJ2 Warning: You're creating an image with size 3.6 gigabytes, which exceeds your GPUs capabilities (max 2.0 gigabytes). package net.haesleinhuepf.clijx.plugins, clijx, version 0.0 CLIJ2 Warning: You're creating an image with size 3.6 gigabytes, which exceeds your GPUs capabilities (max 2.0 gigabytes). CLIJ2 Warning: You're creating an image with size 3.6 gigabytes, which exceeds your GPUs capabilities (max 2.0 gigabytes). CLIJ Error: Creating an image or kernel failed because your device ran out of memory. You can check memory consumption in CLIJ2 by calling these methods from time to time and see which images live in memory at specific points in your workflow: Ext.CLIJ2_reportMemory(); // ImageJ Macro print(clij2.reportMemory()); // Java/groovy/jythonFor support please contact the CLIJ2 developers via the forum on https://image.sc . Therefore, please report the complete error message, the code snippet or workflow you were running, an example image if possible and details about your graphics hardware.

Am I making a mistake or there is some bug in here? Can anyone comment on this please?

haesleinhuepf commented 2 years ago

Hi @muntahi398 ,

thanks for reaching out! First of all, your GPU has 8 GB of memory and the NVidia driver allows up to 2 GB per image. That's why it says "exceeds your GPUs capabilities (max 2.0 gigabytes)." in the error message. The question is now, why does it try to generate a 3.6 GB image even though your image appears to be 1 GB. I presume, you preprocess an 8-bit input image before sending it to the non-local-means-filter where it is turned into a 32 bit float image that is four times as large as the original input image. Can you cross-check that by calling 'Ext.CLIJ2_pull()' before calling NLM? Otherwise, it would be great if you could provide a minimum working example allowing me to reproduce your issue.

Furthermore, please note that there is currently an error in the NLM code, as discussed here which I didn't find time for yet to fix. Thus, if you manage to run the filter, it may not work properly anyway. Also note that the NLM is part of clijX, where the X stands for eXperimental. Please be a bit careful with experimental stuff.

Let me know if this helps!

Best, Robert