user3441843
user3441843

Reputation: 177

How do I use other c++ compilers with CUDA on Windows?

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...

Upvotes: 5

Views: 5185

Answers (3)

John Curry
John Curry

Reputation: 491

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.

Upvotes: -2

zhanghaolong
zhanghaolong

Reputation: 1

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

Upvotes: 0

talonmies
talonmies

Reputation: 72349

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.

Upvotes: 12

Related Questions