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

Function _popen_session

python/tvm/rpc/client.py:269–286  ·  view source on GitHub ↗
(binary)

Source from the content-addressed store, hash-verified

267
268@tvm_ffi.register_global_func("rpc.PopenSession")
269def _popen_session(binary):
270 temp = utils.tempdir()
271
272 if isinstance(binary, bytes | bytearray):
273 path_exec = temp.relpath("server.minrpc")
274 with open(path_exec, "wb") as outfile:
275 outfile.write(binary)
276 os.chmod(path_exec, stat.S_IXUSR | stat.S_IRUSR)
277 path_exec = os.path.abspath(path_exec)
278 else:
279 path_exec = os.path.abspath(binary)
280 if not os.path.isfile(path_exec):
281 raise RuntimeError(f"{path_exec} does not exist.")
282 if not os.access(path_exec, os.X_OK):
283 raise RuntimeError(f"{path_exec} is not executable.")
284
285 sess = _ffi_api.CreatePipeClient(path_exec)
286 return sess
287
288
289class PopenSession(RPCSession):

Callers 1

__init__Method · 0.85

Calls 2

relpathMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…