ClearVolume / clearvolume

ClearVolume is a real-time live 3D visualization library designed for high-end volumetric microscopes such as SPIM and DLSM microscopes. With ClearVolume you can see live on your screen the stacks acquired by your microscope instead of waiting for offline post-processing to give you an intuitive and comprehensive view on your data.
http://clearvolume.github.io
GNU Lesser General Public License v3.0
44 stars 11 forks source link

OpenCL error: -5 -> CL_OUT_OF_RESOURCES #61

Closed djarecka closed 7 years ago

djarecka commented 7 years ago

Hi,

I'm getting the OpenCL error: -5 -> CL_OUT_OF_RESOURCES for files that are not very big (~100MB) and that could be open with ImageJ without any problems. Any suggestion what can be the reason? If anyone interested this is my file: https://www.dropbox.com/s/bolaw101j8l6bb0/cells_chec_1ch.tif?dl=0

At the same time I'm able to open other tiff file that are even bigger than this one.

skalarproduktraum commented 7 years ago

Hey @djarecka,

for me, this image opens fine on OSX, with a Geforce GT750M with 2 GB of graphics memory. Could you please post the full console output from ClearVolume so we can figure out the details?

Thanks!

ulrik

djarecka commented 7 years ago

Thank you @skalarproduktraum for your fast answers! I'm sending the console output, wasn't sure what to look at:

ClearGLWindow: GLProfile[GL4/GL4.hw]
1.0
1.0
1.0
MacOS --> Using backend: ClearCLBackendJOCL
________________________________________________________________________________
3 available OpenCL devices:

Device name: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz, type: CPU, OpenCL version: 1.20000 
 max global memory: 17179869184 
 max local memory: 32768 
 clock freq: 2600Mhz 
 nb compute units: 8 
 extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_APPLE_fp64_basic_ops cl_APPLE_fixed_alpha_channel_orders cl_APPLE_biased_fixed_point_image_formats cl_APPLE_command_queue_priority  

Device name: HD Graphics 4000, type: GPU, OpenCL version: 1.20000 
 max global memory: 1610612736 
 max local memory: 65536 
 clock freq: 1250Mhz 
 nb compute units: 16 
 extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_image2d_from_buffer cl_khr_gl_depth_images cl_khr_depth_images cl_khr_3d_image_writes   

Device name: GeForce GT 650M, type: GPU, OpenCL version: 1.20000 
 max global memory: 1073741824 
 max local memory: 49152 
 clock freq: 900Mhz 
 nb compute units: 2 
 extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_APPLE_fp64_basic_ops cl_khr_fp64 cl_khr_3d_image_writes cl_khr_depth_images cl_khr_gl_depth_images cl_khr_gl_msaa_sharing cl_khr_image2d_from_buffer cl_APPLE_ycbcr_422 cl_APPLE_rgb_422   

________________________________________________________________________________
Selected device:
Device name: GeForce GT 650M, type: GPU, OpenCL version: 1.20000 
 max global memory: 1073741824 
 max local memory: 49152 
 clock freq: 900Mhz 
 nb compute units: 2 
 extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_APPLE_fp64_basic_ops cl_khr_fp64 cl_khr_3d_image_writes cl_khr_depth_images cl_khr_gl_depth_images cl_khr_gl_msaa_sharing cl_khr_image2d_from_buffer cl_APPLE_ycbcr_422 cl_APPLE_rgb_422   

Device name:     ClearCLDevice [mClearCLPlatform=ClearCLPlatform [name=Apple], name=GeForce GT 650M] 
java.lang.NullPointerException
    at cleargl.GLTexture.<init>(GLTexture.java:141)
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.ensureTextureAllocated(ClearGLVolumeRenderer.java:630)
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.displayInternal(ClearGLVolumeRenderer.java:508)
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.display(ClearGLVolumeRenderer.java:490)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at jogamp.opengl.GLAutoDrawableBase.defaultWindowResizedOp(GLAutoDrawableBase.java:260)
    at com.jogamp.newt.opengl.GLWindow.access$200(GLWindow.java:119)
    at com.jogamp.newt.opengl.GLWindow$2.windowResized(GLWindow.java:141)
    at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:4383)
    at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:4317)
    at jogamp.newt.WindowImpl.sizeChanged(WindowImpl.java:4520)
    at jogamp.newt.driver.macosx.WindowDriver.reconfigureWindowImpl(WindowDriver.java:474)
    at jogamp.newt.WindowImpl$SetSizeAction.run(WindowImpl.java:1368)
    at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:450)
    at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2782)
    at jogamp.newt.WindowImpl.setSize(WindowImpl.java:1394)
    at com.jogamp.newt.opengl.GLWindow.setSize(GLWindow.java:588)
    at jogamp.newt.awt.event.AWTParentWindowAdapter$1.run(AWTParentWindowAdapter.java:128)
    at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:127)
    at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:375)
OpenCL error: -5 -> CL_OUT_OF_RESOURCES
java.lang.NullPointerException
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.displayInternal(ClearGLVolumeRenderer.java:571)
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.display(ClearGLVolumeRenderer.java:490)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at jogamp.opengl.GLAutoDrawableBase.defaultWindowRepaintOp(GLAutoDrawableBase.java:215)
    at com.jogamp.newt.opengl.GLWindow.access$100(GLWindow.java:119)
    at com.jogamp.newt.opengl.GLWindow$2.windowRepaint(GLWindow.java:136)
    at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:4401)
    at jogamp.newt.WindowImpl.consumeEvent(WindowImpl.java:3372)
    at jogamp.newt.DisplayImpl.dispatchMessage(DisplayImpl.java:680)
    at jogamp.newt.DisplayImpl.dispatchMessage(DisplayImpl.java:707)
    at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:746)
    at jogamp.newt.DisplayImpl$7.run(DisplayImpl.java:672)
    at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:347)
com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: com.jogamp.opengl.GLException: Caught OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES on thread SciJava-320a8ebf-Thread-1-FPSAWTAnimator#00-Timer0
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:92)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: com.jogamp.opengl.GLException: Caught OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES on thread SciJava-320a8ebf-Thread-1-FPSAWTAnimator#00-Timer0
    at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    ... 4 more
Caused by: clearcl.exceptions.OpenCLException: OpenCL error: -5 -> CL_OUT_OF_RESOURCES
    at clearcl.backend.BackendUtils.checkOpenCLError(BackendUtils.java:327)
    at clearcl.backend.jocl.ClearCLBackendJOCL.lambda$enqueueWriteToImage$31(ClearCLBackendJOCL.java:1004)
    at clearcl.backend.BackendUtils.checkExceptions(BackendUtils.java:154)
    at clearcl.backend.jocl.ClearCLBackendJOCL.enqueueWriteToImage(ClearCLBackendJOCL.java:1003)
    at clearcl.ClearCLImage.readFrom(ClearCLImage.java:375)
    at clearcl.ClearCLImage.readFrom(ClearCLImage.java:396)
    at clearvolume.renderer.opencl.OpenCLDevice.writeImage(OpenCLDevice.java:365)
    at clearvolume.renderer.opencl.OpenCLVolumeRenderer.fillWithByteBuffer(OpenCLVolumeRenderer.java:406)
    at clearvolume.renderer.opencl.OpenCLVolumeRenderer.prepareVolumeDataArray(OpenCLVolumeRenderer.java:230)
    at clearvolume.renderer.opencl.OpenCLVolumeRenderer.initVolumeRenderer(OpenCLVolumeRenderer.java:153)
    at clearvolume.renderer.cleargl.ClearGLVolumeRenderer.init(ClearGLVolumeRenderer.java:818)
    at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:644)
    at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:667)
    at jogamp.opengl.GLAutoDrawableBase$1.run(GLAutoDrawableBase.java:431)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1291)
    ... 7 more
skalarproduktraum commented 7 years ago

Hey @djarecka,

so I could imagine that this image hits a resource limit of your GPU -- namely the maximum 3D texture size, which is 2048x2048x2048 for the 650M and 750M. There, it also suffices if only one dimension is exceeded, and not all simultaneously.

Could you try cropping the image slightly, so it'd fit within 2048x2048 and see if that changes the situation?

Thanks!

ulrik

djarecka commented 7 years ago

@skalarproduktraum - thanks a lot! I had to actually crop more than to 2048, but now I'm able to open.

btw. not really related, but do you have any docker container with ClearVolum that you're using. I know there is a Fiji one and can try to change it, but was wondering if you have something already.

skalarproduktraum commented 7 years ago

Glad that helped! We'll add a more descriptive error message in the next version, as well as maybe split the volume into multiple fragments to get over the device limits when necessary.

About Docker: That unfortunately does not work, as there is no solution yet how to achieve GPU passthrough to the container. So far, that only works for CUDA, and not for interactive rendering as we do it. But we are keeping an eye on that for sure!

I'll close that issue for now, let us know if you need anything else :)

cheers!