I have Visual Studio 2017 and Cuda Toolkit 9.1 installed. It is working, I confirmed it by building a few projects.
Now when I edit a .cu file and press build. 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.
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. (I'm currenty using Nsight Visual Studio 6.0 which came with CUDA 10.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.
A solution is written from chrispy81 on the Nvidia Developer Forum.
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>
A work around is to force a Compile instead of a build using Build -> Compile
or Ctrl+F7 instead.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With