MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / getDeviceInfo

Function getDeviceInfo

src/backend/cuda/platform.cpp:222–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220int getBackend() { return AF_BACKEND_CUDA; }
221
222string getDeviceInfo(int device) noexcept {
223 const cudaDeviceProp &dev = getDeviceProp(device);
224
225 size_t mem_gpu_total = dev.totalGlobalMem;
226 // double cc = double(dev.major) + double(dev.minor) / 10;
227
228 bool show_braces = getActiveDeviceId() == device;
229
230 string id = (show_braces ? string("[") : "-") + to_string(device) +
231 (show_braces ? string("]") : "-");
232 string name(dev.name);
233 string memory = to_string((mem_gpu_total / (1024 * 1024)) +
234 !!(mem_gpu_total % (1024 * 1024))) +
235 string(" MB");
236 string compute = string("CUDA Compute ") + to_string(dev.major) +
237 string(".") + to_string(dev.minor);
238
239 string info = id + string(" ") + name + string(", ") + memory +
240 string(", ") + compute + string("\n");
241 return info;
242}
243
244string getDeviceInfo() noexcept {
245 ostringstream info;

Callers

nothing calls this directly

Calls 5

to_stringFunction · 0.85
getPlatformInfoFunction · 0.85
getActiveDeviceIdFunction · 0.70
get_systemFunction · 0.70
getDeviceCountFunction · 0.70

Tested by

no test coverage detected