Compiling SDK samples with Windows 7 64 bit

Hi all,

It’s been a while since I worked with CUDA, but I expected it would be easy to pick it back up; apparently I was wrong.

I previously used MSVS 2008 on a Vista 32 bit machine. As such, after installing the driver, SDK, etc., I could not only run the already compiled executables provided in the SDK, but I could immediately compile the source code in MSVS 2008. Simple.

Now fast forward two years. Just reloaded the machine with Windows 7 Professional 64 bit and MSVS 2008. Of course, the preloaded executables run fine. But when I compile the source files, say bandwidth.cu, as an example, I get an error.

I assume, and perhaps incorrectly so, that the SDK installation, knowing which version of Windows you are running (32 bit vs 64 bit) would install ready-to-go source files accordingly. Meaning, if one has a 64 bit system, there would be a separate set of source files, with the VS solution configuration setup accordingly to compile on 64 bit machines.

(1) So my first question: Is that assumption wrong?

I ask, because when I compile, I get 1 Link error: cutil32d.lib not found or something like that. After searching online, I see this file is expected on 32 bit systems, but on my system, instead, I have cutil64d.lib.

And mind you, I am a a complete NEWBIE with MSVS and am not the most technically oriented (by far). However, I don’t like posting before reading, so I searched the forum for this cutil32d.lib and saw several people offering “solutions”, most of which were over my head. However, what I got from them was to check in the configuration options of the solution file and check “certain things”, again stuff, at this point, beyond me. However, I noticed that all the SDK source files were configured with cutil32d.lib and NOT with cutil64d.lib. So this brings me back to my assumption. Was my assumption wrong, in that I expected there to be two sets of source files in the SDK, one for 32 bit and one for 64 bit, with the only difference being the appropriately configured options in the solution file?

(2) How do I compile the sample source files in the SDK. What specifically needs to change under the “Properties” when I right click on the solution in MSVS 2008?

While searching the forum, I came across this similar thread:
http://forums.nvidia.com/index.php?showtopic=180554&st=0&p=1116904&hl=cutil32dlib&fromsearch=1&#entry1116904

The response said to find the cutil file, and then compile that (or so that’s how I understood the response). So I found the cutil_vc90.sln file under the “common” folder under “C”, and then Built that solution. Then I opened up bandwidth sln, again, and try to Rebuild. Instead of the cutil32d.lib error, I get the following:
fatal error LNK1181: cannot open input file ‘shrUtils32D.lib’

So did I mess things up?

I’ve seen several posts recommending the following link for setting up MSVS 2008:
http://www.programmerfish.com/how-to-run-cuda-3-0-on-visual-studio-2008/

That link seems detailed enough that I can try to follow, and if needed, as follow up questions.

However, for now, I’m not starting with a blank file and am simply trying to compile the SDK source files. Although I’m using 64 bit Windows, I’m sure this isn’t really too difficult…just a lack of know how on my part.

Any help is greatly appreciated. Thanks in advance.

Hi!

I looks like you have installed the 64-bit CUDA SDK but the 32-bit examples.

For a 64-bit system, you could still use the 32-bit CUDA SDK together with the 32-bit examples.

You must use the 64-bit GPU drivers.

If you want to use 64-bit CUDA SDK, install the 64-bit examples as well.

You need to be careful when setting the include directories as well as the link dependencies in VS.

Include directories:

Project properties -> Runtime API -> General -> Additional Include directories

Here you should specify your include directories for the 32-bit or 64-bit.

You often have environment variables for this: (CUDA_INC_PATH); (NVSDKCOMPUTE_ROOT)\C\common\inc

Library dependencies:

Project properties -> Linker -> General -> Additional library directories

Here you should specify your library directories for the 32-bit or 64-bit.

Here as well you have environment variables for this: (CUDA_LIB_PATH); (NVSDKCOMPUTE_ROOT)\C\common\lib

Additional dependencies:

Project properties -> Linker -> Input -> Additional Dependencies

Here you should specify the additional dependencies: cutil32.lib (or cutil64.lib for 64-bit) or (cutil32D.lib for debug or cutil64D.lib for Debug and 64-bit) and cudart.lib

If you run 64-bit SDK make sure you have the 64-bit compiler installed.

I have not tried to install both the 32-bit and 64-bit on the same time so i can’t guarantee what will happen. If you still can’t get it to work, try to uninstall the SDK and examples and make a fresh install of either the 32-bit or 64-bit.

GL

My intention was to install EVERYTHING 64 bit, and I thought I did so, thus the reason for my confusion. I have no desire to install 32-bit sdk and 32 bit examples.

How do I install the 64 bit examples. Is that an option I missed during the installation process? Or did I download the wrong installation file?

Thanks.

While waiting for a response, I wanted to see what SDK samples I installed. Unfortunately, the computer only shows NVIDIA GPU Computing SDK 3.2. It isn’t listed as 64-bit or 32-bit.

However, I just went to the download website:
http://developer.nvidia.com/object/cuda_3_2_downloads.html

And I’m confident that I downloaded (and installed) the 64-bit version. That was my intention, as I have no reason for the 32-bit sample programs. Is it possible that a mistake was made and I clicked 32-bit instead? Sure, anythings possible, just doubtful.

Regardless, here’s some simple questions:

(1) If the 64 bit SDK was installed, are the sample MSVS solutions setup with the cutil64.lib and cutil64d.lib files already? Meaning, are the sample solutions ready to run, “out of the box” with a 64 bit installation?

(2) Will removing my curent SDK intallation and then reinstalling the 64-bit SDK cause any issues that I should be aware of?

Thanks.

-Jonathan

Hi!

The 64-bit SDK should contain solutions for 64-bit.

Use the control panel to uninstall.

Uninstall the NVIDA CUDA toolkit and NVIDA GPU Computing SDK

Reinstall the 64-bit versions.

My installed toolkit is ALREADY 64-bit…Control Panel in Windows says as much.

Is there a reason you suggest the uninstalling of the SDK as well as the Toolkit? Or did you assume my toolkit was also 32-bit?

Hi!

I assumed that maybe you installed the Toolkit as 32-bit as well.

I don’t think that the Toolkit is the problem. Uninstall the examples and reinstall them using the 64bit installation.

OKAY. Some I’m not crazy. Per your advice, I uninstalled the previous installation of the SDK, and then reinstalled the 64-bit version (which I’m confident was done the first time). Well, now I KNOW it was done the first time. We’re back to square one and the questions on my original post.

Why?

When I open up a solution file, such as the bindwidthTest_vc90.sln, I immediately checked the Configuration properties, specifically, the “Input” under “Linker”. It is trying to link to cudart.lib cutil32d.lib and shrUtils32d.lib.

So back to my original post:

(1) So my first question: Is that assumption wrong?

Was my assumption wrong, in that I expected there to be two sets of source files in the SDK, one for 32 bit and one for 64 bit, with the only difference being the appropriately configured options in the solution file?

(2) How do I compile the sample source files in the SDK. What specifically needs to change under the “Properties” when I right click on the solution in MSVS 2008?

It just seems so stupid to have a separate 32-bit and 64-bit installation of the SDK when the source files are not set up accordingly. Am I missing something???

Anyone else?

In summary, I want to know, IF you are running Windows 7 64-bit, and IF you installed the 64-bit Toolkit and 64-bit SDK, can you compile the SDK .sln files “right out of the box” without any changes in visual studio.

I canNOT simply by virtue of those .sln files trying to link to 32-bit versions of cutil32d.lib and other such library files. Makes NO sense at all.

So my guess is anyone running 64-bit must make certain changes in order to compile the SDK source solution files?

Thanks.

Does no one know the answer to this? Surely several people have Windows 7 64 bit installed. Is this the wrong section of the forum to post this question?

I am in the same position as you - used CUDA and thought I would try again with Windows 7 64 bit. I downloaded all the 64bit CUDA 4.0.

I am using Visual Express C++ 2010 (which CUDA 4.0 documentation says is supported).

I downloaded WIN 7.1 SDK (since I have C++ Express and not Visual Studio) and want 64bit

I can compile 64bit code perfectly when not using CUDA

bandwidthTest.exe in NVIDIA GPU Computing SDK 4.0\C\bin\win64\Release executes perfectly as do some other .exes I have tried.

Then I looked at CUDA examples in NVIDIA GPU Computing SDK 4.0\C\src

With VC++ Express 2010, I opened clock_vs2010.vcxproj (as one example) - do not know why .sln files are not provided for any 2010 examples

Set Configuration Manager to x64. Set Platform ToolSet to WINSDK7.1

Build got error cutil64.lib does not exist. I think cutil is not meant to be supported anymore but anyway I went to

NVIDIA GPU Computing SDK 4.0\C\common

found cutil_vs2010.vcxproj and with Express C++ 2010 built it successfully in 64bit after setting x64 and Platform ToolSet to WINSDK7.1

Back to Clock and build again

Now my error is

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.0.targets(276,3): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe” -gencode=arch=compute_10,code=“sm_10,compute_10” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I”./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" --keep-dir “x64\Release” -maxrregcount=32 --machine 64 --compile -Xcompiler “/EHsc /nologo /Od /Zi /MD " -o “x64/Release/clock.cu.obj” “C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src\clock\clock.cu”” exited with code -1.

and I am stuck and have been for two days.

So, I have not answered your problem but maybe have provided some clues to assist you to move ahead a little and, my hope, maybe you or someone can advise how I can solve this problem.

PS I am working with examples as when I try to build my pre-existing CUDA programs done with Express C++ 2008 and CUDA 3.2 I get build error

nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found for installation at ‘C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/…/…’)

So rather than try to solve this problem (which is common over the years), I decided to study the examples as I thought they were bound to work. Wrong!

Sorry you’re in a similar boat.

For me, I’m just shocked that (a) no one else has this issue or (b) no one is responding.

From what I read, it seems if you are doing a clean OS intall, most recommend the 64-bit version of Windows…for a variety of obvious and perhaps not-so-obvious reasons.

So if these users are runing Windows 64 bit, and IF they installed the 64-bit Toolkit and SDK, wouldn’t they run into the same problems.

I’m just looking for an answer. Is the 64-bit SDK configured properly? Meaning, are the solution files ready to be compiled and run “right out of the box”, without having to change various dependencies, etc. in the configuration manager. I installed the 64-bit SDK, and all the solution files attempt to link to 32-bit *.lib files. This just makes no sense. If you’re going to have two SDK installation files (32-bit and 64-bit), why not make sure the various *.sln files are configured accordingly???

Or, and this is certainly a possibility, am I just a big dummy who is missing the boat?

I am in the boat too, I think, or perhaps left behind…

Installed 4.0 two days ago. Need it for VS2010.

When I compare SDK 3.2 with 4.0, I see the lib files in question in the lib folders of 3.2, but in 4.0 only a few exist, and have been relocated to x64 and Win32 folders below the lib folders. Linking all of them doesn’t help. I still get missing symbols.

I compiled cutil_vs2010.vcxproj. That produced cutil32D.lib and cutil32D.dll. Haven’t had a chance yet to see how far that gets me.

When compiling shrUtils_vs2010.vcxproj, I get errors missing
‘src\stopwatch_win.cpp’
‘src\stopwatch.cpp’
in file c1xx

And this is where I am right now.

Honestly, I gave up on it. Granted, i wanted to compile the SDK samples and confirm everything worked, but it just wasn’t happening. Additionally, one of the supposed benefits is to then be able to use the “template” *.sln file and then simply modify accordingly; but now we can’t use that template file. Added to my frustration was that no one responded…yet so many recommend using Windows 64-bit. So my guess is there would be many who would know the “answer” to this. Oh well, I digress.

So, as mentioned, I gave up on that quest. I’d still love an answer or explanation. However, more important is working on my small project, for which I was able to manually configure VS2008 and get it to compile.

Regarding VS2010, that’s something else altogether. You still need VS2008 installed, and you can find many posts on the subject, both on this forum and simply by asking our friend google.

I compiled cutil_vs2010.vcxproj and shrUtils_vs2010.vcxproj. The shrUtils_vs2010.vcxproj was missing a couple of cpp files, but these I found elsewhere and simply copied them to where they are expected to be. This then produced the lib files that bandwidthTest refers to. But then I get a long list of “unresolved external symbol”, but no other kind of errors. Below are the two first.

Error 77 error LNK2019: unresolved external symbol “__declspec(dllimport) public: virtual __thiscall std::codecvt_base::~codecvt_base(void)” (_imp??1codecvt_base@std@@UAE@XZ) referenced in function __unwindfunclet$??0?$codecvt@DDH@std@@QAE@I@Z$0 C:\work\CUDA\bandwidthTest.org3\bandwidthTest.cu.obj bandwidthTest

Error 78 error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall std::_Locinfo::~_Locinfo(void)” (_imp??1_Locinfo@std@@QAE@XZ) referenced in function “public: __thiscall std::codecvt<char,char,int>::codecvt<char,char,int>(unsigned int)” (??0?$codecvt@DDH@std@@QAE@I@Z) C:\work\CUDA\bandwidthTest.org3\bandwidthTest.cu.obj bandwidthTest

I have searched for symbols in lib files, using grep, but find no additional lib files I can add in order to get rid of the errors.

I am going to install VS2008 and the 3.2 SDK, unless some miracle happens in the next few minutes or hours.

Let me ask a dummy question here. Apologizes I’ve only skimmed several of the posts so you may already have the answer.

It sounds like you’ve not reset the “solution platform” It is on my first tool bar (I’m sure in an option too) and I can select either “Win32” (typically the default) or “x64”. If I select the Win32 then it uses the compilers you note. If I select x64, it switches to the 64bit compilers.

My guess is you’ve already done this but just checking to make sure.

Unfortunately I hit another problem later when I try to build any of the sample problems, it won’t spawn cmd.exe

Using VC++ Express 2010 I took cutil_vs2010.vcxproj and as you say when first built it reports missing stopwatch.cpp and stopwatch_win.cpp

I copied them from C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\src

to C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\shared\src

Then I was able to build in VC++ Express 2010 after setting

Configuration Manager to x64

and

Platform Toolset to v100 (or WIN7.1SDK) (v90 does not work as is to be expected)

I hope this helps. I do not know why you want to build this item but it gave me another sample to work on.

Other examples still will not build. They all have a CUDA C/C++ on Property pages and under Common / Target Machine Platform

the entry --machine 64. Interestingly, if I change it to --machine32 just to see what happens the Build Command Line shows --machine32

but when the Build is run and fails the command line reported always has --machine64

Using VC++ 2010 Express and changing the Platform Toolset to

v90 (error expected)

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\v90\Microsoft.Cpp.x64.v90.targets(35,5): error MSB8014: Execution path (C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\x86_amd64) could not be found.

v100 (why code 2?)

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.0.targets(276,3): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe” -gencode=arch=compute_10,code=“sm_10,compute_10” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2010 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I”./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" --keep-dir “x64\Release” -maxrregcount=32 --machine 64 --compile -Xcompiler “/EHsc /nologo /Od /Zi /MD " -o “x64/Release/clock.cu.obj” “C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src\clockdarts\clock.cu”” exited with code 2.

WIN7.1SDK (why code -1)

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.0.targets(276,3): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe” -gencode=arch=compute_10,code=“sm_10,compute_10” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64” -I”./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" --keep-dir “x64\Release” -maxrregcount=32 --machine 64 --compile -Xcompiler “/EHsc /nologo /Od /Zi /MD " -o “x64/Release/clock.cu.obj” “C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src\clockdarts\clock.cu”” exited with code -1.

I am on verge of removing all 64-bit, installing all 32bit and seeing if I can get 2010.xproj samples working with 32bit

as I have tried all I can think of with 64bit.

Hi All,

We have just started working with CUDA in VS2008 (Win 7, 64Bit) and tried to run the sample SDK code.

At the beginning, we faced the same problem of not building because of: “cannot open input file ‘shrUtils32D.lib’”

With a slight change in build option, it was solved:

go to Build menu, then configuration manager and set the Platform to x64.

This worked for us, I hope you find it useful too.

Best,

Mohammad.

Hi,
I had the same error “fatal error LNK1181: cannot open input file ‘cutil64D.lib’”. I tried most of the suggestions but I was unable to resolve this error.

Now I will describe about my system and how I get rid of this error.

OS: Windows 7 64 bits
NVIDIA Card: GeForce 220
NVIDIA Toolkit: version 4.0 64 bits
NVIDIA SDK: version 4.0 64 bits
Microsoft Visual Studio 64 bits

Cuda source samples by default are located in the following folder:
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src
When I was compiling any of the samples above errors was occurring.

I simply copy all the samples from “C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\src” to the following folder “C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\CUDALibraries\src”.
Now I am able to compile all samples without any error from this new location.

Regards

I’m a beginner, but have run into the same error listed here. By setting the verbosity in VC++ to “normal”, it’s clear that the error is in the part of the compiler command “–cl-version -ccbin…” What’s missing is the cl-version from this part. If you select v90 or v100 in Platform Toolset, there is a cl-version set, e.g. “–cl-version 2010 --ccbin…” (though of course other errors pop up). So there is clearly something wrong in setting up the value for this particular flag. I have spent a few hours so far without figuring out how to fix it.

I’ve seen posts where others have successfully used Windows7.1SDK, but there must be something else that I’m missing in how I’m setting up VC 2010 Express or the Windows 7.1 SDK.