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

Method Allocate

tensorflow/stream_executor/tf_allocator_adapter.cc:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36TfAllocatorAdapter::~TfAllocatorAdapter() {}
37
38port::StatusOr<OwningDeviceMemory> TfAllocatorAdapter::Allocate(
39 int device_ordinal, uint64 size, bool retry_on_failure,
40 int64 memory_space) {
41 CHECK_EQ(memory_space, 0);
42 tensorflow::AllocationAttributes attrs;
43 attrs.no_retry_on_failure = !retry_on_failure;
44 void *data = nullptr;
45 if (size != 0) {
46 data = wrapped_->AllocateRaw(tensorflow::Allocator::kAllocatorAlignment,
47 size, attrs);
48 if (data == nullptr) {
49 return tensorflow::errors::ResourceExhausted(
50 "Out of memory while trying to allocate ", size, " bytes.");
51 }
52 }
53 return OwningDeviceMemory(DeviceMemoryBase(data, size), device_ordinal, this);
54}
55
56port::Status TfAllocatorAdapter::Deallocate(int device_ordinal,
57 DeviceMemoryBase mem) {

Callers

nothing calls this directly

Calls 3

ResourceExhaustedFunction · 0.85
DeviceMemoryBaseClass · 0.70
AllocateRawMethod · 0.45

Tested by

no test coverage detected