Visual Studio 2017 does not detect changes in .cu files (CUDA)

I have installed Visual Studio 2017 and Cuda Toolkit 9.1. It works, I confirmed this by creating several projects.

Now when I edit the .cu file and click build. It says that the project has already been updated. When using rebuild, you can create changes to the new binary.

+13
source share
4 answers

The work around is to force compilation instead of building using Build -> Compileor Ctrl+ F7.
This fixed the problem for me, but also note that I tried first Build -> Run Code Analysis on File(which also worked) before subsequently making the above workaround.

+4

NVidia, , Nsight Visual Studio. ( Nsight Visual Studio 6.0, CUDA 10.0.)

( ), .

0

VS 2017 Microsoft .

chrispy81 Nvidia.

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>
0

Good news! This issue has been resolved and is available using the CUDA 10.1 toolkit, released in February 2019. Https://developer.nvidia.com/cuda-toolkit

Sorry for the long wait.

0
source

Source: https://habr.com/ru/post/1691969/


All Articles