Closed merceyz closed 7 years ago
Hi Chris,
Cool :-) . Actually, you can get this as follows:
int numGpus = DevicesInfo::getNumGpus();
for(int i = 0; i < numGpus; i++) {
cout << DevicesInfo::getGpuInfo(i).toString() << endl;
}
Or, this will print:
... stuff...
platformVendor: Apple
platformName: Apple
...
deviceName: AMD Radeon Pro 450 Compute Engine
...
To get the value of platformVendor:
cout << DevicesInfo::getGpuInfo(i).platformVendor << endl;
You can take a look at:
How would that work if I only have a EasyCL and CLKernel https://github.com/hughperkins/DeepCL/blob/master/src/conv/BackpropWeightsScratch.cpp#L56
And it can't be specific to GPU as it can be a CPU as well
The methods above are static. Global. Dont need any EasyCL or CLKernel objects. Just call these global methods directly.
(though you probably want to cache the result, if you're going to be checking this value thousands of times a second)
Yes, that was the plan.
Though I want to know it for the specific device the kernel will be run on (the line I linked to).
So I either need to get the device ID from the CL object or easycl::DevicesInfo::getDeviceInfo
needs to accept a cl_device_id object
Seems you can get the DeviceInfo from the cl like this: https://github.com/hughperkins/clnn/blob/master/lib/THCLNN/im2col.cpp#L19
int maxWorkgroupSize = ((easycl::DeviceInfo *)state->deviceInfoByDevice[state->currentDevice])->maxWorkGroupSize;
oh wait, thats torch specific. hmmm
Hmmm, ok I see. So, getting the device_id and platform_id from the EasyCL object is already possible:
https://github.com/hughperkins/EasyCL/blob/master/EasyCL.h#L65-L66
cl_platform_id platform_id;
cl_device_id device;
But there's no obvious existing method to then retrieve a DeviceInfo object given those.
It can be done like this:
easycl::DeviceInfo info;
info.populate(cl->platform_id, cl->device);
cout << info.platformVendor << endl;
Thanks for pointing me in the right direction
Cool :-)
A simple function to see if we're on AMD, Nvidia, Intel, or other. (To use with DeepCL)
Reason: Nvidia prefers workgroupsizes to be a multiple of 32, AMD prefers 64 and Intel (CPU) 8 So it would be nice to easily see which platform we're currently on