特斯拉K80和OpenCL

时间:2016-04-14 15:36:47

标签: opencl gpgpu nvidia tesla

我有一个坐在LINUX盒子里的Nvidia Tesla K80。我知道特斯拉K80内部有两个GPU。当我在该机器上运行OpenCL程序,循环遍历所有设备时,我会看到四个设备(4个Tesla K80)。你知道为什么会发生这种情况吗?

这是主机代码:

ret = clGetPlatformIDs(0, NULL, &platformCount); openclCheck(ret);
platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) *   platformCount);
ret = clGetPlatformIDs(platformCount, platforms, NULL);  openclCheck(ret);
printf("Detect %d platform available.\n",platformCount);
for (unsigned int i= 0; i < platformCount; i++) {
    // get all devices
    ret = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_GPU, 0, NULL, &deviceCount);  openclCheck(ret)
    devices = (cl_device_id*) malloc(sizeof(cl_device_id) * deviceCount);
    ret = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_GPU, deviceCount, devices, NULL); openclCheck(ret)
    printf("Platform %d. %d device available.\n", i+1, deviceCount );
    // for each device print critical attributes

for (unsigned int j = 0; j < deviceCount; j++) {
        // print device name
        ret = clGetDeviceInfo(devices[j], CL_DEVICE_NAME, 0, NULL, &valueSize); openclCheck(ret)
        value = (char*) malloc(valueSize);
        ret = clGetDeviceInfo(devices[j], CL_DEVICE_NAME, valueSize, value, NULL); openclCheck(ret)
        printf("\t%d. Device: %s\n", j+1, value);
        free(value);
        //more code here to print device attributes

这是输出:

Detect 1 platform available.
Platform 1. 4 device available.
1. Device: Tesla K80
    1.1 Hardware version: OpenCL 1.2 CUDA
    1.2 Software version: 352.79
    1.3 OpenCL C version: OpenCL C 1.2 
    1.4 Parallel compute units: 13

2. Device: Tesla K80
    2.1 Hardware version: OpenCL 1.2 CUDA
    2.2 Software version: 352.79
    2.3 OpenCL C version: OpenCL C 1.2 
    2.4 Parallel compute units: 13

3. Device: Tesla K80
    3.1 Hardware version: OpenCL 1.2 CUDA
    3.2 Software version: 352.79
    3.3 OpenCL C version: OpenCL C 1.2 
    3.4 Parallel compute units: 13

4. Device: Tesla K80
    4.1 Hardware version: OpenCL 1.2 CUDA
    4.2 Software version: 352.79
    4.3 OpenCL C version: OpenCL C 1.2 
    4.4 Parallel compute units: 13

1 个答案:

答案 0 :(得分:0)

最有可能2个是32位实现,2个是来自多个驱动程序的64位实现。也许旧驱动程序需要通过某些显示驱动程序卸载程序软件进行清理。请检查每个器件实现的位数。

或者,有虚拟的gpu(GRID?)服务处于活动状态,导致重复的设备,所以也许你可以停用虚拟gpu来解决这个问题。