Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
panzhenjie opened this issue Apr 28, 2022 · 0 comments
Open

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

panzhenjie opened this issue Apr 28, 2022 · 0 comments

Comments

@panzhenjie
Copy link

Hi,

clpeak use ctx.getInfo<CL_CONTEXT_DEVICES>() 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant