MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / SendMsg

Method SendMsg

oneflow/core/lazy/actor/actor_message_bus.cpp:24–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace oneflow {
23
24void ActorMsgBus::SendMsg(const ActorMsg& msg) {
25 int64_t dst_machine_id = MachineId4ActorId(msg.dst_actor_id());
26 if (dst_machine_id == GlobalProcessCtx::Rank()) {
27 SendMsgWithoutCommNet(msg);
28 } else {
29 if (msg.IsDataRegstMsgToConsumer()) {
30 int64_t comm_net_sequence;
31 {
32 std::unique_lock<std::mutex> lock(
33 regst_desc_id_dst_actor_id2comm_net_sequence_number_mutex_);
34 int64_t& comm_net_sequence_ref =
35 regst_desc_id_dst_actor_id2comm_net_sequence_number_[std::make_pair(
36 msg.regst_desc_id(), msg.dst_actor_id())];
37 comm_net_sequence = comm_net_sequence_ref;
38 comm_net_sequence_ref += 1;
39 }
40 ActorMsg new_msg = msg;
41 new_msg.set_comm_net_sequence_number(comm_net_sequence);
42 Singleton<CommNet>::Get()->SendActorMsg(dst_machine_id, new_msg);
43 } else {
44 Singleton<CommNet>::Get()->SendActorMsg(dst_machine_id, msg);
45 }
46 }
47}
48
49void ActorMsgBus::SendMsgWithoutCommNet(const ActorMsg& msg) {
50 CHECK_EQ(MachineId4ActorId(msg.dst_actor_id()), GlobalProcessCtx::Rank());

Callers 6

InitActMsgMethod · 0.80
ActOnceMethod · 0.80
SendEORDMsgMethod · 0.80
AsyncSendQueuedMsgMethod · 0.80
SendCmdMsgFunction · 0.80

Calls 7

MachineId4ActorIdFunction · 0.85
GetFunction · 0.85
dst_actor_idMethod · 0.80
regst_desc_idMethod · 0.45
SendActorMsgMethod · 0.45

Tested by

no test coverage detected