如何测试OpenCL的兼容性? [英] How can I test for OpenCL compatibility?

查看:242
本文介绍了如何测试OpenCL的兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台MacBook Pro 13',具有集成的Intel HD 3000和i7内核.
我必须使用并行编程.

I have a MacBook Pro 13' with an integrated Intel HD 3000 and a i7 core.
I have to use Parallel Programming.

我的教学顾问无法告诉我它是否可以与MacBook一起使用.

My teaching advisors couldn't tell me if it would work with my MacBook.

我是否可以在笔记本电脑上运行测试以进行测试? +我发现了,但是只有Linux和Windows SDK……也许Linux版本也适用于Mac.

Is there a test I could run on my Laptop for testing? + I found this, but there is only a Linux and Windows SDK ... maybe the Linux version works also for Mac.

我该怎么办?

推荐答案

vocaro的答案是绝对正确的;您可以始终使用Snow Leopard和Lion上的CPU计算设备,即使您的特定图形芯片不支持OpenCL.

vocaro's answer is absolutely correct; you can always use the CPU compute device on Snow Leopard and Lion, even if your particular graphics chip doesn't support OpenCL.

以下程序将向您显示给定Macintosh上支持OpenCL的设备:

The following program will show you the OpenCL-capable devices on a given Macintosh:

// clang -framework OpenCL dumpcl.c -o dumpcl && ./dumpcl

#include <stdio.h>
#include <stdlib.h>
#include <OpenCL/opencl.h>

int main(int argc, char* const argv[]) {
    cl_uint num_devices, i;
    clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);

    cl_device_id* devices = calloc(sizeof(cl_device_id), num_devices);
    clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, num_devices, devices, NULL);

    char buf[128];
    for (i = 0; i < num_devices; i++) {
        clGetDeviceInfo(devices[i], CL_DEVICE_NAME, 128, buf, NULL);
        fprintf(stdout, "Device %s supports ", buf);

        clGetDeviceInfo(devices[i], CL_DEVICE_VERSION, 128, buf, NULL);
        fprintf(stdout, "%s\n", buf);
    }

    free(devices);
}

在我的Macbook上,它给出了:

On my Macbook, this gives:

Device Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz supports OpenCL 1.1 
Device ATI Radeon HD 6490M supports OpenCL 1.1 

您可以使用此程序作为起点来询问其他设备信息. clGetDeviceInfo 的Khronos API参考有用.

You can ask for other device information using this program as a starting point. The Khronos API reference for clGetDeviceInfo should be useful.

这篇关于如何测试OpenCL的兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆