Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv3.10 does not support cuda8.0rc? #6677

Closed
zxfzqf opened this issue Jun 14, 2016 · 23 comments
Closed

opencv3.10 does not support cuda8.0rc? #6677

zxfzqf opened this issue Jun 14, 2016 · 23 comments
Labels

Comments

@zxfzqf
Copy link

zxfzqf commented Jun 14, 2016

  • OpenCV version: 3.10

  • Host OS: Ubuntu 16.04 amd64

    In which part of the OpenCV library you got the issue?

    I have installed CUDA 8.0RC,Error when build opencv3.10,But opencv2.4.13 is normal.
    I have noticed that the release time of opencv3.10 is 2015-12-21,Cuda8.0rc release time is about 2016.05,opencv2.4.13 release time is 2016-05-19,I would like to confirm, opencv3.10 does not support cuda8.0rc?

    Compile error :

/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared
     typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppStat
                                                      ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:135:18: error: ‘NppiGraphcutState’ does not name a type
         operator NppiGraphcutState*()
                  ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:141:9: error: ‘NppiGraphcutState’ does not name a type
         NppiGraphcutState* pState;
         ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:127:39: error: ‘pState’ was not declared in this scope
             nppSafeCall( func(sznpp, &pState, pDeviceMem) );
                                       ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:43: error: ‘pState’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                           ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:49: error: ‘nppiGraphcutFree’ was not declared in this scope
             nppSafeCall( nppiGraphcutFree(pState) );
                                                 ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:174:51: error: ‘nppiGraphcutGetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcutGetSize(sznpp, &bufsz) );
                                                   ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:182:61: error: ‘nppiGraphcutInitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcutInitAll
                                                             ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:191:146: error: ‘nppiGraphcut_32s8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:196:146: error: ‘nppiGraphcut_32f8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:246:52: error: ‘nppiGraphcut8GetSize’ was not declared in this scope
     nppSafeCall( nppiGraphcut8GetSize(sznpp, &bufsz) );
                                                    ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:254:61: error: ‘nppiGraphcut8InitAlloc’ was not declared in this scope
     NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcut8InitAl
                                                             ^
In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0:
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:267:146: error: ‘nppiGraphcut8_32s8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:274:146: error: ‘nppiGraphcut8_32f8u’ was not declared in this scope
 nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) );
                                                                            ^
/home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’
 #define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV
                                                    ^
modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:290: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1
@raldam
Copy link

raldam commented Jun 15, 2016

I have the same problem, I installed opencv3-1 without Cuda for now since I don't really need it. But, it would be preferable if I could use GPU accelerated algorithms for video reading and writing. Waiting for a solution.

@vinograd47
Copy link
Contributor

CUDA 8.0 support was fixed in master branch : #6510

@raldam
Copy link

raldam commented Jun 15, 2016

Worked like a charm, thank you :)

@zxfzqf
Copy link
Author

zxfzqf commented Jun 16, 2016

Thank you for your help.

@mshabunin mshabunin added the bug label Jun 29, 2016
@daveselinger
Copy link

daveselinger commented Oct 24, 2016

For those people who find this page looking for a way to fix this in their build but can't deal with the volatility of MASTER, here's the code I used in my build script

cd /opt/opencv-build && \
    git clone https://github.com/Itseez/opencv.git && \
    cd /opt/opencv-build/opencv && \
    git checkout 3.1.0 && \
    git format-patch -1 10896129b39655e19e4e7c529153cb5c2191a1db && \
    git am < 0001-GraphCut-deprecated-in-CUDA-7.5-and-removed-in-8.0.patch

This script snippet will build a single patch file for that one change, then apply that patch using all git commands. It is opencv 3.1.0 + this bugfix and nothing else.

@mdaiter
Copy link

mdaiter commented Nov 23, 2016

@daveselinger could we cherry-pick this commit into the 3.1.0 branch or create a 3.1.1 branch? It seems like many users would benefit from having this automatically added to the 3.1.0 branch or checking out a 3.1.1 branch to avoid confusion + Googling for this solution.

@daveselinger
Copy link

@mdaiter Hey dude, I've never done that before, and didn't realize this bug was getting all this attention. I'll submit a PR later today.

@daveselinger
Copy link

daveselinger commented Nov 23, 2016

@mdaiter It doesn't look like OpenCV does point releases from 3.1, so I don't expect them to make a release entirely based on this patch. Instead, I forked and will keep this up as best I can. Instead of cloning from the base master, use this instead:

git clone https://github.com/daveselinger/opencv
git checkout 3.1.0-with-cuda8

Then continue on your way. Happy OpenCV'ing.

@Maghoumi
Copy link

To correct that, it is git checkout 3.1.0-with-cuda8 :D

@vincenttsai2015
Copy link

@daveselinger I tried to clone opencv from https://github.com/daveselinger/opencv, but there are error messages while I was using cmake as follows......
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
HDF5_C_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python2
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3
used as include directory in directory /home/vincenttsai/opencv/modules/python/python3

-- Configuring incomplete, errors occurred!
See also "/home/vincenttsai/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/vincenttsai/opencv/build/CMakeFiles/CMakeError.log".

Is there something to fix or install? Thanks.

@daveselinger
Copy link

@vincenttsai2015 It looks like you do not have the library hdf5-dev installed. Should be pretty easily corrected:

sudo apt-get install libhdf5-dev

LMK if it works.

@santhoshkelathodi
Copy link

@daveselinger
When I try to clone I get this error
git clone https://github.com/daveselinger/opencvCloning into 'opencv'...
remote: Counting objects: 195998, done.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
the code is still there?

@daveselinger
Copy link

@santhoshkelathodi Still there. I'd shoot for googling your error. E.g.:

http://stackoverflow.com/questions/38378914/git-error-rpc-failed-curl-56-gnutls

@santhoshkelathodi
Copy link

santhoshkelathodi commented Dec 29, 2016

@daveselinger Thank you very much...

I directly accessed the branch https://github.com/daveselinger/opencv/tree/3.1.0-with-cuda8 and I was able to install openCV without any error.

Now I am facing issue with running the c++ sample code.
In fact my desktop machine does not have a GPU. Hence I could not have a driver for NVDIA. However it is said that still I can use CUDA programs in machine without GOU. Anything specifically needs to be taken care while installing openCV in that case? Or in application I need to disable some macro? It gives the following run time error:

OpenCV Error: Gpu API call (CUDA driver version is insufficient for CUDA runtime version) in allocate, file /home/sk47/opencv_home/opencv/modules/core/src/cuda/gpu_mat.cu, line 71
terminate called after throwing an instance of 'cv::Exception'
what(): /home/sk47/opencv_home/opencv/modules/core/src/cuda/gpu_mat.cu:71: error: (-217) CUDA driver version is insufficient for CUDA runtime version in function allocate

@daveselinger
Copy link

@santhoshkelathodi Once again, my friend Google is your friend. :)

@daveselinger
Copy link

https://devtalk.nvidia.com/default/topic/962474/ubuntu-16-04-cuda-8-cuda-driver-version-is-insufficient-for-cuda-runtime-version/ probably has the right answer. You've either likely installed to low a version of nvidia driver (<367) or installed the CUDA driver incorrectly...

@santhoshkelathodi
Copy link

santhoshkelathodi commented Dec 30, 2016

Thank you @daveselinger for putting it across very nicely about google. I have seen those links and tried to install that way. But inherently they are explaining how to install cuda when GPU is available. It does not address the problem I am facing I don't have a GPU. :(

@daveselinger
Copy link

@santhoshkelathodi Sorry to be the bearer of bad news, then because CUDA is a GPU acceleration platform ONLY for Nvidia GPU's. https://en.wikipedia.org/wiki/CUDA

@ahsteven
Copy link

ahsteven commented Mar 7, 2017

@daveselinger I cloned the version you posted above:

git clone https://github.com/daveselinger/opencv git checkout 3.1.0-with-cuda8
Then I tride cmake as follows:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=OFF -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_OPENGL=ON -D WITH_V4L=ON -D WITH_CUDA=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON ..

However I get the error:

-- ICV: Downloading ippicv_linux_20151201.tgz...
CMake Error at 3rdparty/ippicv/downloader.cmake:73 (file):
file DOWNLOAD HASH mismatch

for file: [/home/teves/opencv/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ippicv_linux_20151201.tgz]
  expected hash: [808b791a6eac9ed78d32a7666804320e]
    actual hash: [a045a276288bc6a21d9aacd4eb41b8ea]
         status: [28;"Timeout was reached"]

Any suggestions on this?

@alalek
Copy link
Member

alalek commented Mar 7, 2017

Timeout was reached

Check network/proxy settings and try again.

@ahsteven
Copy link

ahsteven commented Mar 7, 2017

@alalek It finally went through.

@ebimor
Copy link

ebimor commented Jan 10, 2018

@daveselinger thanks much dude 💯

@irwansyahrmd
Copy link

The simplest thing you can do to solve that CUDA 8.0 support problem:

  1. open "modules/cudalegacy/src/graphcuts.cpp"
  2. change #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
    to #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)
    Worked for me.
    Hope it will save someone's day...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests