Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible build script for Android support #594

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

laptou
Copy link

@laptou laptou commented Dec 23, 2022

I wanted to be able to bind tch to PyTorch Mobile (libtorch on Android). To this end, I made a few changes to the build script:

  • I added environment specific environment variables for giving the path to libtorch (ex.: LIBTORCH_LIB_aarch64-linux-android) so that I can give a path to a different libtorch for each architecture and OS.
  • I removed the include and lib from the LIBTORCH_INCLUDE and LIBTORCH_LIB paths, so the user is now supposed to include these in the paths themselves. This is a breaking change, but it was necessary to make things work on Android, because the folders have different names there.
  • PyTorch has two possible build for Android, a "lite" version and a normal one. They have different names for the .so file, so I added a LIBTORCH_LITE file to tell the build script which one we are linking against.

I also made some changes to the code, namely support for moving tensors to the Vulkan device. I was disappointed to find out that PyTorch support for Vulkan is pretty half-baked, but still.

@laptou laptou changed the title More flexible build script More flexible build script for Android support Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant