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

Method ForEachGpuDeviceNodes

oneflow/core/graph/task_graph.cpp:800–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798}
799
800void TaskGraph::ForEachGpuDeviceNodes(
801 const std::function<void(const HashSet<TaskNode*>& dev_nodes)>& Handler) const {
802 HashMap<std::pair<int64_t, int64_t>, HashSet<TaskNode*>> global_dev_phy_id2nodes;
803 ForEachNode([&](TaskNode* task_node) {
804 if (task_node->device_type() == DeviceType::kCPU) { return; }
805 int64_t dev_phy_id = task_node->stream_id().device_id().device_index();
806 global_dev_phy_id2nodes[{task_node->machine_id(), dev_phy_id}].emplace(task_node);
807 });
808 for (const auto& pair : global_dev_phy_id2nodes) { Handler(pair.second); }
809}
810
811void TaskGraph::EnableInplaceMemSharing(
812 const std::function<bool(const std::string&, const std::string&)>&

Callers 1

CompileMethod · 0.80

Calls 4

device_typeMethod · 0.45
device_indexMethod · 0.45
device_idMethod · 0.45
machine_idMethod · 0.45

Tested by

no test coverage detected