MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / sample_on_device

Method sample_on_device

imperative/src/impl/interpreter/interpreter_impl.cpp:1549–1563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1547}
1548
1549void ChannelImpl::sample_on_device(CompNode device, bool force) {
1550 if (!Profiler::is_profiling()) {
1551 return;
1552 }
1553 if (!force) {
1554 thread_local int last_sample_id = 0;
1555 int sample_rate = Profiler::get_option("sample_rate", 0);
1556 if (!sample_rate || ((++last_sample_id) % sample_rate != 0)) {
1557 return;
1558 }
1559 }
1560 MGB_RECORD_EVENT(SampleDeviceEvent, device);
1561 auto [total, free] = device.get_mem_status_bytes();
1562 MGB_RECORD_EVENT(SampleDeviceFinishEvent, device, total, free);
1563}
1564
1565void ChannelImpl::DynamicSublinear::pin(const SmallVector<TensorInfo*>& vec) {
1566 for (auto i : vec) {

Callers

nothing calls this directly

Calls 3

is_profilingFunction · 0.85
get_optionFunction · 0.85
get_mem_status_bytesMethod · 0.45

Tested by

no test coverage detected