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

Method foreach

src/core/impl/comp_node/cambricon/comp_node.cpp:810–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

808}
809
810void CambriconCompNode::foreach (thin_function<void(CompNode)> callback) {
811 auto sd = CambriconCompNodeImpl::sd;
812 if (!sd)
813 return;
814
815 for (int i = 0;; ++i) {
816 CompNode cur;
817 {
818 MGB_LOCK_GUARD(sd->mtx);
819 if (i >= sd->nr_node)
820 return;
821 cur = make_comp_node_from_impl(&sd->node[i]);
822 }
823 callback(cur);
824 }
825}
826
827size_t CambriconCompNode::get_device_count(bool warn) {
828 static int cnt = -1;

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected