Could someone please tell me how to compile from the command line with icc and clang?

Hi,

In cuda 10.1 icc 19 is supported but gives “nvcc fatal host compiler targets unsupported os”

In cuda 10.2 clang 8 is supported but gives “nvcc fatal host compiler targets unsupported os” if used with ncc, e.g. -ccbin=“C:\Program Files\LLVM\bin\clang++.exe”

or

gives “cannot find libdevice for sm_61” when used with clang++, e.g. clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_61 -L"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/lib/" --cuda-path=“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/” -lcudart_static -ldl -lrt -pthread

Could someone please tell me how to use both compilers with a bat file in windows?

none of those compilers are supported on windows

https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#system-requirements

The only supported host compiler on windows is cl.exe, the C++ compiler that ships with Visual Studio.

Thanks, I must have misunderstood the installation guide.

While unsupported, CUDA works with the Intel compiler on Windows on the simple programs I have tried. I do get some (harmless) warnings, though. This is with CUDA 8, maybe subsequent CUDA versions tightened the host compiler checks in nvcc. Here is a sample compilation (icl is in my PATH):

nvcc -ccbin icl.exe -o zcopy.exe zcopy.cu

Note that “unsupported” means NVIDIA has not tested this configuration, there may be both subtle and obvious problems, the resulting executable may not work correctly even though the compilation was successful, and NVIDIA (including these forums) will not assist if you run into any issues. If you are willing and able to proceed at your own risk, give it a try.

Thanks, it used to work in a previous version, but I do not know which one.

No idea how comprehensive the nvcc checks for host compiler are, but it may be worthwhile to see whether renaming the compiler executable allows one to bypass the check.

I am using icl.exe with this three year old version of nvcc:

nvcc --version
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2016 NVIDIA Corporation
Built on Mon_Jan__9_17:32:33_CST_2017
Cuda compilation tools, release 8.0, V8.0.60