MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CopyGPUTensorToSameGPU

Method CopyGPUTensorToSameGPU

tensorflow/core/common_runtime/gpu/gpu_util.cc:469–494  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

467
468// static
469void GPUUtil::CopyGPUTensorToSameGPU(Device* gpu_device,
470 const DeviceContext* device_context,
471 const Tensor* src_gpu_tensor,
472 Tensor* dst_gpu_tensor,
473 StatusCallback done) {
474 VLOG(1) << "CopyGPUTensorToSameGPU";
475 const DeviceBase::GpuDeviceInfo* dev_info = nullptr;
476 se::Stream* send_stream = nullptr;
477 Status s = PrepareCopy(gpu_device, device_context, *src_gpu_tensor,
478 dst_gpu_tensor, &dev_info, &send_stream);
479 if (!s.ok()) {
480 done(s);
481 return;
482 }
483
484 const int64 total_bytes = src_gpu_tensor->TotalBytes();
485 if (total_bytes > 0) {
486 void* src_ptr = GetBase(src_gpu_tensor);
487 DeviceMemoryBase gpu_src_ptr(src_ptr, total_bytes);
488 void* dst_ptr = GetBase(dst_gpu_tensor);
489 DeviceMemoryBase gpu_dst_ptr(dst_ptr, total_bytes);
490 send_stream->ThenMemcpy(&gpu_dst_ptr, gpu_src_ptr, total_bytes);
491 }
492
493 done(Status::OK());
494}
495
496} // namespace tensorflow

Callers

nothing calls this directly

Calls 4

PrepareCopyFunction · 0.85
GetBaseFunction · 0.70
okMethod · 0.45
TotalBytesMethod · 0.45

Tested by

no test coverage detected