Help! How to Force PyTorch Build from Source on Older CUDA GPU?

username: TechVillain
cooked: <p>I am a music producer and on our studio’s computers, we have hundreds of music software installed and configured in the past years, and therefore we are unable to change computers easily.</p>
<p>Our Windows computers are with Nvidia GTX 660M GPU, and therefore the highest Nvidia Driver we could install is version 426.00, and the highest CUDA we could install is version 10.1 Update 2.</p>
<p>Recently, we are working with an AI music software, which requires PyTorch 1.10.0 or above. Unfortunately, there are no Torch binaries &gt;=1.10.0 built with CUDA 10.1 of which can be downloaded as wheel files, so I have to build from source by myself.</p>
<p>No big deal. I have successfully built PyTorch 1.9.1 from source on CUDA 10.1 in the past.</p>
<p>The problem is, when I use the same environment to build PyTorch 1.10.0, or any versions above, cmake gives me an error, saying “CUDA 10.2 is needed”, and shuts down the build process.</p>
<p>The error message is as below.</p>
<pre><code class="lang-auto">-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1 (found version "10.1")
-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe
-- Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1

CMake Error at cmake/public/cuda.cmake:42 (message):
PyTorch requires CUDA 10.2 or above.
Call Stack (most recent call first):
cmake/Dependencies.cmake:1191 (include)
CMakeLists.txt:653 (include)
</code></pre>
<p>Seriously?! Isn’t “PyTorch Build from Source” the whole purpose of building any PyTorch on any CUDA? I’ve heard many people successfully built PyTorch &gt;=1.10.0 on CUDA 10.1, but how did they make it?</p>
<p><strong>So, is there an argument or command prompt I can type in, to bypass this CUDA version compatibility check, so that a newer PyTorch can be built on an older CUDA without being interrupted?</strong></p>
<p>After all, “not being supported” doesn’t mean “guaranteed not working”, right?</p>
<p>What I want, is to build this file first, <em>&lt;torch-1.10.0+cu101-cp38-cp38-win_amd64.whl&gt;</em>, pip install it, then I can have a say if it’s working or not.</p>
<p>In my case, how to force PyTorch stop nagging and do her job?!</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="TechVillain" data-post="1" data-topic="184139">
<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/techvillain/48/62187_2.png" class="avatar"> TechVillain:</div>
<blockquote>
<p>Seriously?! Isn’t “PyTorch Build from Source” the whole purpose of building any PyTorch on any CUDA?</p>
</blockquote>
</aside>
<p>No, and it wouldn’t make sense trying to support CUDA 1.0-12.2 in PyTorch.<br>
You could check which 10.2-specific operators were added which require this minimal release from 2019. Also note that 10.2 supports the same GPU architectures as 10.1, so I’m unsure why you would need to use 10.1.</p>

username: TechVillain
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/1/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60" title="Screenshot_20230713_194846"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/1/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60_2_690x322.jpeg" alt="Screenshot_20230713_194846" data-base62-sha1="9nvMETDryDvEUSioAOqUJBPdSSc" width="690" height="322" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/1/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60_2_690x322.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/4/1/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60_2_1035x483.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/4/1/41bbfb5a71af20ab4b4427cf10b2da593ea1ae60_2_1380x644.jpeg 2x" data-dominant-color="CCFACC"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot_20230713_194846</span><span class="informations">2105×985 161 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>Don’t want to complain about Nvidia, but seriously? Nvidia never released any info on compatibilities between GPU models and graphic drivers.</p>
<p>Attached table from Wikipedia, shows CUDA 10.1 and 10.2 have same requirement for CC 3.0 GPU models.</p>
<p>However, on Nvidia download page, the file name is:<br>
cuda_10.2.89_441.22_windows.exe</p>
<p>Meaning: If you want to use CUDA 10.2, you are required to install attached graphic driver of 441.22.</p>
<p>How could I possibly know, this 441.22 driver is compatible with my GTX 660M GPU? Is it going to break my computer causing black screen of death?</p>
<p>Nvidia needs to be more transparent.</p>
<p>If CUDA is compatible with a GPU model, does it guarantee the driver comes with it, is also compatible with that GPU?</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="TechVillain" data-post="3" data-topic="184139">
<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/techvillain/48/62187_2.png" class="avatar"> TechVillain:</div>
<blockquote>
<p>Meaning: If you want to use CUDA 10.2, you are required to install attached graphic driver of 441.22.</p>
</blockquote>
</aside>
<p>This is also untrue and the NVIDIA driver compatibility is explained <a href="https://docs.nvidia.com/deploy/cuda-compatibility/index.html#minor-version-compatibility">here</a>:</p>
<blockquote>
<p>If you are using a new CUDA 10.x minor release, then the minimum required driver version is the same as the driver that’s packaged as part of that toolkit release.</p>
</blockquote>
<p>Note the <em>minimum</em> specification.</p>
<aside class="quote no-group" data-username="TechVillain" data-post="3" data-topic="184139">
<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/techvillain/48/62187_2.png" class="avatar"> TechVillain:</div>
<blockquote>
<p>Nvidia needs to be more transparent.</p>
</blockquote>
</aside>
<p>Refer to the linked docs and let me know what’s missing.</p>

username: TechVillain
cooked: <blockquote>
<p>Refer to the linked docs and let me know what’s missing.</p>
</blockquote>
<p>To be honest, I have read through that doc back and forth at least three times in the past, but still feels like rocket science to me.</p>
<p>My understandings are, in plain English:</p>
<ol>
<li>
<p>CUDA 11.x has forward compatibility, CUDA 10.x doesn’t.</p>
</li>
<li>
<p>Right now I’m on a lower version of Nvidia driver 426.00. CUDA 10.2 comes with a higher version driver of 441.22.<br>
Meaning, in order for me to use CUDA 10.2, I have to update my current driver to that 441.22, am I right?</p>
</li>
<li>
<p>How could I know if this 441.22 driver is compatible with my GPU? My biggest concern!</p>
</li>
</ol>
<p>Nvidia never said a thing about 10.x packed driver’s compatibility with a GPU.</p>
<p>Please elaborate.</p>

username: TechVillain
cooked: <p>After the discussion with Piotr <a class="mention" href="/u/ptrblck">@ptrblck</a> , I did some extensive testings over the weekend, and here is what I have found.</p>
<p><strong>PyTorch 1.8</strong> - Requires CUDA 10.1 or above - GPU CC &gt;=3.0<br>
<strong>PyTorch 1.9</strong> - Requires CUDA 10.1 or above - GPU CC &gt;=3.0</p>
<p><strong>PyTorch 1.10</strong> - Requires CUDA 10.2 or above - GPU CC &gt;=3.0<br>
<strong>PyTorch 1.11</strong> - Requires CUDA 10.2 or above - GPU CC &gt;=3.0<br>
<strong>PyTorch 1.12</strong> - Requires CUDA 10.2 or above - GPU CC &gt;=3.0<br>
<strong>PyTorch 1.13</strong> - Requires CUDA 10.2 or above - GPU CC &gt;=3.0</p>
<p><strong>PyTorch 2.0</strong> - Requires CUDA 11.0 or above - GPU CC &gt;=3.5</p>
<p>Also, no need to worry about the Nvidia driver compatibilities, as long as your GPU compute capability value meets the CUDA requirement, whatever version of Nvidia driver packed with the official CUDA toolkit will work on your GPU.</p>
<p>For any GPU in the Kepler sm_30 architecture category, the highest CUDA you can install is 10.2, and therefore the highest PyTorch you can build from source would be version 1.13.1.</p>

username: dorfix
cooked: <p>Not exactly.<br>
My graphical card is CC=3.0. The driver supplied with CUDA 10.1 supports the card.<br>
However driver that comes with CUDA 10.2 does not. Hence I can not use CUDA 10.2 with my card, even though the card is CC 3.0 compatible.</p>