如何用vs2017打开cuda8工程

  1. If you want to install CUDA 8.0 with Visual Studio 2017 you need to install additional components for Visual Studio 2017.

    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 receive the "No supported version of 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 CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions
    folder in your extracted distribution, copy all the files and paste them to
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations:

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)\BuildCustomizations\CUDA 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)\BuildCustomizations\CUDA 8.0.targets" />

</ImportGroup>

  1. If you want to install CUDA 8.0 with Visual Studio 2017 you need to install additional components for Visual Studio 2017.

    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 receive the "No supported version of 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 CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions
    folder in your extracted distribution, copy all the files and paste them to
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations:

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)\BuildCustomizations\CUDA 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)\BuildCustomizations\CUDA 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.


  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值