| 243 | |
| 244 | |
| 245 | void 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 |
no test coverage detected