| 199 | //------------------------------------------------------------------------------ |
| 200 | |
| 201 | Properties luxcore::GetOpenCLDeviceDescs() { |
| 202 | #if defined(LUXRAYS_DISABLE_OPENCL) |
| 203 | return Properties(); |
| 204 | #else |
| 205 | Properties props; |
| 206 | |
| 207 | Context ctx; |
| 208 | vector<DeviceDescription *> deviceDescriptions = ctx.GetAvailableDeviceDescriptions(); |
| 209 | |
| 210 | // Select only OpenCL devices |
| 211 | DeviceDescription::Filter(DEVICE_TYPE_OPENCL_ALL, deviceDescriptions); |
| 212 | |
| 213 | // Add all device information to the list |
| 214 | for (size_t i = 0; i < deviceDescriptions.size(); ++i) { |
| 215 | const OpenCLDeviceDescription *desc = (OpenCLDeviceDescription *)deviceDescriptions[i]; |
| 216 | |
| 217 | cl::Platform platform = desc->GetOCLDevice().getInfo<CL_DEVICE_PLATFORM>(); |
| 218 | const string platformName = platform.getInfo<CL_PLATFORM_VENDOR>(); |
| 219 | const string platformVersion = platform.getInfo<CL_PLATFORM_VERSION>(); |
| 220 | const int deviceClock = desc->GetOCLDevice().getInfo<CL_DEVICE_MAX_CLOCK_FREQUENCY>(); |
| 221 | const unsigned long long deviceLocalMem = desc->GetOCLDevice().getInfo<CL_DEVICE_LOCAL_MEM_SIZE>(); |
| 222 | const unsigned long long deviceConstMem = desc->GetOCLDevice().getInfo<CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE>(); |
| 223 | |
| 224 | const string prefix = "opencl.device." + ToString(i); |
| 225 | props << |
| 226 | Property(prefix + ".platform.name")(platformName) << |
| 227 | Property(prefix + ".platform.version")(platformVersion) << |
| 228 | Property(prefix + ".name")(desc->GetName()) << |
| 229 | Property(prefix + ".type")(DeviceDescription::GetDeviceType(desc->GetType())) << |
| 230 | Property(prefix + ".units")(desc->GetComputeUnits()) << |
| 231 | Property(prefix + ".clock")(deviceClock) << |
| 232 | Property(prefix + ".nativevectorwidthfloat")(desc->GetNativeVectorWidthFloat()) << |
| 233 | Property(prefix + ".maxmemory")((unsigned long long)desc->GetMaxMemory()) << |
| 234 | Property(prefix + ".maxmemoryallocsize")((unsigned long long)desc->GetMaxMemoryAllocSize()) << |
| 235 | Property(prefix + ".localmemory")((unsigned long long)deviceLocalMem) << |
| 236 | Property(prefix + ".constmemory")((unsigned long long)deviceConstMem); |
| 237 | } |
| 238 | |
| 239 | return props; |
| 240 | #endif |
| 241 | } |
| 242 | |
| 243 | //------------------------------------------------------------------------------ |
| 244 | // FileNameResolver |
nothing calls this directly
no test coverage detected