MCPcopy Create free account
hub / github.com/RenderKit/oidn / getPhysicalDevices

Method getPhysicalDevices

devices/cuda/cuda_device.cpp:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 }
77
78 std::vector<Ref<PhysicalDevice>> CUDADevice::getPhysicalDevices()
79 {
80 int numDevices = 0;
81 if (cudaGetDeviceCount(&numDevices) != cudaSuccess)
82 return {};
83
84 std::vector<Ref<PhysicalDevice>> devices;
85 for (int deviceID = 0; deviceID < numDevices; ++deviceID)
86 {
87 cudaDeviceProp prop{};
88 if (cudaGetDeviceProperties(&prop, deviceID) != cudaSuccess)
89 continue;
90
91 if (isSupported(prop))
92 {
93 int score = (19 << 16) - 1 - deviceID;
94 devices.push_back(makeRef<CUDAPhysicalDevice>(deviceID, prop, score));
95 }
96 }
97
98 return devices;
99 }
100
101 bool CUDADevice::isSupported(const cudaDeviceProp& prop)
102 {

Callers

nothing calls this directly

Calls 3

cudaGetDeviceCountFunction · 0.85
cudaGetDevicePropertiesFunction · 0.85
isSupportedFunction · 0.50

Tested by

no test coverage detected