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

Function syncSubQuregToGpu

quest/src/api/qureg.cpp:412–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410
411
412void syncSubQuregToGpu(Qureg qureg, qindex localStartInd, qindex numLocalAmps) {
413 validate_quregFields(qureg, __func__);
414 validate_localAmpIndices(qureg, localStartInd, numLocalAmps, __func__);
415
416 // the above validation communicates for node consensus in
417 // distributed settings, because params can differ per-node.
418 // note also this function accepts statevectors AND density
419 // matrices, because the latter does not need a bespoke
420 // (row,col) interface, because the user can only access/modify
421 // local density matrix amps via a flat index anyway!
422
423 // we permit this function to do nothing when not GPU-accelerated
424 if (!qureg.isGpuAccelerated)
425 return;
426
427 // otherwise, every node merely copies its local subset, which
428 // may differ per-node, in an embarrassingly parallel manner
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__);

Callers

nothing calls this directly

Calls 3

validate_quregFieldsFunction · 0.85
validate_localAmpIndicesFunction · 0.85
gpu_copyCpuToGpuFunction · 0.85

Tested by

no test coverage detected