Simple CUDA Wizard for Visual Studio 2005

2.0 release version

[url=“http://forums.nvidia.com/index.php?showtopic=83054”]http://forums.nvidia.com/index.php?showtopic=83054[/url]

I’ve made a simple VS2005 Project Wizard for CUDA. After you install the CUDA VS2005 Wizard, you can see the CUDAWin32App in your Visual Studio installed templates Category. Then it’s easy to create a new CUDA project in VS2005.

This is first version only made in two days. So if there is any problem please let me know.

PS: Thanks JaredHoberock’s “Simple CUDA build rule for Visual Studio 2005”.

The new version:
Modify two bug:
1, Change the CUDA_LIB_PATH into CUDA_INC_PAHT;
2, Add debug info into EmuDebug;

MD5:9fc707a08946573de28b75aad2f075ca

And the new version 1.2. We can get it:
[url=“http://forums.nvidia.com/index.php?showtopic=69183”]http://forums.nvidia.com/index.php?showtopic=69183[/url]

VS2005 Express verson is done.
The x64 OS version is done.

[url=“The Official NVIDIA Forums | NVIDIA”]http://forums.nvidia.com/index.php?act=ST&...t=0#entry390252[/url]

Thanks! The generated “hello cuda!” compiles and runs well. I haven’t made any real tests yet.

Thanks Kaiyong, this is really helpful

hi, every body:) need more items into the wizard? if so, I will continue to do it.

I’ve just had a Windows reinstall and a clean install of VS2005 and CUDA toolkit. I’ve found a little inconvenience. By default, the sample code has:

#include <cuda_runtime.h>

The <…> mean the include file is searched within VS specified includes directory, which is not yet set for CUDA after a fresh install.

I usually add CUDA/include dir into VC++ directories anyway but to make this wizard foolproof you might want to add a rule to account for it (is possible) :)

Hello Big_Mac

I used the VS2005 Project Wizard to create a new project…
But my VS couldn’t fine the <cutil.h> & <cuda_runtime.h>…
How to include the directory to tell VS the correct path and get the *.h

I check “template” (SDK project) and "wizard project "…

the “template” vcproj file includes the “CUDA_INC_PATH”
but the "wizard project " doesn’t have it …

Is the main reason that my VS couldn’t find the <cutil.h> & <cuda_runtime.h>…?

thanks~~ ^_^

Thanks:)

But the error is not here. It’s me made a mistake in the Wizard set the -I with $(CUDA_LIB_PATH). It should be CUDA_INC_PATH. - -hehe I will update it in the next version.

BTW, the include <…> means search from the INCLUDE environment and the directories that specified by the /I compiler option.

http://msdn.microsoft.com/en-us/library/36k2cdd4(VS.80).aspx

And always we use <…> to distinguish “system environment & SDK” from our sources. :)

Change the CUDA_LIB_PATH to CUDA_INC_PATH in the wizard project :)

Hello~kyzhao

You mean I change in vcproj…
or in VS->projects->properties->Linker->General->
Additional Libraries Directories → $(CUDA_LIB_PATH);…/…/common/lib

Thanks~!! :)

VS->projects->properties->CUDA->General->Additional include Directories->$(CUDA_LIB_PATH) ---------->$(CUDA_INC_PATH)

:)

I’ve did that and now an error occurs during linking:

Linking...

LINK : fatal error LNK1104: cannot open file '.\Debug\CUDAWin32App1.obj'

Build log was saved at "file://d:\projekty_dev\test2\CUDAWin32App1\CUDAWin32App1\Debug\BuildLog.htm"

I’ve added the build log as an attachment.
BuildLog.htm (6.2 KB)

There is no Debug Category in your program category.

I still can’t get it to work.

I can compile and link in EmuDebug mode but when I try to debug it, VS says “Debugging information cannot be found or does not match. Binary was not built with debug information”. I fixed this by manually editing Properties->Linker->Debugging and setting Generate Debug Info to on, as per Debug configuration.

EmuRelease works fine.

Ordinary Debug does what I described earlier.

Release mode gives me:

LINK : fatal error LNK1181: cannot open input file '.\release\wizardtest.obj'

Build log was saved at "file://d:\NVIDIA CUDA SDK\projects\wizardTest\wizardTest\Release\BuildLog.htm"

wizardtest - 1 error(s), 0 warning(s)

(build log in attachment)

I compared build logs from the failed Release and Debug modes with the successfully linked Emu modes and found one difference:

One of the command lines looks like this in Release build log:

/OUT:"Release\wizardtest.exe"

And here’s the successfully linked EmuRelease

/OUT:"D:\NVIDIA CUDA SDK\projects\wizardtest\EmuRelease\wizardtest.exe"

I noticed EmuRelease version has a complete path and Release doesn’t. Can this be the case? If so, how to fix it?

Edit: I changed it so that all configurations use complete paths and it didn’t help.

Here’s the successful build log

I guess the error is not the set of OUT path. Because the path is created by the VS, in “$(OutDir)$(ProjectName).exe”

Can you find the wizardtest.obj in the Release Category?
If can’t the error is about the linker.
If so, the error is the obj compiler.

If there is also error, can you send me the project?

Hi kyzhao,

thanks for your great wizard.
I tried to add additional header files to the helloCuda project (my name of the project is CUDAOraTest). I set an additional full include path to the folder containing the additional header file, but I only get the project running, if I place the header file in the same directory as the .cu file.

nvcc compiler options:
nvcc.exe -ccbin “C:\Programme\Microsoft Visual Studio 8\VC\bin” -c -DWIN32 -D_DEBUG -D_CONSOLE -Xcompiler "/EHsc /W3 /nologo /Wp64 /Od /Zi /RTC1 /MD " -IC:\Programme\NVIDIA\CUDAToolKit\lib -IC:\Oracle\product\11.1.0\db_1\OCI\include -IC:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest\inc -o Debug\CUDAOraTest.obj CUDAOraTest.vcproj

If the headerfile is in the directory “C:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest” everything is working fine. If i move the headerfile to “C:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest\inc” the compiler doesn’t find the header file.
I tried to include the headerfile with <headerfile.h> and “headerfile.h”, both not working.

What am I doing wrong?
Can you help me? I’d like to get more structure to my project with “inc” and “src” folder.

Thanks
Paddy

I guess you add the headerfile by the VS2005 directly. And then move the headerfile into inc directory?

If so, first you should delete it from the project, second move the file into inc directory, and then add the file into the project.

When you use the headerfile, it doesn’t need to add the “-IC:\Paddy\Programmierung\CUDAOracle\CUDAOraTest\CUDAOraTest\inc”, if you create the headerfile yourself.

And you can use it in your source file like this: include “./inc/headerfile.h”, that the source file is in the CUDAOraTest category, and the headerfile is in the CUDAOraTest\inc category.

:)

When I use include “./inc/headerfile.h” it’s working. But now the compiler doesn’t find cuda_runtime.h, although I changed $(CUDA_LIB_PATH) to $(CUDA_INC_PATH) in VS->projects->properties->CUDA->General->Additional include Directories.

There’s no wizardtest.obj in Release folder. There are wizardtest.obj files in EmuRelease and EmuDebug folders.

I’ve attached the zipped project folder

Can you show me the nvcc compiler options?