| 410 | |
| 411 | |
| 412 | void 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 | } |
| 431 | void syncSubQuregFromGpu(Qureg qureg, qindex localStartInd, qindex numLocalAmps) { |
| 432 | validate_quregFields(qureg, __func__); |
| 433 | validate_localAmpIndices(qureg, localStartInd, numLocalAmps, __func__); |
nothing calls this directly
no test coverage detected