Building libtorch on different versions of Linux

After trying with Ubuntu 20, Mint 20, and Ubuntu 18, I was unable to get any of the pre-built libtorch packages to work. My target application (MorphoGraphX) only needs libc10_cuda.so libc10.so libtorch_cpu.so libtorch_cuda.so libtorch.so so that it can run traced models.

I was able to get things working on all those platforms by compiling it from source. However, the package for Mint 20 did not work on Ubuntu 20, and vice-versa, and I even have a case where a package built for Ubuntu 18 does not work on another Ubuntu 18 machine that has the same graphics card.

The error is most commonly about no kernel image being available. I have tried compiling with the architecture flags for the specific card by setting TORCH_CUDA_ARCH_LIST, but it doesn’t seem to make much difference, except that startup is faster. It works on the build machine, but not the target with the same OS and graphics card.

Anyone know what might be causing this problem?