You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create native C++ binaries using a CMake based build system to allow third-parties to integrate torchtext in their applications
Motivation
Currently torchtext鈥檚 C++ extension and third party libraries are built using PyTorch鈥檚 CppExtension module. Though this approach has some pros, the main downsides are that it makes integrating third party libraries challenging and the resulting library is linked against libpython, via libtorch_python. Due to the dependency on libpython, OSS torchtext does not have a standalone C++ binary that downstream users can depend on. This is a blocker for some customers who want to use torchtext operators in a non-Python environment (using TorchScript or as a C++ API).
There are some issues created by users that further motivate this work:
We aim to resolve these problems by moving our build system to use CMake. Firstly, CMake should make it easier to integrate third party libraries simply by adding a reference to it鈥檚 own CMake file to build the library. Secondly, since CMake is language-agnostic, there is no need to link against libpython.
Before making any changes to torchtext鈥檚 build system, we need to ensure that there is adequate testing across all platforms in our OSS CI. This means enabling MacOS unit tests in CircleCI to catch platform specific build failures caused by the switch to CMake.
馃殌 Feature
Create native C++ binaries using a CMake based build system to allow third-parties to integrate torchtext in their applications
Motivation
Currently torchtext鈥檚 C++ extension and third party libraries are built using PyTorch鈥檚
CppExtension
module. Though this approach has some pros, the main downsides are that it makes integrating third party libraries challenging and the resulting library is linked againstlibpython
, vialibtorch_python
. Due to the dependency onlibpython
, OSS torchtext does not have a standalone C++ binary that downstream users can depend on. This is a blocker for some customers who want to use torchtext operators in a non-Python environment (using TorchScript or as a C++ API).There are some issues created by users that further motivate this work:
Pitch
We aim to resolve these problems by moving our build system to use CMake. Firstly, CMake should make it easier to integrate third party libraries simply by adding a reference to it鈥檚 own CMake file to build the library. Secondly, since CMake is language-agnostic, there is no need to link against libpython.
Before making any changes to torchtext鈥檚 build system, we need to ensure that there is adequate testing across all platforms in our OSS CI. This means enabling MacOS unit tests in CircleCI to catch platform specific build failures caused by the switch to CMake.
Milestones
CppExtension
to CMake for torchtext and create a single_torchtext.so
library with all source files fromcsrc/
folder [CMake 2/3] Add CMake Build to torchtext to create single_torchtext
library聽#1673_torchtext.so
library which will link against alibtorchtext.so
library containing source files with pure C++ dependencies [CMake 3/3] Split source files with Python dependency to separate library聽#1660libtorchtext.so
within a simple C++ application Add libtorchtext cpp example聽#1817The text was updated successfully, but these errors were encountered: