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

Method GetDistance

oneflow/core/graph/boxing/sub_task_graph_builder_util.cpp:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75int64_t SubTskGphBuilderUtil::GetDistance(
76 const int64_t src_machine_id, const int64_t src_dev_phy_id, const DeviceType src_device_type,
77 const int64_t dst_machine_id, const int64_t dst_dev_phy_id, const DeviceType dst_device_type) {
78 if (src_machine_id != dst_machine_id) {
79 return kDistanceDiffMachine;
80 } else if (src_device_type != dst_device_type) {
81 return kDistanceSameMachine;
82 } else if (src_device_type == DeviceType::kCPU) {
83 return kDistanceSameDevice;
84 } else {
85 if (src_dev_phy_id == dst_dev_phy_id) {
86 return kDistanceSameDevice;
87 } else {
88 return kDistanceSameMachine;
89 }
90 }
91}
92
93int64_t SubTskGphBuilderUtil::GetDistance(const ParallelDesc& src_parallel_desc,
94 const int64_t src_parallel_id,

Callers

nothing calls this directly

Calls 6

MachineId4ParallelIdMethod · 0.80
DeviceId4ParallelIdMethod · 0.80
device_typeMethod · 0.45
device_idMethod · 0.45
device_indexMethod · 0.45
machine_idMethod · 0.45

Tested by

no test coverage detected