Universal binaries for libtorch Mac?

With Apple M1 machines now available since November, is there any plan to provide universal binaries (x86_64+ARM) for libtorch Mac ? Hopefully starting with libtorch 1.9.0 ?

thanks !

1 Like

Hi,

If you try to install from nightly (and 1.9 when it will be out) from a arm python on mac, you will see that you already get an arm binary :smiley:
We don’t plan to do a universal binary right now though. It will be two independent binaries that pip/conda will automatically choose for you.

Does that work for you?

Hi @albanD that’s good to know ! Although, while it’s certainly fine for PyTorch (the python framework), it’s more an issue regarding libtorch (the c++ library, which was my primary concern, in particular because it’s embedded into consumer softwares).
I have a macOS/Windows software which uses libtorch for inference. I’m planning to port it to x86_64+ARM M1 by the end of the year; however it entirely depends if libtorch is also available in that format as well.

If universal binary is not available for libtorch, it’d be nice to at least have libtorch x86_64 and libtorch ARM M1 as two downloads, which I can then probably stitch into an universal binary library.

I am not sure we have an arm libtorch yet indeed.

cc @malfet

  • Do we have a convenient way for users to create universal binaries (both python and libtorch)? (even if we don’t distribute them) Or they would have to modify the build by hand?
  • Do we have an arm libtorch?

Upping this @albanD @malfet , as I’m being asked more and more about native Apple Silicon support, but can’t provide it until there are universal binaries for libtorch… Anything on the roadmap on your side ?

1 Like

Hi,

We should definitely be able to help you with that.
Could you open an issue on github (and link it here) so that it doesn’t get lost?

Sorry for the late reply. If you have a PR in mind that would add universal support for our existing builds, please do not hesitate to share it and I will gladly review/merge it.

@albanD I created an issue here: universal binaries for libtorch on mac (x86_64+arm) · Issue #63558 · pytorch/pytorch · GitHub
@malfet unfortunately I don’t know much about the libtorch building process… I’m only downloading the premade binaries through pytorch.org

We don’t plan to do a universal binary right now though. It will be two independent binaries that pip/conda will automatically choose for you.

@albanD what is the status of this? It would be great if you could provide the ARM binary from the downloads page. Right now I have a workaround which is getting the libs by doing a python install, but it’s very hacky.

We currently produce universal binaries for pytorch but have no plan to actively support this for libtorch just yet. This might get included in the 1.12 release if there’s community support for it but PyTorch releng isn’t actively looking at this right now.

Until official builds of libtorch are supported here is a pretty clean work around of using the macosx arm64 wheels without needing to involve Python:

1 Like