[Ubuntu] What version of CUDA/PyTorch/etc. can run on a Nvidia GTX 680 (compute capability=3.0)

username: deltabravozulu
cooked: <p>I’m having a rough go of trying to get pytorch to work on my PC. I’m running Ubuntu 20.04 with a Nvidia GTX 680. It’s old, but generally works for most things.</p>
<p>Could someone give me the newest version numbers that will work on this setup? I’ve tried CUDA 11.2 and 10.2 with PyTorch 1.8.1 and 1.5.0 (among a host of others) to no avail so far.</p>

username: ptrblck
cooked: <p>You could compile PyTorch from source using CUDA10.2 (which should support sm_30) as described <a href="https://github.com/pytorch/pytorch#from-source">here</a>.</p>

username: deltabravozulu
cooked: <p>Thanks for the reply! It seems like two problems emerge when trying to build the latest PyTorch with CUDA 10.2 – <a href="https://github.com/pytorch/pytorch/blob/master/torch/cuda/__init__.py#L59-L83" rel="noopener nofollow ugc">./torch/cuda/__init.py#L59-L83</a> causes it to fail for anything under sm_30 as does <a href="https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L1522-L1535" rel="noopener nofollow ugc">./torch/utils/cpp_extension.py#L1522-L1535</a></p>

username: ptrblck
cooked: <p>That’s a good finding as I wasn’t sure what the current min. compute capability is.<br>
In that case <code>sm_30</code> won’t work, unfortunately.</p>

username: deltabravozulu
cooked: <p><img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"> the secret is a “&lt;” and a couple of "3.0"s<br>
1.) In <a href="https://github.com/pytorch/pytorch/blob/master/torch/cuda/__init__.py#L80" rel="noopener nofollow ugc">./torch/cuda/<strong>init</strong>.py#L80</a> change</p>
<pre><code class="lang-auto">if capability == (3, 0) or major &lt; 3:
</code></pre>
<p>to</p>
<pre><code class="lang-auto">if capability &lt; (3, 0) or major &lt; 3:
</code></pre>
<ol start="2">
<li>In <a href="https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L1522-L1534" rel="noopener nofollow ugc">./torch/utils/cpp_extension.py#L1522-L1535</a> change</li>
</ol>
<pre><code class="lang-auto">    named_arches = collections.OrderedDict([
        ('Kepler+Tesla', '3.7'),
        ('Kepler', '3.5+PTX'),
        ('Maxwell+Tegra', '5.3'),
        ('Maxwell', '5.0;5.2+PTX'),
        ('Pascal', '6.0;6.1+PTX'),
        ('Volta', '7.0+PTX'),
        ('Turing', '7.5+PTX'),
        ('Ampere', '8.0;8.6+PTX'),
    ])

    supported_arches = ['3.5', '3.7', '5.0', '5.2', '5.3', '6.0', '6.1', '6.2',
                        '7.0', '7.2', '7.5', '8.0', '8.6']
    valid_arch_strings = supported_arches + [s + "+PTX" for s in supported_arches]
</code></pre>
<p>to</p>
<pre><code class="lang-auto">    named_arches = collections.OrderedDict([
        ('Kepler+Tesla', '3.7'),
        ('Kepler', '3.0;3.5+PTX'),
        ('Maxwell+Tegra', '5.3'),
        ('Maxwell', '5.0;5.2+PTX'),
        ('Pascal', '6.0;6.1+PTX'),
        ('Volta', '7.0+PTX'),
        ('Turing', '7.5+PTX'),
        ('Ampere', '8.0;8.6+PTX'),
    ])

    supported_arches = ['3.0','3.5', '3.7', '5.0', '5.2', '5.3', '6.0', '6.1', '6.2',
                        '7.0', '7.2', '7.5', '8.0', '8.6']
    valid_arch_strings = supported_arches + [s + "+PTX" for s in supported_arches]
</code></pre>
<p>Then it works just fine. Tested it this evening myself <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>