私はcudaでopencvを始めたばかりです。私はopencv2.4.6とCUDA4.2を使用しています。cudaでopencvを正常にコンパイルしました。コードを使用する場合:
int cuda_count;
cudaError_t error = cudaGetDeviceCount( &cuda_count );
それは返されますがcudaSuccess
、cuda_count=1
コードを使用すると:
int num_devices = cv::gpu::getCudaEnabledDeviceCount();
なぜnum_devices returns 0
?
私の完全なコードは次のとおりです。
int main()
{
int num_devices = cv::gpu::getCudaEnabledDeviceCount();
int cuda_count;
cudaError_t error = cudaGetDeviceCount( &cuda_count );
if(num_devices <=0 )
{
std::cerr << "no" << std::endl;
return -1;
}
int enable_devivce_id = -1;
}