MCPcopy Index your code
hub / github.com/pytorch/pytorch / Node

Class Node

caffe2/python/task.py:54–89  ·  view source on GitHub ↗

A Node context is used to indicate that all Tasks instantiated within will run on the given node name. (Only the name of the node actually counts.) Example: with TaskGroup() as tg: with Node('node1'): s1 = execution_step(...) Task(ste

Source from the content-addressed store, hash-verified

52
53
54class Node(context.DefaultManaged):
55 """
56 A Node context is used to indicate that all Tasks instantiated within will
57 run on the given node name. (Only the name of the node actually counts.)
58 Example:
59
60 with TaskGroup() as tg:
61 with Node('node1'):
62 s1 = execution_step(...)
63 Task(step=s1)
64 with Node('node2'):
65 s2 = execution_step(...)
66 with Node('node1'):
67 s3 = execution_step(...)
68
69 In this example, all three execution steps will run in parallel.
70 Moreover, s1 and s3 will run on the same node, and can see each
71 others blobs.
72
73 Additionally, a Node can be passed implementation-specific kwargs,
74 in order to specify properties of the node.
75 """
76
77 def __init__(self, node='local', **kwargs):
78 self._name = str(node)
79 self._kwargs = kwargs
80 Cluster.current().add_node(self)
81
82 def __str__(self):
83 return self._name
84
85 def __repr__(self):
86 return "Node(name={}, kwargs={})".format(self._name, self._kwargs)
87
88 def kwargs(self):
89 return self._kwargs
90
91
92class WorkspaceType:

Callers 8

build_pipelineFunction · 0.90
buildMethod · 0.90
_task_groupMethod · 0.90
initMethod · 0.90
load_blobs_locallyMethod · 0.90
__init__Method · 0.70

Calls

no outgoing calls

Tested by 4

build_pipelineFunction · 0.72
buildMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…