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

Method UnifiedMemoryAllocate

tensorflow/stream_executor/cuda/cuda_driver.cc:819–834  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

817}
818
819/* static */ void* GpuDriver::UnifiedMemoryAllocate(GpuContext* context,
820 uint64 bytes) {
821 ScopedActivateContext activation(context);
822 CUdeviceptr result = 0;
823 // "Portable" memory is visible to all CUDA contexts. Safe for our use model.
824 CUresult res = cuMemAllocManaged(&result, bytes, CU_MEM_ATTACH_GLOBAL);
825 if (res != CUDA_SUCCESS) {
826 LOG(ERROR) << "failed to alloc " << bytes
827 << " bytes unified memory; result: " << ToString(res);
828 return nullptr;
829 }
830 void* ptr = reinterpret_cast<void*>(result);
831 VLOG(2) << "allocated " << ptr << " for context " << context->context()
832 << " of " << bytes << " bytes in unified memory";
833 return ptr;
834}
835
836/* static */ void GpuDriver::UnifiedMemoryDeallocate(GpuContext* context,
837 void* location) {

Callers

nothing calls this directly

Calls 2

ToStringFunction · 0.70
contextMethod · 0.45

Tested by

no test coverage detected