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

Function syncSubQuregFromGpu

quest/src/api/qureg.cpp:431–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429 gpu_copyCpuToGpu(&qureg.cpuAmps[localStartInd], &qureg.gpuAmps[localStartInd], numLocalAmps);
430}
431void syncSubQuregFromGpu(Qureg qureg, qindex localStartInd, qindex numLocalAmps) {
432 validate_quregFields(qureg, __func__);
433 validate_localAmpIndices(qureg, localStartInd, numLocalAmps, __func__);
434
435 // the above validation communicates for node consensus in
436 // distributed settings, because params can differ per-node.
437 // note also this function accepts statevectors AND density
438 // matrices, because the latter does not need a bespoke
439 // (row,col) interface, because the user can only access/modify
440 // local density matrix amps via a flat index anyway!
441
442 // we permit this function to do nothing when not GPU-accelerated
443 if (!qureg.isGpuAccelerated)
444 return;
445
446 // otherwise, every node merely copies its local subset, which
447 // may differ per-node, in an embarrassingly parallel manner
448 gpu_copyGpuToCpu(&qureg.gpuAmps[localStartInd], &qureg.cpuAmps[localStartInd], numLocalAmps);
449}
450
451
452void getQuregAmps(qcomp* outAmps, Qureg qureg, qindex startInd, qindex numAmps) {

Callers

nothing calls this directly

Calls 3

validate_quregFieldsFunction · 0.85
validate_localAmpIndicesFunction · 0.85
gpu_copyGpuToCpuFunction · 0.85

Tested by

no test coverage detected