Zypps987
Zypps987

Reputation: 414

Unable to use opencv cuda calls

After a fresh install of jetpack on my tk1 board I found myself unable to use opencv's gpu calls. I'm using opencv 2.4.12

OpenCV Error: Gpu API call (CUDA driver version is insufficient for CUDA runtime version) in copy, file /hdd/buildbot/slave_jetson_tx_2/35-O4T-L4T-Jetson-L/opencv/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 877
Error: /hdd/buildbot/slave_jetson_tx_2/35-O4T-L4T-Jetson-L/opencv/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp:877: error: (-217) CUDA driver version is insufficient for CUDA runtime version in function copy

Here's the output of nvcc -V

ubuntu@tegra-ubuntu:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Wed_Nov_12_15:57:57_CST_2014
Cuda compilation tools, release 6.5, V6.5.30

.bashrc

# Add CUDA bin & library paths:
export PATH=/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
# Add CUDA bin & library paths:
export PATH=/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
export LD_LIBRARY_PATH=/usr/local/cuda/lib:

NOTE: I installed cuda 7.0 before and without installing it I simply installed the deb file with the 6.5. The nvcc -V shows I'm using 6.5 but could it possibly still be using the 7.0?

Here is what I'm trying to compile and the compile command I used

g++ `pkg-config --cflags opencv` Fix.cpp -o Saliency `pkg-config --libs opencv`

#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"

int main (int argc, char* argv[])
{
    try
    {
        cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);
        cv::gpu::GpuMat dst, src;
        src.upload(src_host);

        cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);

        cv::Mat result_host(dst);
        cv::imshow("Result", result_host);
        cv::waitKey();
    }
    catch(const cv::Exception& ex)
    {
        std::cout << "Error: " << ex.what() << std::endl;
    }
    return 0;
}

Upvotes: 1

Views: 1154

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151869

Adding CW answer to get this off the unanswered list. According to OP's comment, this advice seems to have led to a solution:

"CUDA driver version is insufficient for CUDA runtime version" means just what it says. You have a mismatched environment.

My guess would be that you built your OpenCV when you had a more recent CUDA toolkit version installed (say, 7.0), and then when you installed the jetpack, things reverted (CUDA driver, CUDA runtime, CUDA toolkit) to effectively 6.5 versions. This means any libraries (say, OpenCV libs) built against CUDA 7.0 are no longer usable.

My guess would be that you need to rebuild OpenCV against your current environment.

Upvotes: 1

Related Questions