Is it possible to build pytorch to dlopen from a separate libtorch installation?

27 Views Asked by At

I'd like to reuse my Linux libtorch installation in Pytorch as well. The benefits would be:

  • reducing unpacked Python package size by ~600MB of shared objects
  • certainty that I'm using the same backend implementation in both Python and other frontends

Is this possible? Scanning the Pytorch code, I don't see an obvious way (it seems to load via CDLL from a fixed path relative to __init__.py), but I'm not certain.

Extra context: It wasn't too hard to make a custom Pytorch build that used system CUDA/CUDNN libraries, so I'm somewhat encouraged and hope this is possible for libtorch as well.

0

There are 0 best solutions below