I tried both 19.29.30154 and 19.33.31629
According to CUDA Installation Guide for Microsoft Windows
MSVC 193X and 192X are supported but I am getting “nvcc fatal : Host compiler targets unsupported OS.” error for both versions.
Below is the command I copied. I also tried compiling other things. Same results. Any help is appreciated.
I have looked at other threads but I would like to avoid installing Visual studio. I obtained MSVC in a portable form using PortableBuildTool.
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\nvcc.exe" -gencode=arch=compute_50,code=\"sm_50,compute_50\" -gencode=arch=compute_52,code=\"sm_52,compute_52\" -gencode=arch=compute_60,code=\"sm_60,compute_60\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" -gencode=arch=compute_75,code=\"sm_75,compute_75\" -gencode=arch=compute_80,code=\"sm_80,compute_80\" -gencode=arch=compute_86,code=\"sm_86,compute_86\" -gencode=arch=compute_89,code=\"sm_89,compute_89\" -gencode=arch=compute_90,code=\"sm_90,compute_90\" --use-local-env -ccbin "E:\Windows Kits\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64" -x cu -I./ -I../../../Common -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\/include" -I../../../Common -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler "/wd 4819" --threads 0 -g -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MTd " -Xcompiler "/Fdx64/Debug/vc143.pdb" -o E:\Source\cuda-samples\Samples\0_Introduction\vectorAdd\x64\Debug\vectorAdd.cu.obj "E:\Source\cuda-samples\Samples\0_Introduction\vectorAdd\vectorAdd.cu"
EDIT: This is the command generated tu build for x64 platform (in case you’re wondering about the -DWIN32 flag)
msbuild vectorAdd_vs2022.sln /property:Configuration=Release /property:Platform=x64
Also tried with 14.30.30705, no luck
EDIT2: I added a fake file VC\Auxiliary\Build\vcvarsall.bat
and it now works
Thanks to @youki