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

Method load_multiple_xpus

test/src/helper.cpp:304–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304std::vector<CompNode> mgb::load_multiple_xpus(size_t num) {
305 auto cn0 = CompNode::load("xpu0");
306 if (CompNode::get_device_count(cn0.device_type()) < num) {
307 cn0 = CompNode::load("cpu0");
308 }
309 std::vector<CompNode> ret{cn0};
310 auto loc = cn0.locator();
311 for (size_t i = 1; i < num; ++i) {
312 loc.device = i;
313 ret.push_back(CompNode::load(loc));
314 }
315 return ret;
316}
317
318bool mgb::check_xpu_available(size_t num) {
319 if (CompNode::get_device_count(CompNode::DeviceType::UNSPEC) < num) {

Callers

nothing calls this directly

Calls 5

get_device_countFunction · 0.85
loadFunction · 0.50
device_typeMethod · 0.45
locatorMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected