opencl clGetDeviceID错误(17334360个设备)

时间:2014-01-09 16:35:02

标签: opencl gpu

我试图在我的gt610 gpu上运行opencl hallo world (gpu -z raports支持OpenCl 1.1)

当我跑步时

    static  cl_device_id device_id[10] = {0};
    static cl_uint num_devices__ = 20;
    ret = clGetDeviceIDs_( platform_id[0], CL_DEVICE_TYPE_GPU, 10, device_id, &num_devices__ );
    if(ret == CL_SUCCESS) printf("get device id success , devices %d ", num_devices__) ;

它返回成功,但是给出了17334360的num_devices,否则它似乎有效 (如果我给CL_DEVICE_TYPE_ACCELERATOR这会返回CL_DEVICE_NOT_FOUND),platform_id似乎还可以......

我没有脚跟线索它可能是什么:C 有人可以帮忙吗?

(我正在使用我在windows / system32(1.0)中找到的opencl.dll 并动态加载(使用从khronos页面获取的opencl 1.1标头 - 我有调制解调器连接,无法下载sdk,需要加载 这样 - 但它似乎工作良好的api是workink好的)

修改

我使用这个垃圾代码(它的实验试图运行它)

    SetupDllFunctions();

    int ret;
    static cl_platform_id platform_id[10] = {0};
    int platforms_found = 0;
    ret = clGetPlatformIDs_(10, platform_id, &platforms_found);
    if(ret == CL_SUCCESS ) printf("clGetPlatformIDs success") ;
    printf(" %d platforms found",platforms_found ) ;
    static char profile[1000];
    size_t size;
    clGetPlatformInfo_(platform_id[0], CL_PLATFORM_VERSION, NULL, profile, &size);
    clGetPlatformInfo_(platform_id[0], CL_PLATFORM_VERSION, size, profile, NULL);
    printf(" %s ", profile);
    static  cl_device_id device_id[10] = {0};
    static cl_uint num_devices__ = 20;
    int platformid = platform_id[0];
    ret = clGetDeviceIDs_( platformid, CL_DEVICE_TYPE_GPU, 10, device_id, &num_devices__ );
    if(ret == CL_SUCCESS) printf("get device id success , devices %d ", num_devices__) ;

    if(ret == CL_INVALID_PLATFORM) printf("CL_INVALID_PLATFORM") ;
    if(ret == CL_INVALID_DEVICE_TYPE ) printf("CL_INVALID_DEVICE_TYPE ") ;
    if(ret == CL_INVALID_VALUE ) printf("CL_INVALID_VALUE ") ;
    if(ret == CL_DEVICE_NOT_FOUND ) printf("CL_DEVICE_NOT_FOUND ") ;

    cl_context context = clCreateContext_(0, 1, device_id, NULL, NULL, &ret);

    printf("..... ") ;

    if(ret == CL_SUCCESS) printf("context success ") ;
    if(ret ==CL_INVALID_PLATFORM) printf("CL_INVALID_PLATFORM ") ;
    if(ret ==CL_INVALID_VALUE) printf("CL_INVALID_VALUE ") ;
    if(ret ==CL_INVALID_DEVICE) printf("CL_INVALID_DEVICE ") ;
    if(ret ==CL_DEVICE_NOT_AVAILABLE) printf("CL_DEVICE_NOT_AVAILABLE ") ;
    if(ret ==CL_OUT_OF_HOST_MEMORY) printf("CL_OUT_OF_HOST_MEMORY ") ;

输出

clGetPlatformIDs成功找到1个平台OpenCL 1.1 CUDA 4.2.1获取设备ID成功,设备17334336 ..... CL_INVALID_DEVICE

第一个问题是17万个设备第二个无效设备

我添加的下划线因为我通过get proc地址获取功能 (我在定义时使用标题,所以我添加_不冲突) 我的机器在windows system32上找到opencl.dll,仍然不能 得到sdk - 也许如果有人可以上传opencl.dll导入lib open.cl.lib和标题所以我可以使用这个...但这个动态链接我想也许应该工作(一些调用工作,平台字符串被返回< / p>

0 个答案:

没有答案