Pytorch 0.5.0a0 + cuda 9.2 links against cuda 8.0

Hi,
I installed pytorch 0.5 using the setup.py following the official guide.
My system has cuda 9.2 installed and it is included into my bash env by setting
LD_LIBRARY_PATH and PATH like described in the CUDA installation guide from nvidia.

NOTE: I upgraded from CUDA 8.0 to CUDA 9.2. The files of CUDA 8.0 are not deleted but
my bash env does not export any of CUDA 8.0 related directories:

(pyt_gh) chofer@eisbaer:~$ env | grep cuda
LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64
PATH=/scratch2/chofer/opt/anaconda3/envs/pyt_gh/bin:/scratch2/chofer/opt/anaconda3/bin:/usr/local/cuda-9.2/bin:/usr/local/sbin:/usr/local/bin:/usr/local/nfs/sbin:/usr/local/nfs/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/pgi/linux86-64/14.9/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/pma/chofer/opt

However, after compilation I get an import error:

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch2/chofer/opt/anaconda3/envs/pyt_gh/lib/python3.6/site-packages/torch/__init__.py", line 78, in <module>
    from torch._C import *
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

Adding /usr/local/cuda-8.0/lib64 to LD_LIBRARY_PATH resolves the problems.

**It seems to me that pytorch 0.5 links against two CUDA versions, i.e., 8.0 + 9.2, is this a bug? **
(It would mean that one has to have installed both versions in order for pytorch to run)
Is this just happening because the cuda 8.0 directories are not deleted?

May be related to https://github.com/pytorch/pytorch/issues/1941

My Modification of the installation routine:

  • I installed into a virtual env created by conda (env_name = pyt_gh)
  • changed: export CMAKE_PREFIX_PATH="/scratch2/chofer/opt/anaconda3/envs/pyt_gh/"
  • changed: conda install -c pytorch magma-cuda91