Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
801 views
in Technique[技术] by (71.8m points)

parallel processing - Using CUDA with Visual Studio 2017

I'm trying to install CUDA, but I get a message saying "No supported version of visual studio was found". I think that this is because I am using Visual Studio 2017 (Community), and CUDA currently only supports up to Visual Studio 2015. Unfortunately, Microsoft will not allow me to download old versions of Visual Studio without paying a subscription fee.

Is there a way I can get around the compatibility issue with VS 2017, or can I not use CUDA?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. If you want to install CUDA 8.0 with Visual Studio 2017 you need to install additional components for Visual Studio 2017.

    Click on the Start Menu and type Visual Studio Installer. Open Visual Studio Installer

    Open Individual components tab and select VC++ 2015.3 v140 toolset
    under Compilers, build tools and runtimes.

install additional components for Visual Studio 2017

  1. You also need to install .NET Framework 3.5 if you didn't have it installed.
    Nvda.Build.CudaTasks.v8.0.dll assembly dependents on MS .NET Framework 3.5.

Open Classical Control Panel, go to Programs and features
and press Turn Windows features on or off. Check .NET Framework 3.5 and press OK.

enter image description here

  1. Download full CUDA toolkit distribution and extract it somewhere on your disk.
  2. If you didn't have CUDA toolkit installed, do it now. If you have only Visual Studio 2017 installed, unselect Visual Studio integration checkbox.


Now you want to receive the "No supported version of the visual studio was found" error.

But in order to successfully build Cuda toolkit projects in Visual Studio 2017, you also need to follow steps 5 and 6.

  1. Go to the CUDAVisualStudioIntegrationextrasvisual_studio_integrationMSBuildExtensions
    folder in your extracted distribution, copy all the files and paste them to
    C:Program Files (x86)MSBuildMicrosoft.Cppv4.0v140BuildCustomizations:

msbuild

  1. In the last step, you will need to edit your Cuda projects to recognize NVidia's build tasks from Visual Studio 2017. Open your .vcxproj file in a text editor and find all occurrences of CUDA 8.0.props. Replace the macro at the beginning of the string with $(VCTargetsPath14) so that XML snippet would look as follows:

<ImportGroup Label="ExtensionSettings"> <Import Project="$(VCTargetsPath14)BuildCustomizationsCUDA 8.0.props" /></ImportGroup>

Don't forget to edit the custom targets path at the end of the file:

<ImportGroup Label="ExtensionTargets"> <Import Project="$(VCTargetsPath14)BuildCustomizationsCUDA 8.0.targets" /></ImportGroup>



Make sure to double check your path conifuration!
If you use nvcc from command prompt you might not be calling cl.exe from Visual Studio folder!

another cl.exe might be in path

Now you can build your Cuda project from Visual Studio 2017.

Parts of this solution are from Oleg Tarasov blog.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...