c - Why isn't OpenCL finding any devices? -
i've been messing around opencl, , seems it's not detecting have device use in computer (which do).
here's result of dxdiag:
here first part of code, error being raised, checking number of devices available on machine.
cl_platform_id platform; cl_uint num_devices; cl_int err; //get first platform err = clgetplatformids(1, &platform, null); if (err < 0){ perror("couldn't find platforms"); exit(1); } //determine number of devices: error raised result of err = clgetdeviceids(platform, cl_device_type_all, 1, null, &num_devices); if (err < 0){ perror("couldn't find devices"); exit(1); }
this output code:
and when print number of devices is finding,
printf("found %d devices", num_devices);
it gives same number every time:
please let me know other information may in figuring out.
you can't it's not finding devices because haven't checked return value. there 5 values (more, depending on opencl version) clgetdeviceids
can return:
cl_success
if function executed successfully.cl_invalid_platform
if platform not valid platform.cl_invalid_device_type
if device_type not valid value.cl_invalid_value
if num_entries equal 0 , device_type not null or if both num_devices , device_type null.cl_device_not_found
if no opencl devices matched device_type found.
you should check err
value against sure cl_device_not_found
case.
similarly, should use supply num_platforms
value clgetplatformids
. it's possible platform you've selected doesn't have valid devices, platform does.
Comments
Post a Comment