3

I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error:

clang++.exe: error: Unsupported CUDA gpu architecture: compute_52

This makes no sense to me because I have the CUDA toolkit version 7.5 and my graphics card is a GTX 970 (two of them). I have googled this extensively and everywhere I come across the error the person always has is their CUDA toolkit is < 7.5. I'm on the brink of tears right now trying to get something as simple as VLA to work on this CUDA application and I just can't achieve it...

talonmies
  • 70,661
  • 34
  • 192
  • 269
user3441843
  • 137
  • 1
  • 7
  • You may want to show your original problem, something that you need but VS does not seem to support. It would be better to solve it with official toolkit - CUDA with VS compiler. – kangshiyin Jul 18 '16 at 08:56
  • Variable-Length Arrays are not C++ anyway. And I understand why they wouldn't work on CUDA; they're essentially a wrapper around `alloca` and I don't think CUDA supports that either, – MSalters Jul 18 '16 at 09:01
  • 2
    The only supported host compiler for `nvcc` on the windows platform is the visual studio compiler. This is covered in [the documentation](http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#system-requirements). See table 2, "windows compiler support". clang, icc, mingw, or any other CPU compiler are **unsupported** for use as the host compiler in CUDA `nvcc` on the windows platform, and generally speaking, `nvcc` will check for microsoft cl.exe and refuse to operate if it is not being used. This is expected behavior. – Robert Crovella Jul 18 '16 at 09:59

3 Answers3

11

The CUDA windows toolchain requires the Visual Studio C++ compiler. You cannot use anything else on that platform. If the VS compiler doesn't support the language features you need within CUDA host code, you have no choice but to change platforms, or your expectations.

You can still potentially compile non-CUDA host code using another compiler and then link that code using NVCC and the VS toolchain.

talonmies
  • 70,661
  • 34
  • 192
  • 269
0

Try to use clang-cl, --cubin=clang-cl.exe

Amos Egel
  • 937
  • 10
  • 24
-1

It may be worth to work on a Linux VM or WSL2 within windows. As per the CUDA docs.

To compile new CUDA applications, a CUDA Toolkit for Linux x86 is needed. CUDA Toolkit support for WSL is still in preview stage as developer tools such as profilers are not available yet. However, CUDA application development is fully supported in the WSL2 environment, as a result, users should be able to compile new CUDA Linux applications with the latest CUDA Toolkit for x86 Linux.

https://docs.nvidia.com/cuda/wsl-user-guide/index.html#:~:text=However%2C%20CUDA%20application%20development%20is,becomes%20available%20within%20WSL%202.

John Curry
  • 392
  • 3
  • 12