Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Customization for CUDA 5.0 not found in Visual C++

I am trying my hand at CUDA gpu programming for the first time and have come across a problem when setting the build customization. I'm not sure if I'm just doing something wrong or not. Basically, when I set the projects build customization to CUDA 5.0, it doesn't work. I try to make a .cu (and even .cpp) file and I get an error stating:

The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomization\CUDA 5.0.props"was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. c:\Users\"USER NAME"\documents\visual studio 2010\Projects\"PROJECT NAME"\"PROJECT NAME".vcxproj

Afterwards the project property page becomes empty with only a Frameworks and References page which is empty. Turning off the CUDA declaration does nothing.

I have tried uninstalling the CUDA toolkit and reinstalling it but to no avail.

I'm pretty new at this, but any help would be appreciated!

like image 556
Alex Avatar asked Mar 18 '13 16:03

Alex


3 Answers

In order to use CUDA build customization, some files should be copied to Visual Studio folders, in your case CUDA 5.0.props is missing from

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomization\

In order to fix this, search for CUDA 5.0.props in your C: drive and copy it to the above path.

like image 121
Soroosh Bateni Avatar answered Oct 19 '22 01:10

Soroosh Bateni


This happened to me just now and the solution I did was re-run the CUDA installer and make sure to select Visual Studio integration.

like image 29
Sergio Martins Avatar answered Oct 19 '22 01:10

Sergio Martins


This can also happen if you don't have CUDA installed on the machine. This could be quite common for instance you might be using your laptop to develop the project and it has no CUDA card. Anyway to fix this you need to edit the Visual Studio project file .vcxproj (anyone from NVIDIA listening?)

change

<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props" />**

to

<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props" Condition="exists('$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props')" />

and then

<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" />

to

<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" Condition="exists('$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets')" />

Then right click on the project icon in visual studio and select the reload option, the project should reload, even if you haven't got CUDA installed on that particular machine.

You might have to do some further steps, eg. use #ifdef to exclude these include files and other cuda code sections.

like image 27
ejectamenta Avatar answered Oct 19 '22 02:10

ejectamenta