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

Method to_string

src/core/impl/comp_node/comp_node.cpp:285–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285std::string CompNode::Locator::to_string() const {
286 if (device == DEVICE_CPU_DEFAULT) {
287 return "cpu:default";
288 } else if (device == DEVICE_MULTITHREAD_DEFAULT) {
289 std::string ret = "multithread:default:";
290 ret.append(get_stream_str(stream));
291 return ret;
292 } else if (type == DeviceType::MULTITHREAD) {
293 std::string ret("multithread");
294 ret.append(get_stream_str(stream)).append(":").append(get_stream_str(device));
295 return ret;
296 }
297 char numstr[32];
298 if (device == -1) {
299 numstr[0] = 'x';
300 numstr[1] = 0;
301 } else {
302 mgb_assert(device >= 0);
303 sprintf(numstr, "%d", device);
304 }
305 std::string ret(device_type2str(type));
306 ret.append(numstr).append(":").append(get_stream_str(stream));
307 return ret;
308}
309
310/* ==================== CompNodeDepedentObject ==================== */
311

Callers 4

log_comp_node_createdMethod · 0.45
add_callbackMethod · 0.45

Calls 3

get_stream_strFunction · 0.85
device_type2strFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected