Build error in PyTorch Vision

khushi-411: <p>Hi,<br>
I’m excited to contribute to PyTorch Vision. Hence, I want to build PyTorch Vision in the local system.<br>
I followed the CONTRIBUTION.md guide. But I’m getting the following error.</p>
<pre><code class="lang-auto">/home/khushi/anaconda3/lib/python3.8/site-packages/torch/include/c10/core/TensorImpl.h(2615): error: static assertion failed with "You changed the size of TensorImpl on 64-bit arch.See Note [TensorImpl size constraints] on how to proceed."

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(231): warning: variable "device_guard" was declared but never referenced

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(414): warning: variable "device_guard" was declared but never referenced

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(658): warning: variable "device_guard" was declared but never referenced

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(763): warning: variable "guard" was declared but never referenced

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(925): warning: variable "guard" was declared but never referenced

/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu(1057): warning: variable "guard" was declared but never referenced

1 error detected in the compilation of "/home/khushi/Documents/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu".
error: command '/opt/cuda/bin/nvcc' failed with exit status 1
</code></pre>
<p>Will anyone please help me out to resolve the error?</p>
<p>Dependencies:</p>
<ol>
<li>Cuda version: 11.4</li>
<li>GCC version: 11.1.0</li>
</ol>
<p>Thanks</p>

ptrblck: <p>Are you trying to build directly from the master branch or is this already the branch with your changes?<br>
In the latter case, check your <code>git diff</code> as you seem to have changed the size of <code>TensorImpl</code>:</p>
<pre><code class="lang-python">/home/khushi/anaconda3/lib/python3.8/site-packages/torch/include/c10/core/TensorImpl.h(2615): error: static assertion failed with "You changed the size of TensorImpl on 64-bit arch.See Note [TensorImpl size constraints] on how to proceed."
</code></pre>
<p>in the former case, which commits are you using?</p>

khushi-411: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>!<br>
Thanks for taking a look.</p>
<p>I tried both ways; via main and via the branch I created. Got the same error <img src="https://discuss.pytorch.org/images/emoji/apple/slightly_frowning_face.png?v=10" title=":slightly_frowning_face:" class="emoji" alt=":slightly_frowning_face:"> I haven’t committed anything yet. Started with setting up the environment.</p>
<p>Answers to the questions you asked:</p>
<ol>
<li>The <code>git diff</code> command doesn’t output anything.</li>
<li>By commit, I’m assuming you are referring to the commands used for building. They are:</li>
</ol>
<pre><code class="lang-auto">conda activate
conda install pytorch -c pytorch-nightly
git clone https://github.com/khushi-411/vision.git
cd vision
python setup.py develop
</code></pre>
<p>What do you think, what’s happening?</p>

my3bikaht: <aside class="quote no-group" data-username="khushi-411" data-post="1" data-topic="135379">
<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/khushi-411/48/51391_2.png" class="avatar"> khushi-411:</div>
<blockquote>
<ul>
<li>Cuda version: 11.4</li>
<li>GCC version: 11.1.0</li>
</ul>
</blockquote>
</aside>
<p>Please check if CUDA 11.4 supports gcc 11, probably not</p>

khushi-411: <p>Hi <a class="mention" href="/u/my3bikaht">@my3bikaht</a>!<br>
Thanks for looking into it.</p>
<p>I did check the official page and some of the <code>gist</code>.  According to those references <code>CUDA 11.4</code> supports <code>GCC 11</code>.<br>
A few notable links, worthing to mentions are:</p>
<ol>
<li><a href="https://gist.github.com/ax3l/9489132" rel="noopener nofollow ugc">https://gist.github.com/ax3l/9489132</a></li>
<li><a href="https://gist.github.com/ax3l/9489132#gistcomment-3866703" rel="noopener nofollow ugc">https://gist.github.com/ax3l/9489132#gistcomment-3866703</a></li>
<li><a href="https://docs.nvidia.com/cuda/archive/11.4.0/" rel="noopener nofollow ugc">https://docs.nvidia.com/cuda/archive/11.4.0/</a></li>
</ol>
<p>Would love to get your inputs! Thanks</p>

ptrblck: <aside class="quote no-group" data-username="my3bikaht" data-post="4" data-topic="135379">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/m/50afbb/48.png" class="avatar"> my3bikaht:</div>
<blockquote>
<p>Please check if CUDA 11.4 supports gcc 11, probably not</p>
</blockquote>
</aside>
<p>That’s a great suggestion, as I haven’t noticed the GCC version.</p>
<p><a class="mention" href="/u/khushi-411">@khushi-411</a> At least GCC 11.1 has a known bug in CUDA 11.4 (which is already fixed in CUDA 11.5), so you would either need to downgrade GCC or update CUDA.</p>

khushi-411: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>, Hi <a class="mention" href="/u/my3bikaht">@my3bikaht</a>!<br>
Thanks for the suggestions!</p>
<p>I did work to set it up in both ways; via CUDA 11.5 and CUDA 10. and by degrading the <code>gcc</code> version to <code>gcc-10</code>.<br>
<strong>Major Problems I am facing:</strong></p>
<ul>
<li>
<code>archlinux</code> package does not have any upstream link for CUDA 11.5 (I stumbled from my side, I might be wrong).</li>
<li>I then turned to CUDA 10. using <code>sudo pacman -S cuda-10.0</code> (Failed, since the target was not available) I found another command <code>yay -S cuda-10.1</code> to install CUDA 10.0 in <code>archlinux</code>. This took more than 6 hrs to build.</li>
<li>Then I planned to degrade the <code>gcc</code> version. (Though, I personally, wanted to complete using CUDA). I tried many things. But currently, I am getting the following error:</li>
</ul>
<pre><code class="lang-auto">/usr/bin/ld: eg: _ZSt3cin: invalid version 2 (max 0)
/usr/bin/ld: eg: error adding symbols: bad value
collect2: error: ld returned 1 exit status
</code></pre>
<p>SYSTEM CONFIGURATION</p>
<ul>
<li>Manjaro Linx 21.0.0</li>
</ul>
<p>Will you please give me some hints to resolve the error?<br>
Thanks!</p>

khushi-411: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>, Hi <a class="mention" href="/u/my3bikaht">@my3bikaht</a>!</p>
<p>A gentle ping to you! Will you please look into the problem?<br>
Thanks!</p>

my3bikaht: <p>Sorry, not using arch linux. Browsed just now, archlinux has cuda 11.5.0-1 in packages.<br>
Also I think you can install cudatoolkit, which has cuda as dependency. Either directly, or using conda.<br>
6 hours for yay is crazy, seems like you were installing from source,</p>
<p>You can also download cuda specific version from here: <a href="http://archlinux.arkena.net/archive/packages/c/cuda/" class="inline-onebox" rel="noopener nofollow ugc">Index of /archive/packages/c/cuda/</a> or here: <a href="https://archive.archlinux.org/packages/c/cuda/" class="inline-onebox" rel="noopener nofollow ugc">Index of /packages/c/cuda/</a> and install using 'sudo pacman -U <em>filename</em> ’</p>
<p>Error you mentioned is a generic compiler error, we won’t be able to find the reason this way.</p>

khushi-411: <p>No problem, <a class="mention" href="/u/my3bikaht">@my3bikaht</a>.<br>
I’ll try to resolve the error with other methods too. Thanks!</p>