The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

clGetDeviceIDs question

I'm trying to build an academic code that will basically operate on any system it's loaded onto without uniformity (Giant red flag in this sentence eh?). For example a system with 1 platform and 4 devices or 1 platform with 16 devices, without modifying the code.

In any case, I'm getting pointers from the clGetDeviceIDs call, and then trying to return it from the function, which is a HUGE memory management issue because there are leaks everywhere. Case in point, this is how I had to work it to get the code to compile without warnings:

I know this is incorrect and can be done inside the program instead of inside a function call. My question is this; the third argument of clGetDeviceIDs takes a numerical which is pointed to by the fourth argument. When putting in a number like 1 instead of deviceCounter, how does that work? Is the system only calling the first device it finds under that platform? Or is it calling the first available device, meaning that if set to 1 and the device was doing something it would then move onto the next device?

Sorry I am new to OpenCL and brushing up some old c knowledge, my end goal is to find out how many devices are on any system this is loaded onto. I appreciate any time you spent looking at this and any knowledge you send my way!

Edit: I understand how this works now, and this cannot be done in a function call, no need for any replies. What I was doing is impossible in C.