krrishnarraj / clpeak

A tool which profiles OpenCL devices to find their peak capacities
Apache License 2.0
386 stars 109 forks source link

clpeak can't get all devices in multi devices platform #91

Open panzhenjie opened 2 years ago

panzhenjie commented 2 years ago

Hi,

clpeak use ctx.getInfo() interface to get devices. It will call OpenCL C API clCreateContextFromType eventually. There is a description about clCreateContextFromType in OpenCL specification "clCreateContextFromType may return all or a subset of the actual physical devices present in the platform and that match device_type." So on some platform, this method can't get all the devices.

There is another interface platform.getDevices() which also can get devices. It will call OpenCL C API clGetDeviceIDs eventually. Actually, clGetDeviceIDs also has similar description in the specification "clGetDeviceIDs may return all or a subset of the actual physical devices present in the platform and that match device_type."

We don't know which interface can return more devices on different platform. So my idea is: we can call these two interfaces and use the one which returns more devices to get better compatibility.

Here is the patch I worked out clpeak_diff.txt Can you give some suggestion for this issue and do you think this solution is acceptable?