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

Method foreach

src/core/impl/comp_node/cuda/comp_node.cpp:1049–1064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049void CudaCompNode::foreach (thin_function<void(CompNode)> callback) {
1050 auto sd = CudaCompNodeImpl::sd;
1051 if (!sd)
1052 return;
1053
1054 for (int i = 0;; ++i) {
1055 CompNode cur;
1056 {
1057 MGB_LOCK_GUARD(sd->mtx);
1058 if (i >= sd->nr_node)
1059 return;
1060 cur = make_comp_node_from_impl(&sd->node[i]);
1061 }
1062 callback(cur);
1063 }
1064}
1065
1066size_t CudaCompNode::get_device_count(bool warn) {
1067 static int cnt = -1;

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected