| 468 | |
| 469 | |
| 470 | void receiveArrayToGpuBuffer(Qureg qureg, qindex numElems, int pairRank) { |
| 471 | |
| 472 | qindex recvInd = getBufferRecvInd(); |
| 473 | |
| 474 | // receive to GPU memory directly if possible |
| 475 | if (gpu_isDirectGpuCommPossible()) { |
| 476 | |
| 477 | // GPU synchronisation is not necessary; we're merely receiving to buffer |
| 478 | |
| 479 | // communicate via GPUDirect or Peer-to-Peer |
| 480 | receiveArray(&qureg.gpuCommBuffer[recvInd], numElems, pairRank); |
| 481 | |
| 482 | // otherwise, route through CPU |
| 483 | } else { |
| 484 | |
| 485 | // receive array to CPU memory (buffer), at offset |
| 486 | receiveArray(&qureg.cpuCommBuffer[recvInd], numElems, pairRank); |
| 487 | |
| 488 | // copy CPU memory (buffer) to GPU memory (buffer), at offset |
| 489 | gpu_copyCpuToGpu(qureg, &qureg.cpuCommBuffer[recvInd], &qureg.gpuCommBuffer[recvInd], numElems); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | |
| 494 |
no test coverage detected