| 327 | |
| 328 | |
| 329 | void printQuregAutoDeployments(bool isDensMatr) { |
| 330 | |
| 331 | // build all table rows dynamically before print |
| 332 | std::vector<std::tuple<string, string>> rows; |
| 333 | |
| 334 | // we will get auto-deployment for every possible number of qubits; silly but cheap and robust! |
| 335 | int useDistrib, useGpuAccel, useMulti; |
| 336 | int prevDistrib, prevGpuAccel, prevMulti; |
| 337 | |
| 338 | // assume all deployments disabled for 1 qubit |
| 339 | prevDistrib = 0; |
| 340 | prevGpuAccel = 0; |
| 341 | prevMulti = 0; |
| 342 | |
| 343 | // test to theoretically max #qubits, surpassing max that can fit in RAM and GPUs, because |
| 344 | // auto-deploy will still try to deploy there to (then subsequent validation will fail) |
| 345 | int maxQubits = mem_getMaxNumQuregQubitsBeforeGlobalMemSizeofOverflow(isDensMatr, globalEnvPtr->numNodes); |
| 346 | |
| 347 | for (int numQubits=1; numQubits<maxQubits; numQubits++) { |
| 348 | |
| 349 | // re-choose auto deployment |
| 350 | useDistrib = modeflag::USE_AUTO; |
| 351 | useGpuAccel = modeflag::USE_AUTO; |
| 352 | useMulti = modeflag::USE_AUTO;; |
| 353 | autodep_chooseQuregDeployment(numQubits, isDensMatr, useDistrib, useGpuAccel, useMulti, *globalEnvPtr); |
| 354 | |
| 355 | // skip if deployments are unchanged |
| 356 | if (useDistrib == prevDistrib && |
| 357 | useGpuAccel == prevGpuAccel && |
| 358 | useMulti == prevMulti) |
| 359 | continue; |
| 360 | |
| 361 | // else prepare string summarising the new deployments (trailing space is fine) |
| 362 | string value = ""; |
| 363 | if (useMulti) |
| 364 | value += "[omp] "; // ordered by #qubits to attempt consistent printed columns |
| 365 | if (useGpuAccel) |
| 366 | value += "[gpu] "; |
| 367 | if (useDistrib) |
| 368 | value += "[mpi] "; |
| 369 | |
| 370 | // log the #qubits of the deployment change |
| 371 | rows.push_back({printer_toStr(numQubits) + " qubits", value}); |
| 372 | |
| 373 | // skip subsequent qubits with the same deployments |
| 374 | prevDistrib = useDistrib; |
| 375 | prevGpuAccel = useGpuAccel; |
| 376 | prevMulti = useMulti; |
| 377 | } |
| 378 | |
| 379 | // tailor table title to type of Qureg |
| 380 | string prefix = (isDensMatr)? "density matrix" : "statevector"; |
| 381 | string title = prefix + " autodeployment"; |
| 382 | rows.empty()? |
| 383 | print_table(title, "(no parallelisations available)"): |
| 384 | print_table(title, rows); |
| 385 | } |
| 386 |
no test coverage detected