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

Function load_cuda_cn

src/core/impl/comp_node_api.cpp:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35mgbComputeNode_t load_cuda_cn(int device_id, int stream) {
36 std::string loc = ssprintf("gpu%i:%i", device_id, stream);
37 mgb_assert(!is_finalize());
38 auto& cache = cn_cache();
39 if (cache.find(loc) == cache.end()) {
40 auto* cn = new mgb::CompNode;
41 (*cn) = mgb::CompNode::load(loc);
42 mgb_assert(cn->to_string_physical() == loc);
43 cache[loc] = cn;
44 cn->activate();
45 }
46 return reinterpret_cast<mgbComputeNode_t>(cache[loc]);
47}
48
49void unload_cuda_cn(mgbComputeNode_t cn) {
50 auto* device = reinterpret_cast<mgb::CompNode*>(cn);

Callers

nothing calls this directly

Calls 6

is_finalizeFunction · 0.85
to_string_physicalMethod · 0.80
loadFunction · 0.50
findMethod · 0.45
endMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected