2012 Macbook pro上的OpenCL设备数量

时间:2014-09-30 04:28:20

标签: macos opencl gpu cpu intel

我在2012年年中编写了一个openCL程序13" macbook pro具有以下规格:

处理器:2.9 GHz Intel Core i7

图形:Intel HD Graphics 4000

在我的程序中,我执行以下操作来检查我有权访问的设备数量:

// get first platform
cl_platform_id platform;
err = clGetPlatformIDs(1, &platform, NULL);

// get device count
cl_uint gpuCount;
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &gpuCount);

cl_uint cpuCount;
err |= clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &cpuCount);

std::cout<<"NUM CPUS: "<<cpuCount<<" NUM GPUS: "<<gpuCount<<std::endl;

执行后,我的程序声明我只有 一个CPU 零GPU

怎么会这样? openCL与Intel HD Graphics 4000卡不兼容吗?我以为我的电脑有双核处理器。那么不应该有2个CPU和1个GPU吗?

或者我只是没有正确提取数据?

编辑:我发现了这个问题。将我的操作系统升级到Mavericks(以前运行Mountain Lion)后,openCL现在将我的显卡识别为有效设备。

2 个答案:

答案 0 :(得分:4)

您的处理器有多个核心,这些核心被识别为计算单位。运行以下代码段和&amp;检查CU的数量是否符合预期:

cl_device_id device;
cl_uint max_compute_units;
cl_int ret = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &max_compute_units, NULL);
printf("Number of computing units: %u\n", max_compute_units);

答案 1 :(得分:3)

这不能回答你的问题,(并且不需要低估)但希望能帮助你弄清楚你实际安装的内容。我会将其作为评论发布,但格式化将毫无用处。

如果您需要安装的CPU和图形设备的清晰列表,请执行以下命令:

system_profiler | awk '/^Hardware/ || /^Graphics/{p=1;print;next} /^[A-Za-z]/{p=0} p'

Graphics/Displays:

    AMD Radeon HD 6970M:

      Chipset Model: AMD Radeon HD 6970M
      Type: GPU
      Bus: PCIe
      PCIe Lane Width: x16
      VRAM (Total): 1024 MB
      Vendor: ATI (0x1002)
      Device ID: 0x6720
      Revision ID: 0x0000
      ROM Revision: 113-C2960H-203
      EFI Driver Version: 01.00.560
      Displays:
        iMac:
          Display Type: LCD
          Resolution: 2560 x 1440
          Pixel Depth: 32-Bit Color (ARGB8888)
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Built-In: Yes

Hardware:

    Hardware Overview:

      Model Name: iMac
      Model Identifier: iMac12,2
      Processor Name: Intel Core i7
      Processor Speed: 3.4 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 8 MB
      Memory: 16 GB
      Boot ROM Version: IM121.0047.B1F
      SMC Version (system): 1.72f2
      Serial Number (system): DGKH90PWDHJW
      Hardware UUID: 1025AC04-9F8E-5342-9EF4-XXXXXXXXXXXXX

这也是实际的CPU细节:

sysctl -a | grep "brand_string"
machdep.cpu.brand_string: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz

这适用于OpenCL版本:

system_profiler | grep -A 11 OpenCL:
OpenCL:

  Version: 2.3.59
  Obtained from: Apple
  Last Modified: 19/09/2014 10:28
  Kind: Intel
  64-Bit (Intel): Yes
  Signed by: Software Signing, Apple Code Signing Certification Authority, Apple Root CA
  Get Info String: 2.3.59, Copyright 2008-2013 Apple Inc.
  Location: /System/Library/Frameworks/OpenCL.framework
  Private: No

P.S。如果有更好的方式在SO上提供额外的,有用的信息(这不是一个真正合适的答案),请告诉我。

相关问题