<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sophytoeat</title>
    <description>The latest articles on DEV Community by sophytoeat (@sophytoeat).</description>
    <link>https://dev.to/sophytoeat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2127426%2Fa1006996-17a0-4a47-95fa-9a9cc3604601.jpeg</url>
      <title>DEV Community: sophytoeat</title>
      <link>https://dev.to/sophytoeat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sophytoeat"/>
    <language>en</language>
    <item>
      <title>Resolving CUDA Version and GPU Architecture Issues in ContourCraft</title>
      <dc:creator>sophytoeat</dc:creator>
      <pubDate>Sat, 14 Dec 2024 13:05:53 +0000</pubDate>
      <link>https://dev.to/sophytoeat/resolving-cuda-version-and-gpu-architecture-issues-in-contourcraft-22np</link>
      <guid>https://dev.to/sophytoeat/resolving-cuda-version-and-gpu-architecture-issues-in-contourcraft-22np</guid>
      <description>&lt;p&gt;When implementing ContourCraft on a system using Windows 11, RTX 4090, and WSL2, I encountered multiple issues related to CUDA compatibility. Below, I outline the errors, troubleshooting steps, and solutions that led to a successful installation of the CCCollisions module, which handles static and dynamic collision handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OS:&lt;/strong&gt; Windows 11&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GPU:&lt;/strong&gt; RTX 4090&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; WSL2&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Error 1: CUDA Version Mismatch
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Error Message
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      RuntimeError:
      The detected CUDA version (12.6) mismatches the version that was used to compile
      PyTorch (11.8). Please make sure to use the same CUDA versions.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cccollisions
  Running setup.py clean for cccollisions
Failed to build cccollisions
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cccollisions)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Root Cause
&lt;/h3&gt;

&lt;p&gt;The CCCollisions module requires PyTorch, which was compiled with CUDA version 11.7. However, my environment had CUDA version 12.6 installed, causing a mismatch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install CUDA 11.7&lt;/strong&gt;: I reinitialized my WSL2 environment and installed CUDA version 11.7.
2.** Verify CUDA Installation**:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Check the installed CUDA version:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvcc --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Ensure it matches the required version (11.7).
After completing these steps, the CUDA version mismatch error was resolved.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Error 2: Unsupported GPU Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Error Message
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      nvcc warning : incompatible redefinition for option 'compiler-bindir', the last value of this option was used
      nvcc fatal   : Unsupported gpu architecture 'compute_89'
      error: command '/usr/local/cuda-11.7/bin/nvcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cccollisions
  Running setup.py clean for cccollisions
Failed to build cccollisions
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cccollisions)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Root Cause
&lt;/h3&gt;

&lt;p&gt;The RTX 4090 GPU supports the &lt;code&gt;compute_89&lt;/code&gt; architecture. However, CUDA version 11.7 does not recognize &lt;code&gt;compute_89&lt;/code&gt;, leading to a fatal error during the build process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;To resolve this, I explicitly set the architecture to &lt;code&gt;compute_86&lt;/code&gt;, which CUDA 11.7 supports:&lt;/p&gt;

&lt;h4&gt;
  
  
  Temporary Fix
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set Environment Variables&lt;/strong&gt;:Execute the following commands to set the appropriate CUDA architecture:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export TORCH_CUDA_ARCH_LIST="8.6"
export PATH=/usr/local/cuda-11.7/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Validate the Fix&lt;/strong&gt;:Run the build process again and confirm the error no longer occurs.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Permanent Fix
&lt;/h4&gt;

&lt;p&gt;To make this change permanent, add the environment variables to your shell configuration file:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Edit&lt;/strong&gt; ~/.bashrc &lt;strong&gt;or&lt;/strong&gt; ~/.zshrc:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'export TORCH_CUDA_ARCH_LIST="8.6"' &amp;gt;&amp;gt; ~/.bashrc
echo 'export PATH=/usr/local/cuda-11.7/bin:$PATH' &amp;gt;&amp;gt; ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH' &amp;gt;&amp;gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reload the Configuration&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Re-login&lt;/strong&gt;: Log out and log back in to apply the changes globally.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After implementing this solution, I successfully installed the CCCollisions module without further issues.&lt;/p&gt;

</description>
      <category>simulation</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
