GiantTable
GiantTable

Reputation: 31

Unable to use Emgucv CUDA

Does anyone know why I am unable to use CUDA, I have a Nvidia graphics card installed that has CUDA enabled, specifically a GTX 660, and I also have the CUDA driver and toolkit installed. However, when I try to use "HasCuda" function, it always returns false. Also when I try to compile a program without checking for CUDA, I just get an error. So does anyone have any instructions on how to properly install Emgucv with CUDA in Visual Studio 2015, by the way, I got Emgucv from the nuget package.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV.Cuda;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void CUDACheck()
        {
            if (CudaInvoke.HasCuda)
           {
               MessageBox.Show("CUDA On");
           }
          else
          {
              MessageBox.Show("CUDA Off");
           }
       }

       private void button1_Click(object sender, EventArgs e)
       {
           CUDACheck();
       }
   }
}

The result is always "Cuda Off".

Upvotes: 3

Views: 4229

Answers (2)

RandomEli
RandomEli

Reputation: 1557

Downloade the executables with xxx_cuda_xxx from here: Emgucv sourceforge executables. Remove the one you installed from nuGet package manager. Add reference to the package bin folder from where you downloaded and installed. Manually copy the concrt140.dll, cvextern.dll, msvcp140.dll, opencv_ffmepg330_64.dll and vcruntime140.dll into your debug or release folder. Then it should let you to use cuda, for more version compatible info, please refer to: Emgucv Version History. The reason why the one that you downloaded from nuGet package manager didn't work is simply because that version didn't support GPU computations.

Upvotes: 2

John Thoits
John Thoits

Reputation: 365

I believe the issue is that you are using a build of Emgu that was not built with CUDA enabled. The build without CUDA enabled is more commonly used since it is a much smaller package. I was using the package from NuGet myself, which seems to be without CUDA enabled. You will have to make sure you are using a build with -cuda in it's name, which you will probably have to download from SourceForge: https://sourceforge.net/projects/emgucv. Go to Files, and find the file you need.

Upvotes: 2

Related Questions