简体   繁体   English

clGetDeviceIDs在OpenCL中失败,错误代码为-30

[英]clGetDeviceIDs fails in OpenCL with error code -30

The output of the following program on my machine with ATI Firepro V8750 is as follows: 使用ATI Firepro V8750在我的机器上输出以下程序如下:

"Couldn't find any devices:No error" 

(this happens at the call of first clGetDeviceIDs). (这是在第一个clGetDeviceIDs调用时发生的)。 the error code returned is -30. 返回的错误代码是-30。 What does that mean? 这意味着什么?

I am not able to understand why it is unable to find the device. 我无法理解为什么它无法找到该设备。 I have checked that CLinfo.exe lists my GPU along with the Intel CPU I am having. 我已经检查过CLinfo.exe列出了我的GPU和我正在使用的Intel CPU。 Can some one give my some pointers as to what is wrong here? 有人可以给我一些关于这里有什么问题的指示吗?

Additional info: 附加信息:

AMD APP SK 2.4 AMD APP SK 2.4

Firepro Driver: 8.911.3.3_VistaWin7_X32X64_135673 Firepro驱动程序:8.911.3.3_VistaWin7_X32X64_135673

12-4_vista_win7_32_dd_ccc 12-4_vista_win7_32_dd_ccc

Windows 7 Also I must mention that the firePro Driver's some componenets failed to get install. Windows 7另外我必须提到firePro Driver的一些组件无法安装。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef MAC
#include <OpenCL/cl.h>
#else
#include <CL/cl.h> 
#endif

int main() {

 /* Host/device data structures */
 cl_platform_id platform;
 cl_device_id *devices;
 cl_uint num_devices, addr_data;
 cl_int i, err;

 /* Extension data */
 char name_data[48], ext_data[4096];

 /* Identify a platform */
 err = clGetPlatformIDs(1, &platform, NULL);            
 if(err < 0) {          
  perror("Couldn't find any platforms");
  exit(1);
  }

  /* Determine number of connected devices */
  err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, NULL, &num_devices);
   if(err < 0) {                
   perror("Couldn't find any devices");
    exit(1);
   }

    /* Access connected devices */
   devices = (cl_device_id*)                    
     malloc(sizeof(cl_device_id) * num_devices);        
   clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU,             
     num_devices, devices, NULL);               

    /* Obtain data for each connected device */
    for(i=0; i<num_devices; i++) {

    err = clGetDeviceInfo(devices[i], CL_DEVICE_NAME,       
        sizeof(name_data), name_data, NULL);            
    if(err < 0) {       
      perror("Couldn't read extension data");
     exit(1);
   }
   clGetDeviceInfo(devices[i], CL_DEVICE_ADDRESS_BITS,  
        sizeof(ext_data), &addr_data, NULL);            

   clGetDeviceInfo(devices[i], CL_DEVICE_EXTENSIONS,        
        sizeof(ext_data), ext_data, NULL);          

   printf("NAME: %s\nADDRESS_WIDTH: %u\nEXTENSIONS: %s", 
        name_data, addr_data, ext_data);
}

free(devices);
return 0;
}

Here is CLINFO output: GPU: 这是CLINFO输出:GPU: 在此输入图像描述

CPU: 中央处理器: 在此输入图像描述

Why are the two highlighted versions different? 为什么两个突出显示的版本不同?

Could it be that you have multiple OpenCL platforms installed on your system? 可能是您的系统上安装了多个OpenCL平台? So, perhaps your first platform is a CPU-only playform, so the query for a GPU device fails. 因此,也许您的第一个平台是仅限CPU的播放形式,因此GPU设备的查询失败。

EDIT: 编辑:

Here's the problem: The first call to clGetDeviceIDs passes 1 for num_entries, but NULL for the devices pointer. 这是问题:第一次调用clGetDeviceIDs为num_entries传递1,但为设备指针传递NULL。 I think you want to pass in 0 for num_entries. 我想你想为num_entries传递0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM