Precompiled Libtorch for Apple Silicon

Hi everyone, congratulations on the Apple Silicon and MPS support on Torch v1.12!

Are there any plans to also provide precompiled LibTorch for Apple Silicon on the Installation page? We are using the C++ version of the libraries and for now the only way to automate installation is by downloading the wheel file and extracting the precompiled artifacts.

However, given the precompiled artifacts are already built for wheels, maybe they could also be made available on the website?

Thank you!

1 Like

Oi José :slight_smile:

It would be nice to have pre-built binaries on the official installation page!

FWIW I have set up a small repository with M1 builds here: GitHub - mlverse/libtorch-mac-m1: LibTorch builds for the M1 Macs .
I will use builds in this repository for the R bindings while we don’t have official builds available.

2 Likes

Cool, obrigado!

Any plans to build 1.12.1 as well? :slight_smile:

Done! You will find it here: Releases · mlverse/libtorch-mac-m1 · GitHub

1 Like

Thanks! The wheel version also included libomp (or so it seems), but I have to install it manually with the precompiled version. Do you think this is something worth including too?

Yes, it seems they manually do this in setup.py:

We can probably do the same in our builds.

Actually it seems it only embeds openMP in the x86_64 builds, because in this case it’s embedding libiomp5.dylib (the Intel OpenMP version).

I think we could still copy libomp.dylib to the lib directory though, but not sure what kind of problems that could cause.

Interesting. I can find “libiomp5.dylib” in the Apple arm64 wheel too, so if this is straightforward to add, it would be very helpful. :slight_smile:

Makes sense! I just added a copy of libomp.dylib to the archive.

Excellent, it works. Thank you!

1 Like