Pytorch Installation for different CUDA architectures

  docker, pytorch, torch

I have a Dockerfile which installs PyTorch library from the source code.

Here is the snippet from Dockerfile which performs the installation from source code of pytorch

RUN cd /tmp/ 
 && git clone 
 && cd pytorch  
 && git submodule sync && git submodule update --init --recursive 
 && sudo TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0" python3 install

I don’t have proper understanding of what’s happening here and would appreciate some input from the community:

  • Why does PyTorch need different way of installation for different CUDA versions?
  • What is the role of TORCH_CUDA_ARCH_LIST in this context?
  • If my machine has multiple CUDA setups, does that mean I will have multiple PyTorch versions (specific to each CUDA setup) installed in my Docker container?
  • If my machine has none of the mentioned CUDA setups ("6.0 6.1 7.0 7.5 8.0"), will the PyTorch installation fail?

Source: Docker Questions