error: (-217) invalid resource handle in function call while using setDevice

asked 2018-02-23 15:45:21 -0600

gegupta gravatar image

I currently have a machine with 4 GPUs and i am trying out my program to use more than one device. But if i use any device other than 0, i get following error. Can someone help in knowing why i might be getting it and how can i resolve it.

GPU #2 (Tesla P100-PCIE-16GB) OpenCV Error: Gpu API call (invalid resource handle) in call, file /home/gegupta/opencv/modules/cudawarping/src/cuda/, line 438 Error: /home/gegupta/opencv/modules/cudawarping/src/cuda/ error: (-217) invalid resource handle in function call

Code :

    Stream stream;
    std::cout << "GPU #" << DeviceInfo().deviceID() << " (" << DeviceInfo().name()<< ")\n";
    cv::Mat::setDefaultAllocator(cv::cuda::HostMem::getAllocator (cv::cuda::HostMem::AllocType::PAGE_LOCKED));

    Mat src = imread(input_file,CV_LOAD_IMAGE_COLOR);
            std::cout<<"Image Not Found: "<< input_file << std::endl;

    cuda::GpuMat d_src;
    cuda::GpuMat d_dst;

    cuda::resize(d_src, d_dst, Size(400, 400),0,0, CV_INTER_AREA,stream);

    Mat dst;,stream);

Test Machine configuration:

4 GPU (Tesla P100) - but test only utilizes 1 GPU

64 CPU cores (over Intel Xeon 2680 v4 CPU )

OpenCV version : 3.4.0

Cuda Toolkit : 9.0

I saw another post but no answer :

edit retag flag offensive close merge delete