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

Method ClearAllocatorStats

tensorflow/core/grappler/clusters/single_machine.cc:442–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442Status SingleMachine::ClearAllocatorStats() const {
443 // Cpu_allocator->TracksAllocationSizes() returns true doesn't always mean the
444 // the AllocatorStats would be collected.
445 if (!cpu_allocator_stats_enabled_) {
446 return Status(error::INVALID_ARGUMENT,
447 "Tracking allocation for CPU is not enabled.");
448 }
449
450 const DeviceMgr* device_mgr;
451 TF_RETURN_IF_ERROR(session_->LocalDeviceManager(&device_mgr));
452 std::vector<Device*> devices = device_mgr->ListDevices();
453
454 for (Device* device : devices) {
455 auto* allocator = device->GetAllocator(AllocatorAttributes());
456 if (!allocator->TracksAllocationSizes()) {
457 return Status(error::INVALID_ARGUMENT,
458 "Tracking allocation is not enabled.");
459 }
460 allocator->ClearStats();
461 }
462 return Status::OK();
463}
464
465} // namespace grappler
466} // namespace tensorflow

Callers

nothing calls this directly

Calls 7

AllocatorAttributesClass · 0.85
StatusClass · 0.50
LocalDeviceManagerMethod · 0.45
ListDevicesMethod · 0.45
GetAllocatorMethod · 0.45
TracksAllocationSizesMethod · 0.45
ClearStatsMethod · 0.45

Tested by

no test coverage detected