Nsight显示“ GPU 0(GeForce 940MX)”在OpenCL中显示为灰色

时间:2018-10-22 18:58:22

标签: opencl nsight

我在OpenCL + OpenGL应用程序上运行了Nsight的性能分析,结果显示如下:

enter image description here

这是我初始化OpenCL的方法:

python2

我得到以下输出:

std::vector<cl::Platform> all_platforms;
cl::Platform::get(&all_platforms);

auto default_platform = all_platforms[1];
cout << "Using platform: " << default_platform.getInfo<CL_PLATFORM_NAME>() << std::endl;

std::vector<cl::Device> devices;
default_platform.getDevices(CL_DEVICE_TYPE_GPU, &devices);
for (unsigned d = 0; d < devices.size(); ++d) {
    if (checkExtnAvailability(devices[d], CL_GL_SHARING_EXT)) {
        device = devices[d];
        break;
    }
}
cout << "Using device: " << device.getInfo<CL_DEVICE_NAME>() << std::endl;
cl_context_properties props[] =
{
    CL_GL_CONTEXT_KHR,   (cl_context_properties)wglGetCurrentContext(),
    CL_WGL_HDC_KHR,     (cl_context_properties)wglGetCurrentDC(),
    CL_CONTEXT_PLATFORM, (cl_context_properties)default_platform(),
    0
};
context = cl::Context(device, props);

我也这样打印GL的信息:

Using platform: NVIDIA CUDA
Using device: GeForce 940MX

我得到:

cout << "GL info: " << glGetString(GL_VENDOR) << "; " << glGetString(GL_VERSION) << endl;

任何想法都坏了吗?我的GeForce驱动程序是Nsight的确切推荐版本。

注意:我确实已安装CUDA Toolkit 10.0。

0 个答案:

没有答案