MCPcopy Index your code
hub / github.com/apache/tvm / start

Method start

python/tvm/runtime/disco/process_pool.py:111–154  ·  view source on GitHub ↗

Start a new subprocess if nothing is available

(self)

Source from the content-addressed store, hash-verified

109 pass
110
111 def start(self):
112 """Start a new subprocess if nothing is available"""
113 if self._proc is not None:
114 return None, None
115
116 # connect subprocess with a pair of pipes
117 main_read, worker_write = os.pipe()
118 worker_read, main_write = os.pipe()
119
120 cmd = [
121 sys.executable,
122 "-m",
123 self.entrypoint,
124 str(self.worker_id),
125 str(self.num_workers),
126 str(self.num_groups),
127 ]
128 if sys.platform == "win32":
129 import msvcrt # pylint: disable=import-error,import-outside-toplevel
130
131 worker_read_handle = msvcrt.get_osfhandle(worker_read)
132 worker_write_handle = msvcrt.get_osfhandle(worker_write)
133 os.set_handle_inheritable(worker_read_handle, True)
134 os.set_handle_inheritable(worker_write_handle, True)
135 cmd += [str(worker_read_handle), str(worker_write_handle)]
136 self._proc = subprocess.Popen(
137 cmd,
138 close_fds=False,
139 stdout=self._stdout,
140 stderr=self._stderr,
141 )
142 else:
143 cmd += [str(worker_read), str(worker_write)]
144 self._proc = subprocess.Popen( # pylint: disable=consider-using-with
145 cmd,
146 pass_fds=(worker_read, worker_write),
147 stdout=self._stdout,
148 stderr=self._stderr,
149 )
150
151 # close worker side of the pipe
152 os.close(worker_read)
153 os.close(worker_write)
154 return main_read, main_write
155
156
157def _kill_child_processes(pid):

Callers 9

_wait_launch_completeMethod · 0.45
_servingFunction · 0.45
__init__Method · 0.45
runMethod · 0.45
__init__Method · 0.45
runMethod · 0.45
__init__Method · 0.45
websocket_proxy_serverFunction · 0.45
result_funcFunction · 0.45

Calls 2

strFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected