PDA

View Full Version : Getting device info



Rui
03-19-2010, 11:26 AM
How can I query info from a given device using the C++ bindings so I can show it?

I have a vector<Device> with one device on position 0 and I'm trying to use getInfo, but I can't get much information about how to use this method and the types i should pass it.

Thanks

Rui
03-19-2010, 05:21 PM
Solved, just inexperience =)

Reference for (other) beginners:


// get platform
vector<Platform> platformList;
Platform::get(&platformList);
cout << "Platform number is: " << platformList.size() << endl;

// show platform info
cl::string platformInfo;
platformList[0].getInfo(CL_PLATFORM_VERSION, &platformInfo);
cout << "Platform Info: " << platformInfo.c_str() << endl;

// get available devices
vector<Device> devices;
platformList[0].getDevices(CL_DEVICE_TYPE_ALL, &devices);
cout << devices.size() << " device(s) found!" << endl;

// show device info
cl::string name;
devices[0].getInfo(CL_DEVICE_NAME, &name);
cout << "Device name: " << name.c_str() << endl;