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

Function exchangeGpuSubBuffers

quest/src/comm/comm_routines.cpp:417–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415
416
417void exchangeGpuSubBuffers(Qureg qureg, qindex numAmps, int pairRank) {
418
419 auto [sendInd, recvInd] = getSubBufferSendRecvInds(qureg);
420
421 // exchange GPU memory directly if possible
422 if (gpu_isDirectGpuCommPossible()) {
423
424 // ensure GPU is finished modifying gpuCommBuffer
425 gpu_sync();
426
427 // communicate via GPUDirect or Peer-to-Peer
428 exchangeArrays(&qureg.gpuCommBuffer[sendInd], &qureg.gpuCommBuffer[recvInd], numAmps, pairRank);
429
430 // otherwise route the memory through the CPU
431 } else {
432
433 // copy GPU memory (buffer) into CPU memory (amps), preserving offset
434 gpu_copyGpuToCpu(qureg, &qureg.gpuCommBuffer[sendInd], &qureg.cpuAmps[sendInd], numAmps);
435
436 // exchange CPU memory (amps) to other node's CPU memory (buffer), receiving at index 0
437 exchangeArrays(&qureg.cpuAmps[sendInd], &qureg.cpuCommBuffer[recvInd], numAmps, pairRank);
438
439 // copy CPU memory (buffer) to GPU memory (buffer), receiving at index 0
440 gpu_copyCpuToGpu(qureg, &qureg.cpuCommBuffer[recvInd], &qureg.gpuCommBuffer[recvInd], numAmps);
441 }
442}
443
444
445void asynchSendGpuSubBuffer(Qureg qureg, qindex numElems, int pairRank) {

Callers 1

comm_exchangeSubBuffersFunction · 0.85

Calls 6

getSubBufferSendRecvIndsFunction · 0.85
gpu_syncFunction · 0.85
exchangeArraysFunction · 0.85
gpu_copyGpuToCpuFunction · 0.85
gpu_copyCpuToGpuFunction · 0.85

Tested by

no test coverage detected