DEV Community

sophytoeat
sophytoeat

Posted on

1

Resolving CUDA Version and GPU Architecture Issues in ContourCraft

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.

Environment

  • OS: Windows 11

  • GPU: RTX 4090

  • Platform: WSL2

Error 1: CUDA Version Mismatch

Error Message

      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)
Enter fullscreen mode Exit fullscreen mode

Root Cause

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.

Solution

  1. Install CUDA 11.7: I reinitialized my WSL2 environment and installed CUDA version 11.7. 2.** Verify CUDA Installation**:
  • Check the installed CUDA version:
nvcc --version
Enter fullscreen mode Exit fullscreen mode
  • Ensure it matches the required version (11.7). After completing these steps, the CUDA version mismatch error was resolved.

Error 2: Unsupported GPU Architecture

Error Message

      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)
Enter fullscreen mode Exit fullscreen mode

Root Cause

The RTX 4090 GPU supports the compute_89 architecture. However, CUDA version 11.7 does not recognize compute_89, leading to a fatal error during the build process.

Solution

To resolve this, I explicitly set the architecture to compute_86, which CUDA 11.7 supports:

Temporary Fix

  1. Set Environment Variables:Execute the following commands to set the appropriate CUDA architecture:
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
Enter fullscreen mode Exit fullscreen mode
  1. Validate the Fix:Run the build process again and confirm the error no longer occurs.

Permanent Fix

To make this change permanent, add the environment variables to your shell configuration file:

  1. Edit ~/.bashrc or ~/.zshrc:
echo 'export TORCH_CUDA_ARCH_LIST="8.6"' >> ~/.bashrc
echo 'export PATH=/usr/local/cuda-11.7/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
Enter fullscreen mode Exit fullscreen mode
  1. Reload the Configuration:
source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode
  1. Re-login: Log out and log back in to apply the changes globally.

After implementing this solution, I successfully installed the CCCollisions module without further issues.

👋 While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay