简体   繁体   English

Visual Studio 2017未检测到.cu(CUDA)文件中的更改

[英]Visual Studio 2017 not detecting change in .cu (CUDA) files

I have Visual Studio 2017 and Cuda Toolkit 9.1 installed. 我安装了Visual Studio 2017和Cuda Toolkit 9.1。 It is working, I confirmed it by building a few projects. 它正在运作,我通过建立一些项目来证实它。

Now when I edit a .cu file and press build. 现在,当我编辑.cu文件并按下构建时。 It says that the project is already up to date. 它说该项目已经是最新的。 It is only possible to build the changes into the new binary, when using rebuild. 在使用rebuild时,只能将更改构建到新的二进制文件中。

A work around is to force a Compile instead of a build using Build -> Compile or Ctrl + F7 instead. 解决方法是使用Build -> CompileCtrl + F7强制编译而不是Build -> Compile
This fixed the issue for me, but also please note I initially tried Build -> Run Code Analysis on File (which also worked) before subsequently adopting the aforementioned workaround. 这为我解决了这个问题,但请注意我最初在采用上述解决方法之前尝试了Build -> Run Code Analysis on File (也有效)。

After filing a bug report at NVidia, they resolved the ticket in the next working day, promising to deliver the fix with the next release of Nsight Visual Studio. 在NVidia提交错误报告后,他们在下一个工作日解决了这个问题,并承诺在下一个版本的Nsight Visual Studio中提供修复程序。 (I'm currenty using Nsight Visual Studio 6.0 which came with CUDA 10.0.) (我现在正在使用CUDA 10.0附带的Nsight Visual Studio 6.0。)

I'm looking forward to try out the new release (whenever it comes out) and I'm pleasantly surprized by the speed of their response. 我期待尝试新版本(无论什么时候出来),我很高兴他们的反应速度。

Microsoft modified the way in VS 2017, how source code changes are detected. Microsoft在VS 2017中修改了方式,检测源代码更改的方式。

A solution is written from chrispy81 on the Nvidia Developer Forum . 解决方案是在Nvidia开发者论坛上的chrispy81上编写的。

In the CUDA 10.0.targets files:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.0.targets" 
"C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 10.0.targets" 
"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\visual_studio_integration\MSBuildExtensions\CUDA 10.0.targets" 

under this tag:

<WriteLinesToFile
    Condition="'%(CudaCompile.ExcludedFromBuild)' != 'true'"
    File="%(CudaCompile.DepsOutputPath)"
    Lines="@(_CudaCompileDeps)"
    Overwrite="true" />

write this:

<PropertyGroup>
    <CudaCompileItemFullPath>%(CudaCompile.FullPath)</CudaCompileItemFullPath>
</PropertyGroup>

<GetOutOfDateItems
    Condition ="'$(SelectedFiles)' == ''"
    Sources ="%(CudaCompile.FullPath);
    @(_CudaCompileDeps)"
    OutputsMetadataName ="Outputs"
    DependenciesMetadataName ="AdditionalInputs"
    CommandMetadataName ="Command"
    TLogDirectory ="$(TLogLocation)"
    TLogNamePrefix ="%(CudaCompile.Filename)%(CudaCompile.Extension)$(CudaCompileItemFullPath.GetHashCode())">
    <Output TaskParameter="OutOfDateSources" ItemName="CudaBuildCoreOutOfDateItems"/>
</GetOutOfDateItems>

Good News! 好消息! This problem has been addressed and is available with the CUDA 10.1 Toolkit, released in February 2019. https://developer.nvidia.com/cuda-toolkit 此问题已得到解决,可在2019年2月发布的CUDA 10.1工具包中使用.https://developer.nvidia.com/cuda-toolkit

Sorry for the long wait. 抱歉漫长的等待。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM