opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.4k stars 5.76k forks source link

Kinect Fusion and OpenCL fails on NVIDIA RTX 2060- clEnqueueNDRangeKernel (-5) #2422

Closed carlos-martinez closed 4 years ago

carlos-martinez commented 4 years ago

Hi,

This is a follow-up of issue: https://github.com/opencv/opencv_contrib/issues/2029

I just wondering if this has been solved for NVIDIA cards. I am still having the same error mentioned before:

_OpenCL error CL_OUT_OFRESOURCES (-5) during call: clEnqueueNDRangeKernel('fillPtsNrm', dims=3, globalsize=512x512x512, localsize=8x8x16) sync=true

I have:

I used the code provided in thread. I tested the code "reproduce_kinfu_failures_V2.cpp", which I just modified to print the extra information about the GPU device. I am attaching the source and output logs.

Is there a solution besides disabling the optimization?

Thanks

PS ... I used tools (e.g. https://www.geeks3d.com/20200117/gpu-caps-viewer-1-44-0-released/) to verify that OpenCL was working in the GPU.

reproduce_kinfu_failures_v2.zip

carlos-martinez commented 4 years ago

Hi,

Just to give more information, hoping this can help to figure it out what the issue is.

We got a brand new notebook with GeForce RTX2060. The error is the same as the desktop with the GeForce RTX206 SUPER. In this computer, we mainly installed: o PCL 10.0 (binary installation) o Build OpenCV 2.0 (release and contrib) o CMake o VS 2019

The curious issue is that we have an “older” laptop with GeForce MX250 card. This computer does not present the problem.

Let me know if there is more information I can provide.

Thanks

wanghuan10 commented 4 years ago

I find the same problem.

Kinect DK OpenCV 4.1.2 RTX2070

OpenCL error CL_OUT_OF_RESOURCES (-5) during call: clEnqueueNDRangeKernel('fillPtsNrm', dims=3, globalsize=512x512x512, localsize=8x8x16) sync=true

Thanks!!

carlos-martinez commented 4 years ago

Hi,

I don’t know how generic my findings are, but it seems that Kinfu algorithm does not work with the Nvidia architecture 7.5 (i.e. rtx 2060 and 2070). We have successfully run it on the Nvidia architecture 6.x (i.e. rtx 1060 and 1070).

I don’t have the background to evaluate if this is a easy fix or not, and even if the change is needed at the Kinfu algorithm or OpenGL driver.

At least for now, we’ll just avoid that configuration.

Thanks

wanghuan10 commented 4 years ago

Thanks for your information!!

kyndred commented 4 years ago

Can confirm same issue with Nvidia rtx 2080ti.

yoyiji commented 4 years ago

the same here.

Kinect DK OpenCV 4.1.0(opencv_contrib-4.1.0) VTK-8.2.0

win 10 pro RTX 2080ti intel xeon scalable

OpenCL error CL_OUT_OF_RESOURCES (-5) during call: clEnqueueNDRangeKernel('fillPtsNrm', dims=3, globalsize=512x512x512, localsize=8x8x16) sync=true

any update?

tkircher commented 4 years ago

Is kinfu not supported anymore?

savuor commented 4 years ago

@tkircher it's supported but I have no mentioned hardware to reproduce and fix the issue

kyndred commented 4 years ago

If possible, I could run any test code on my end if you had some ideas.

tkircher commented 4 years ago

@savuor I'll see if I can narrow down the issue. Like several people above I'm using an RTX 2080 and getting the same error. I have access to an older workstation with a 1060 that may not have the error.

carlos-martinez commented 4 years ago

Hi all,

We have engaged the nVidia debugging team, and they found that this might be an app architecture limitation. They are asking if we can try a smaller work-group size of 512 or 256 to see if issue can be reproduce or not?

I do not have this hardware anymore, and I do not know of this test is just as easy as just changing the work-group size.

Can someone test or share if this is something that can be changed?

Thanks

Carlos

savuor commented 4 years ago

@carlos-martinez Checking this can be as easy as to change work group size. This is also possible that some unnecessary optimizations are enabled or some checks missed (as it was in previous KinFu bugs).

tkircher commented 4 years ago

That fixed it! Setting the environment variable OPENCV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE to 512 gave good results on my RTX 2080.

kyndred commented 4 years ago

I changed line 1260 in ocl.cpp to be:

const size_t CV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE = 512;

and got it working as well.

Thank you!

savuor commented 4 years ago

Since the solution is so simple I think we need to fix the KinFu code the same way: limit wgSize to 512 no matter what maxWorkGroupSize() returns. This can be reverted later in the future when we can rely on OpenCL's HW info.

carlos-martinez commented 4 years ago

HI .. I am not sure if I should close this, but I believe a proposed solution was done. I have not had the hardware to test it again, but hopefully I have that opportunity in the near future.

Thanks everybody

rzofchak8 commented 4 years ago

EDIT: Seems we've figured it out. Need to make sure that after rebuilding OpenCV the .dll files are copied into the example directory

I changed line 1260 in ocl.cpp to be:

const size_t CV_OPENCL_DEVICE_MAX_WORK_GROUP_SIZE = 512;

and got it working as well.

Thank you!

Hi, I am also trying to get this to work...

Kinect DK OpenCV 4.1.0 (with opencv_contrib-4.1.0) VTK-8.2.0 GTX 1660S

Same error as above. Changing this line before building has not changed anything for me. Does anyone have any ideas of what direction I can go?

Thanks in advance

katsh commented 4 years ago

@savuor I'll see if I can narrow down the issue. Like several people above I'm using an RTX 2080 and getting the same error. I have access to an older workstation with a 1060 that may not have the error.

Thanks! this workaround solved my same problem too.