pytorch/torch/csrc/deploy
2022-06-06 09:40:19 -07:00
..
example Revert D34868005: [torch::deploy] remove asserts from deploy 2022-03-15 18:30:08 +00:00
interpreter Add all bzl files per D36874458 2022-06-06 09:40:19 -07:00
unity Add all bzl files per D36874458 2022-06-06 09:40:19 -07:00
.gitignore
benchmark.cpp [torch::deploy] Remove c10::errors from torch::deploy (#74283) 2022-03-16 23:51:27 +00:00
CMakeLists.txt [torch deploy] Re-define D_GLIBCXX_USE_CXX11_ABI in deploy CMakeLists.txt 2022-04-20 05:36:49 +00:00
deploy.cpp torch/deploy,package: log usage for InterpreterManager, PackageExporter, PackageImporter (#77097) 2022-05-10 19:26:44 +00:00
deploy.h [torch::deploy] Replace c10::optional with boost implementation (#74286) 2022-03-16 23:51:27 +00:00
elf_file.cpp [torch::deploy] Replace c10::optional with boost implementation (#74286) 2022-03-16 23:51:27 +00:00
elf_file.h [torch::deploy] Replace c10::optional with boost implementation (#74286) 2022-03-16 23:51:27 +00:00
environment.h [torch::deploy] Remove c10::errors from torch::deploy (#74283) 2022-03-16 23:51:27 +00:00
Exception.h [torch::deploy] Remove c10::errors from torch::deploy (#74283) 2022-03-16 23:51:27 +00:00
interactive_embedded_interpreter.cpp torch::deploy unity and its demo (#67134) 2021-11-01 19:32:49 -07:00
loader.cpp [torch::deploy] Replace c10::optional with boost implementation (#74286) 2022-03-16 23:51:27 +00:00
loader.h [torch::deploy] Replace c10::optional with boost implementation (#74286) 2022-03-16 23:51:27 +00:00
mem_file.h [torch::deploy] Remove c10::errors from torch::deploy (#74283) 2022-03-16 23:51:27 +00:00
noop_environment.h torch::deploy unity and its demo (#67134) 2021-11-01 19:32:49 -07:00
path_environment.cpp torch::deploy unity and its demo (#67134) 2021-11-01 19:32:49 -07:00
path_environment.h torch::deploy unity and its demo (#67134) 2021-11-01 19:32:49 -07:00
README.md Back out "Back out "[torch deploy] Update deploy.rst with working simple example"" (#76713) 2022-05-03 14:12:18 +00:00
remove_dt_needed.cpp Use irange in PyTorch (#72836) 2022-02-18 19:29:07 +00:00
test_deploy_from_python.py
test_deploy_gpu.cpp Move torch::deploy tests to their own workflow job (#73676) 2022-03-17 12:19:48 +00:00
test_deploy_lib.cpp
test_deploy_missing_interpreter.cpp [torch::deploy] Remove c10::errors from torch::deploy (#74283) 2022-03-16 23:51:27 +00:00
test_deploy_python_ext.cpp [deploy] fix typo in registerModuleSource (#66107) 2021-10-05 11:15:35 -07:00
test_deploy_python.py
test_deploy.cpp deploy: add dummy metadata for builtin packages (#76211) 2022-04-26 01:00:02 +00:00

Torch Deploy

This is an experimental feature to embed multiple python interpreters inside the torch library, providing a solution to the 'GIL problem' for multithreading with the convenience of python and eager or torchscripted pytorch programs.

libinterpreter

This is an internal library used behind the scenes to enable multiple python interpreters in a single deploy runtime. libinterpreter.so is DLOPENed multiple times by the deploy library. Each copy of libinterpreter exposes a simple interpreter interface but hides its python and other internal symbols, preventing the different python instances from seeing each other.

CPython build

Torch Deploy builds CPython from source as part of the embedded python interpreter. CPython has a flexible build system that builds successfully with or without a variety of dependencies installed - if missing, the resulting CPython build simply omits optional functionality, meaning some stdlib modules/libs are not present.

Currently, the torch deploy build setup assumes the full CPython build is present. This matters because there is a hardcoded list of python stdlib modules that are explicitly loaded from the embedded binary at runtime.

rebuilding CPython after installing missing dependencies

Because CPython builds successfully when optional dependencies are missing, the cmake wrapper currently doesn't know if you need to rebuild CPython after adding missing dependencies (or whether dependencies were missing in the first place).

To be safe, install the complete list of dependencies for CPython for your platform, before trying to build torch with USE_DEPLOY=1.

If you already built CPython without all the dependencies and want to fix it, just blow away the CPython folder under torch/csrc/deploy/third_party, install the missing system dependencies, and re-attempt the pytorch build command.

Example

Read the getting started guide for an example on how to use torch::deploy.