Files
pytorch/docs/libtorch.rst
Anders Papitto 018790cd4b thread BUILD_SHARED_LIBS through build_pytorch_libs.sh
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/10272

Differential Revision: D9239337

Pulled By: anderspapitto

fbshipit-source-id: 187b3acb7e85635d9b45a3dd82c98d86a2b51e70
2018-08-10 10:39:31 -07:00

24 lines
766 B
ReStructuredText

libtorch (C++-only)
===================
The core of pytorch can be built and used without Python. A
CMake-based build system compiles the C++ source code into a shared
object, libtorch.so.
Building libtorch
-----------------
There is a script which wraps the CMake build. Invoke it with
::
cd pytorch
BUILD_TORCH=ON ONNX_NAMESPACE=onnx_torch bash tools/build_pytorch_libs.sh --use-nnpack caffe2
ls torch/lib/tmp_install # output is produced here
ls torch/lib/tmp_install/lib/libtorch.so # of particular interest
To produce libtorch.a rather than libtorch.so, set the environment variable `BUILD_SHARED_LIBS=OFF`.
To use ninja rather than make, set `CMAKE_GENERATOR="-GNinja" CMAKE_INSTALL="ninja install"`.
Future work will simplify this further.