我的目的是对 CPU 和 GPU 之间的差异进行基准测试。 问题是,我只能检索我的 GPU,我的 CPU 没有显示。
该程序在 OSX 上生成正确输出。其中列出了 CPU 和 GPU:
public static void displayInfo() {
for (int platformIndex = 0; platformIndex < CLPlatform.getPlatforms().size(); platformIndex++) {
CLPlatform platform = CLPlatform.getPlatforms().get(platformIndex);
System.out.println("Platform #" + platformIndex + ":" + platform.getInfoString(CL_PLATFORM_NAME));
List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_ALL);
for (int deviceIndex = 0; deviceIndex < devices.size(); deviceIndex++) {
CLDevice device = devices.get(deviceIndex);
System.out.printf(Locale.ENGLISH, "Device #%d(%s):%s\n",
deviceIndex,
UtilCL.getDeviceType(device.getInfoInt(CL_DEVICE_TYPE)),
device.getInfoString(CL_DEVICE_NAME));
}
}
}
我的输出:
Platform #0:NVIDIA CUDA
Device #0(GPU):GeForce GTX 560 Ti
Device #1(GPU):GeForce GTX 560 Ti
我的电脑:
- 英特尔 i5-2500K
- Windows 8.1 专业版 (x64)
- 2x GeForce GTX 560 Ti
我正在使用lwjgl
版本2.8.4
为什么我无法检索我的 CPU?
最佳答案
(重新发布评论中的答案)
OS X 的独特之处在于它预装了 OpenCL CPU 驱动程序,因此 OpenCL 可以“开箱即用”地工作。在 Windows 和 Linux 上,您需要为您的 CPU 安装 OpenCL 运行时/驱动程序。对于 Intel CPU,您可以在这里找到它们:
关于java - CPU 未列为使用 Windows 的设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29761149/