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

Function populateManyColumnQcompmatr

quest/src/core/printer.cpp:934–953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932
933
934void populateManyColumnQcompmatr(qcompmatr &matr, qindex startRow, qindex startCol, Qureg qureg) {
935
936 // matr has been prior resized such that even before
937 // population, matr.size() is non-zero unless it is
938 // intended to stay empty
939 if (matr.size() == 0)
940 return;
941
942 // prepare list of pointers to matr rows, compatible with localiser 2D input format
943 vector<qcomp*> ptrs;
944 util_tryAllocVector(ptrs, matr.size(), error_printerFailedToAllocTempMemory);
945 for (size_t r=0; r<matr.size(); r++)
946 ptrs[r] = matr[r].data();
947
948 // overwrite matr (throug ptrs), which may trigger communication and GPU-to-CPU copying.
949 // note this achieves node consensus; every node populates their matr, which is much more
950 // demanding than only the root note, however we expect this is not a big deal; live printing
951 // in distributed settings is exceptionally rare and will print small, tractable subsets
952 localiser_densmatr_getAmps(ptrs.data(), qureg, startRow, startCol, matr.size(), matr[0].capacity());
953}
954
955
956// T can be qcomp** or qcomp(*)[]

Callers 1

populateMatrixQuadrantsFunction · 0.85

Calls 6

util_tryAllocVectorFunction · 0.85
util_getGpuMemPtrFunction · 0.85
mem_isAllocatedFunction · 0.85
gpu_copyGpuToCpuFunction · 0.85

Tested by

no test coverage detected