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

Method do_execute

src/opr-mm/impl/collective_comm.cpp:637–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635}
636
637void CollectiveComm::do_execute(ExecEnv& env) {
638 auto&& trait = ModeTrait::from_mode(m_param.mode);
639 mgb_assert(
640 owner_graph()->options().async_exec_level,
641 "collective comm must be used with async dispatch");
642 mgb_assert(output().size() == 1, "collective comm only support exactly one output");
643
644 auto disable = m_disable->get_cast<int>();
645 if (disable == 1)
646 return;
647 mgb_assert(
648 disable == 0,
649 "disable flag on CollectiveComm can only be 0 or 1,"
650 " got %d actually.",
651 disable);
652
653 auto cn = output(0)->comp_node();
654 auto runner = [this, cn, &trait] {
655 opr_register();
656 cn.activate();
657
658 if (m_debug_mode) {
659 mgb_log_debug(
660 "collective comm: executing %s, rank = %d, key = %s", cname(),
661 rank(), key().c_str());
662 }
663
664 owner_graph()->event().signal_inplace<cg::event::BeforeKernel>(this, cn);
665 trait.exec(this);
666 owner_graph()->event().signal_inplace<cg::event::AfterKernel>(this, cn);
667 };
668 env.dispatch_on_comp_node(cn, runner);
669}
670
671void CollectiveComm::on_output_comp_node_stream_changed() {}
672

Callers

nothing calls this directly

Calls 6

rankFunction · 0.85
sizeMethod · 0.45
comp_nodeMethod · 0.45
activateMethod · 0.45
execMethod · 0.45
dispatch_on_comp_nodeMethod · 0.45

Tested by

no test coverage detected