PyTorch and CUDA 9.1

username: rasbt
cooked: <p>I noticed that PyTorch couldn’t find the CUDA installation after upgrading to CUDA 9.1 and checking via <code>torch.cuda.is_available()</code>. However, when I downgraded to CUDA 9.0 it worked all fine though. For the pip installer, on the PyTorch page, I noticed that it says “cu90”:</p>
<pre><code>pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl 
</code></pre>
<p>I am just wondering if this really is just a “path” issue regarding CUDA 9.1 or if this intended by design (e.g., breaking changes). Not that I need CUDA 9.1, I am just wondering if this is done on purpose, i.e., that the installer only specifically supports CUDA 9.0 and not the consequent patch version (assuming NVIDIA uses semantic versioning)</p>

username: jrzaurin
cooked: <p>Hi</p>
<p>As of today (2nd of February 2018) all seems to work fine after</p>
<p><code>conda install pytorch torchvision cuda90 -c pytorch</code></p>
<p>using:</p>
<p><code>conda 4.4.8</code></p>
<p>and cuda version:</p>
<pre><code>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation 
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
</code></pre>
<p>Ubuntu:</p>
<p><code>Ubuntu 16.04.3</code></p>
<p>Python</p>
<p><code>Python 3.6.4</code></p>
<p>And I get</p>
<pre><code class="lang-auto">In [1]: import torch

In [2]: torch.cuda.is_available()
Out[2]: True

In [3]: torch.cuda.get_device_name(0)
Out[3]: 'Tesla K80'```</code></pre>

username: rasbt
cooked: <p>Thanks for the answer! I had a little misconception when I asked this question. I didn’t know that PyTorch (the binary installers via conda and pip wheels) already ship the necessary CUDA and cuDNN parts.</p>
<p>For some reason, PyTorch did not detect cuda via “torch.cuda.is_available” first. When I tried with a fresh OS install (via Amazon AWS EC2), I noticed that even though I had the correct NVIDIA drivers for the given graphics card installed, it wouldn’t work. What fixed the problem was downloading CUDA 9.0 and running the installer without installing CUDA itself (during the installation, it asks you to install the NVIDIA display driver, which I answered with “yes” and the CUDA 9.0 toolkit, which I answered with “no”). After installing the graphics card drivers through the CUDA installer, it all worked fine (even without CUDA installed as PyTorch already comes with it).</p>

username: voxmenthe
cooked: <p>I have been using pytorch 0.3 with CUDA 9.1 for a few weeks now on ubuntu 16.04 and non-anaconda - just using the tensorflow-gpu-py3 docker image with nvidia-docker and it works fine.</p>
<p>Also this is a non-anaconda install - just used pip and the cu90 installer.</p>

username: rasbt
cooked: <p>Hm, are you installing it via pip wheels or source code? Because as far as I understood, PyTorch would be using it’s own CUDA parts when you do the regular pip install (i.e., wheels; <code>pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl </code>). So, my understanding is that even if you have locally CUDA 9.1 installed, it would be using the CUDA 9.0 parts that it comes with. Based on</p>
<blockquote>
<p>conda binary has its own cuda, it doesn’t use system CUDA at all.</p>
</blockquote>
<aside class="quote" data-post="1" data-topic="6863">
  <div class="title">
    <div class="quote-controls"></div>
    <img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/karandwivedi42/48/71_2.png" class="avatar">
    <a href="https://discuss.pytorch.org/t/is-it-possible-to-link-conda-binary-to-cuda-in-non-standard-location/6863">Is it possible to link conda binary to cuda in non standard location?</a> 
  </div>
  <blockquote>
    Hi 
Does the conda binary use the $CUDA_ROOT and $LD_LIBRARY_PATH variables? If I want to use CUDA installed at a different location than /usr/local/cuda do I have to install from source? 
Thanks in advance <img width="20" height="20" src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title="slight_smile" alt="slight_smile" class="emoji">
  </blockquote>
</aside>

<p>(There’s probably no way to tell which CUDA version PyTorch is using via the Python interpreter?)</p>

username: smth
cooked: <p><a class="mention" href="/u/rasbt">@rasbt</a></p>
<blockquote>
<p>(There’s probably no way to tell which CUDA version PyTorch is using via the Python interpreter?)</p>
</blockquote>
<pre><code class="lang-auto">import torch
print(torch.version.cuda)
</code></pre>

username: rasbt
cooked: <p>Wonderful, thanks!</p>
<p><a class="mention" href="/u/voxmenthe">@voxmenthe</a></p>
<p>Maybe it would be worthwhile trying that on your system. I am curious whether it shows ‘9.0.176’ or a 9.1 version after the pip cu90 install</p>

username: voxmenthe
cooked: <p>Yeah I get 9.0.176 inside of my docker container (which is where pytorch is installed)</p>

username: Deeply
cooked: <p>Hi <a class="mention" href="/u/jrzaurin">@jrzaurin</a><br>
I am doing a new installation and I have the same Cuda version that you showed above;<br>
<code>Cuda compilation tools, release 9.1, V9.1.85</code>, same Ubuntu and Python.<br>
However, I am thinking to pick <code>Cuda 9.2</code> from the PyTorch installation options, something like:</p>
<p><code>conda install pytorch torchvision cuda92 -c pytorch</code></p>
<p>Not sure if I will have any problems, so, just wanted to ask before giving it a go.</p>

username: jrzaurin
cooked: <p>Hey there,</p>
<p>For me it worked with <code>Cuda 9.0</code> so:</p>
<p><code>conda install pytorch torchvision -c pytorch</code></p>
<p>Have not tried with 9.2</p>

username: laoreja
cooked: <p>It says CUDA 8.0, but my system does not have CUDA 8.0 at all (I have cuda 9.0 and cuda 9.1)?<br>
And I checked the source file, /usr/local/lib/python3.5/dist-packages/torch/version.py, it has a line cuda = ‘8.0.61’.</p>

username: smth
cooked: <p><a class="mention" href="/u/laoreja">@laoreja</a> the CUDA is inbuilt in the PyTorch package</p>

username: laoreja
cooked: <p>Thank you! How about the cudnn? is it also inbuilt in the PyTorch package?</p>

username: laoreja
cooked: <aside class="quote no-group" data-username="smth" data-post="6" data-topic="13126">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/48/13_2.png" class="avatar"> smth:</div>
<blockquote>
<p>import torch print(torch.version.cuda)</p>
</blockquote>
</aside>
<p>And I’m not using conda, just through pip install, in this way, is the CUDA also inbuilt?</p>

username: rasbt
cooked: <aside class="quote no-group quote-modified" data-username="laoreja" data-post="14" data-topic="13126" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/laoreja/48/5482_2.png" class="avatar"> laoreja:</div>
<blockquote>
<aside class="quote no-group" data-username="smth" data-post="6" data-topic="13126">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/48/13_2.png" class="avatar"> smth:</div>
<blockquote>
<p>import torch print(torch.version.cuda)</p>
</blockquote>
</aside>
<p>And I’m not using conda, just through pip install, in this way, is the CUDA also inbuilt?</p>
</blockquote>
</aside>
<p>Yes. There is a specific CPU version you can install though.</p>
<p>I think the only way to bring your own, you could compile and install it from source:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://pytorch.org/get-started/locally/#mac-from-source">
  <header class="source">
      <img src="https://pytorch.org/favicon.ico?" class="site-icon" width="32" height="32">

      <a href="https://pytorch.org/get-started/locally/#mac-from-source" target="_blank" rel="noopener nofollow ugc">PyTorch</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/362;"><img src="https://pytorch.org/assets/images/social-share.jpg" class="thumbnail" width="690" height="362"></div>

<h3><a href="https://pytorch.org/get-started/locally/#mac-from-source" target="_blank" rel="noopener nofollow ugc">Start Locally</a></h3>

  <p>Start Locally</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


username: Nitin_Pasumarthy
cooked: <p>What version of torch works with cuda 9.1?</p>

username: refe-dxl
cooked: <p>Hi, I also wonder that, because I noticed there is no pytorch version suit with Cuda 9.1 in there downlod website, only with 9.0 and 9.2</p>