MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / printMemoryInfo

Function printMemoryInfo

quest/src/api/qureg.cpp:245–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243
244
245void printMemoryInfo(Qureg qureg) {
246
247 using namespace printer_substrings;
248
249 size_t localArrayMem = mem_getLocalQuregMemoryRequired(qureg.numAmpsPerNode);
250 string localMemStr = printer_getMemoryWithUnitStr(localArrayMem) + (qureg.isDistributed? pn : "");
251
252 // precondition: no reportable fields are at risk of overflow as a qindex
253 // type, EXCEPT aggregate total memory between distributed nodes (in bytes)
254 qindex globalTotalMem = mem_getTotalGlobalMemoryUsed(qureg);
255 string globalMemStr = (globalTotalMem == 0)? "overflowed" : printer_getMemoryWithUnitStr(globalTotalMem);
256
257 print_table(
258 "memory", {
259 {"cpuAmps", mem_isAllocated(qureg.cpuAmps)? localMemStr : na},
260 {"gpuAmps", mem_isAllocated(qureg.gpuAmps)? localMemStr : na},
261 {"cpuCommBuffer", mem_isAllocated(qureg.cpuCommBuffer)? localMemStr : na},
262 {"gpuCommBuffer", mem_isAllocated(qureg.gpuCommBuffer)? localMemStr : na},
263 {"globalTotal", globalMemStr},
264 });
265}
266
267
268

Callers 1

reportQuregParamsFunction · 0.85

Calls 5

print_tableFunction · 0.85
mem_isAllocatedFunction · 0.85

Tested by

no test coverage detected