Failed to build the sample solution provided by CUDA 9.1 Sample

My environment hardware&software:

  • Windows 10 64bit
  • Geforce 820M (notebook)
  • Hello, I am new at CUDA. After I have the v391.35 display driver and CUDA 9.1 toolkit installed, I tried to build a sample MSVS 2017 solution but in vain.

    The unsuccessful one I have tried is located at “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\0_Simple\simpleZeroCopy\simpleZeroCopy_vs2017.sln”

    I got the following output:

    1>------ Build started: Project: simpleZeroCopy, Configuration: Debug x64 ------
    1>Compiling CUDA source file simpleZeroCopy.cu…
    1>
    1>C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\0_Simple\simpleZeroCopy>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin\nvcc.exe” -gencode=arch=compute_30,code="sm_30,compute_30" -gencode=arch=compute_35,code="sm_35,compute_35" -gencode=arch=compute_37,code="sm_37,compute_37" -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" --use-local-env --cl-version 2017 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64” -x cu -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1/include" -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler “/wd 4819” -g -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler “/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MTd " -o x64/Debug/simpleZeroCopy.cu.obj “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\0_Simple\simpleZeroCopy\simpleZeroCopy.cu”
    1>c:\program files\nvidia gpu computing toolkit\cuda\v9.1\include\crt/host_config.h(135): fatal error C1189: #error: – unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!
    1>simpleZeroCopy.cu
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 9.1.targets(707,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin\nvcc.exe” -gencode=arch=compute_30,code="sm_30,compute_30" -gencode=arch=compute_35,code="sm_35,compute_35" -gencode=arch=compute_37,code="sm_37,compute_37" -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" --use-local-env --cl-version 2017 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64” -x cu -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1/include” -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include” -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler “/wd 4819” -g -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler “/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MTd " -o x64/Debug/simpleZeroCopy.cu.obj “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\0_Simple\simpleZeroCopy\simpleZeroCopy.cu”” exited with code 2.
    1>Done building project “simpleZeroCopy_vs2017.vcxproj” – FAILED.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I will appreciate if you can help me. Please let me know if need further details about my situation. Thank you in advance.

    2 problems:

    You don’t actually indicate which version of VS you are using, but assuming you are using VS 2017, the VS2017 toolchain isn’t recognized by the CUDA 9.1 version you are using.

    More important: CUDA 9.1 does not support Fermi GPUs. Your 820M is a Fermi GPU. The last CUDA version supporting it is CUDA 8.0. You cannot use CUDA 9.1

    Switch to CUDA 8.0 and also use a version of VS that is supported/recognized by CUDA 8.0

    thank you, it really helps.

    so does cuda 8.0 toolkit support VS2017 for my mfc project constructed in it?

    if not, could you provide any kindly advice to help me with combining my mfc/c++ code within VS2017 with cuda? because i long to boost the efficiency of my code drawing support from cuda’s capability of accelerated computing, for example,parallel processing some ‘for iteration’ code blocks.

    i have originally thought of building some .dll file including some cuda accelerated code and they could be used/invoked by my main mfc vs2017 project. please throw me your suggestions, or let me know if further details required about my situation.

    I will appreciate your kindly advice/suggestions/efforts.

    The supported environments for any particular CUDA version are contained in the relevant installation guide:

    [url]https://docs.nvidia.com/cuda/archive/8.0/cuda-installation-guide-microsoft-windows/index.html[/url]

    VS2017 is not a supported environment for CUDA 8.0. VS2015 is supported.

    thank you, Robert. your comment exactly enlightened me.

    i have switched to cuda8.0 and had vs2015 installed.

    now they work properly.