-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All Cuda samples vcxproj have the same ProjectGuid causing bad performance in VS IDE #200
Comments
@olgaark I wrote a scratch python script to just re-Id these files. Do run it and see if it helps at all? [Update 1]: I just updated the script to take projectIds from top level SLN files and just apply them. import glob
import os
GLOBAL_ID_DUP = '{997E0757-EA74-4A4E-A0FC-47D8C8831A15}'
def inPlaceReplace(fileName, oldString, newString):
if oldString == newString:
return
contents = None
with open(fileName) as fileRead:
contents = fileRead.read()
if oldString not in contents:
return
with open(fileName, 'w') as fileWrite:
newContents = contents.replace(oldString, newString)
fileWrite.write(newContents)
def reIdConsistentVcx(vcxFileName, newProjectId):
vcxFileNameNormalized = vcxFileName.replace('\\', os.path.sep)
inPlaceReplace(vcxFileNameNormalized, GLOBAL_ID_DUP, f"{{{newProjectId}}}")
slnFileName = vcxFileNameNormalized.replace('vcxproj', 'sln')
slnFileNameNormalized = slnFileName.replace('\\', os.path.sep)
inPlaceReplace(slnFileNameNormalized, GLOBAL_ID_DUP, f"{{{newProjectId}}}")
def getVcxIdsInSln(slnFileName):
projectIds = {}
slnFileNameNormalized = slnFileName.replace('\\', os.path.sep)
with open(slnFileNameNormalized) as slnFileRead:
lines = slnFileRead.readlines()
for line in lines:
if not line or not line.startswith('Project("') or not "vcxproj" in line:
pass
else:
lineParts = line.split('"')
projectIdSln, projectName, vcxFileName, projectId = lineParts[1].lstrip('{').rstrip('}'), lineParts[3], lineParts[5], lineParts[7].lstrip('{').rstrip('}')
projectIds[vcxFileName] = projectId
return projectIds
def main():
for slnFileName in glob.glob('CUDA-Samples/*.sln'):
projectIds = getVcxIdsInSln(slnFileName)
for vcxFileName in projectIds:
projectId = projectIds[vcxFileName]
print("File: ", vcxFileName, projectId)
reIdConsistentVcx('CUDA-Samples\\'+vcxFileName, projectId)
if __name__ == '__main__':
main() On Windows, I put this outside the What seems to have happened is that all individual vcx/sln files have taken the same UUID as |
If it does solve the IDE issue, do comment, let's ask @rnertney to merge the new vcxproj/sln files in. |
I used the |
First, I do: mkdir Workplace
cd Workplace
git clone https://github.com/NVIDIA/cuda-samples CUDA-Samples So you have Then download and run python ReId.py will yield something like:
Then check the Git: cd CUDA-Samples
git status will look like:
and git diff should yield: diff --git a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.sln b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.sln
index 0b057ab7..aa610ef9 100644
--- a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.sln
+++ b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2017
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnifiedMemoryStreams", "UnifiedMemoryStreams_vs2017.vcxproj", "{997E0757-EA74-4A4E-A0FC-47D8C8831A15}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnifiedMemoryStreams", "UnifiedMemoryStreams_vs2017.vcxproj", "{A040BDA9-EA44-4095-B492-53F94B8778D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.ActiveCfg = Debug|x64
- {997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Debug|x64.Build.0 = Debug|x64
- {997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.ActiveCfg = Release|x64
- {997E0757-EA74-4A4E-A0FC-47D8C8831A15}.Release|x64.Build.0 = Release|x64
+ {A040BDA9-EA44-4095-B492-53F94B8778D6}.Debug|x64.ActiveCfg = Debug|x64
+ {A040BDA9-EA44-4095-B492-53F94B8778D6}.Debug|x64.Build.0 = Debug|x64
+ {A040BDA9-EA44-4095-B492-53F94B8778D6}.Release|x64.ActiveCfg = Release|x64
+ {A040BDA9-EA44-4095-B492-53F94B8778D6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.vcxproj b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.vcxproj
index 6e5348cc..d6c40a86 100644
--- a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.vcxproj
+++ b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.vcxproj
@@ -14,7 +14,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
+ <ProjectGuid>{A040BDA9-EA44-4095-B492-53F94B8778D6}</ProjectGuid>
<RootNamespace>UnifiedMemoryStreams_vs2017</RootNamespace>
<ProjectName>UnifiedMemoryStreams</ProjectName>
<CudaToolkitCustomDir />
diff --git a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2019.sln b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2019.sln
index 4dd4e5ff..d6ab6c91 100644
--- a/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2019.sln
+++ b/Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2019.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2019
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnifiedMemoryStreams", "UnifiedMemoryStreams_vs2019.vcxproj", "{997E0757-EA74-4A4E-A0FC-47D8C8831A15}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnifiedMemoryStreams", "UnifiedMemoryStreams_vs2019.vcxproj", "{0251F5FC-1C92-44FD-AD51-23EAAAF1F7A2}"
... That script used to work only on Windows boxes ... because it's a Visual Studio problem. I have updated the snippet above so it works on Unix/Linux machines as well. Not sure why you'd need that though. Hope this helps you. 🙏 |
The issue was reported to Visual Studio
https://developercommunity.visualstudio.com/t/First-opening-of-CUDA-samples-project-ta/10346825
The problem is caused by all vcxproj files having the same
<ProjectGuid>{997E0757-EA74-4A4E-A0FC-47D8C8831A15}</ProjectGuid>
which is used is project ID and supposed to be unique. Please fix your projects.
The text was updated successfully, but these errors were encountered: