PDA

View Full Version : CUDA and Vista x64, Visual Studio, installation troubles... some fixes...


Panajev2001a
12-Oct-2008, 17:13
(http://forums.nvidia.com/index.php?act=ST&f=124&t=79412&st=0#entry450970)

I have Vista Business 64 bit installed (MSDN AA) and Visual Studio Professional 2008 (full-install, yes, Windows CE stuff included too :P).

CPU: Intel Core 2 Duo 1.67 GHz
GPU: nVIDIA GeForce 8400M GS (256 MB VRAM)
RAM: 3 GB

After I became aware of the problems between CUDA and VS 2008 (to be fixed in CUDA 2.1 IIRC) I decided to install Visual C++ (and C# for XNA 2.0) Express 2005 and rely on the quite recent Windows SDK that Visual Studio 2008 comes with (v6.0A which is the newest one available, besides the Windows Server 2008 one which is v6.1).

At first, as suggested by the download page, I downloaded (nVIDIA GPU driver included) the 64 bit versions of the Toolkit and the SDK and installed them.

To compile the cutil lib (follow this portion of this post of mine even if you install the 32 bit versions of the Toolkit and the SDK [CUDA]), I found VERY useful to set-up VS Express to correctly use the Windows SDK following the help of this page:

http://www.microsoft.com/express/2005/plat...dk/default.aspx (http://www.microsoft.com/express/2005/platformsdk/default.aspx)

(I'd suggest, for step 3, to choose the second suggested way, that is:

"Note: Alternatively, you can update the Visual C++ Directories by modifying the VCProjectEngine.dll.express.config file located in the \vc\vcpackages subdirectory of the Visual C++ Express install location. Please make sure that you also delete the file "vccomponents.dat" located in the "%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0" if it exists before restarting Visual C++ Express Edition. "

)

Up until this point, whether you installed the 64 bit or 32 bit version of the Toolkit and the SDK (CUDA), this is all work you need to do for VS Express 2005.


So far so good with cutil, but then compiling the SDK samples this error came up:

nvcc fatal : Visual Studio configuration file '(null)'

No fix seemed to do the trick until I read somewhere about Perfmon and naturally its Vista younger brother called: Process Monitor (which is a life saver sometimes IMHO).

http://technet.microsoft.com/en-us/sysinte...s/bb896645.aspx (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx)

Setting up a filter for nvcc and trying to compile a random SDK sample I could see where nvcc was having troubles.

(mind you, I was trying to build the solution using the Debug (Win32) configuration compiling a 32 bit target)

It was trying to open the following directory:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64

and then, after I created it, it tried to open this file inside that directory:

vcvarsamd64.bat

whether I created it blank or just used the contents of its 32 bit brother (vcvars32.bat)... I would always receive the following error:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\crtdefs.h(482): error: invalid redeclaration of type name "size_t"

(well there was another warning always about that line in crtdefs.h about a conflict with the "supposed" unsigned long long type of the value... just to give you the whole picture)

This is where I gave up with the 64 bit version of the Toolkit and the SDK... perhaps I could have tried to install a 64 bit compiler for Visual C++ Express 2005, but I think that I can survive without 64 bit optimized CUDA binaries until the next CUDA release, which should bring VS 2008 compatibility, ships.

If someone knows what could have been done to compile in 32 bit mode (like I was trying to do) with the 64 bit versions of the Toolkit and SDK (which seemed to be supported) please do drop a line here because it could save a lot of headaches to people.

I uninstalled both Toolkit and SDK and downloaded and installed their 32 bit brothers... yet another little problem showed up when compiling some samples:

objbase.h(240): error: identifier "IUnknown" is undefined

The following post was particularly useful:

http://forums.nvidia.com/index.php?showtopic=67822

I changed, as suggested in that post, the objbase.h header file (if you double clik on the error you receive in the VS Express 2005 Console it will open the file for you):

// IID_PPV_ARGS(ppType)
// � � ppType is the variable of type IType that will be filled
//
// � � RESULTS in: IID_IType, ppvType
// � � will create a compiler error if wrong level of indirection is used.
//
extern "C++"
{
#include <wtypes.h>
#include <unknwn.h>

� template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
� {
� � � // make sure everyone derives from IUnknown
� � � static_cast<IUnknown*>(*pp);
� � �
� � � return reinterpret_cast<void**>(pp);
� }
}

#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType)

(of course once a VS 2008 compatible version of CUDA ships I'll try to remove the two extra include's and see if they are needed anymore)

Now samples compile and run (DX9 and GL ones too, minus the cudaOpenMP one) with only some minor warnings from within VS Express 2005.

If there is anything you want to suggest, ask, and/or comment please feel free to add your $0.02 to this thread which I hope can be useful to someone trying CUDA for the first time.

Tim Murray
12-Oct-2008, 19:49
I've seen lots of people complaining about the lack of VS2008 support, and okay, sure, it is annoying to keep two versions of an IDE installed... but is VS2008 really that much better? (I haven't started poking at it yet, I probably will this week)

Andrew Lauritzen
12-Oct-2008, 20:08
I've seen lots of people complaining about the lack of VS2008 support, and okay, sure, it is annoying to keep two versions of an IDE installed... but is VS2008 really that much better? (I haven't started poking at it yet, I probably will this week)
VS2008 fixes a bunch of minor template issues and VS2008 SP1 adds some useful TR1 features to MSVC++ (and lots of new .NET stuff of course). 2008 is also the first one with official support for Vista, which avoids some issues with UAC and some GUI glitches.

So no I wouldn't say it's "that much better", but it has a bunch of solid improvements and arguably there's few reasons why people shouldn't support it nowadays, given that it has been out for quite a while. I don't think its unreasonable for people to ask/expect it to be supported.

That said, thanks for the research/instructions! Are the Express versions of MSVC explicitly supported by the CUDA SDK curiously? Because none of them ship with 64-bit compilers, so it's a bit odd for the CUDA SDK to be looking at the 64-bit platform libraries if 32-bit-only Express editions are supported.

Tim Murray
12-Oct-2008, 20:36
VS2008 fixes a bunch of minor template issues and VS2008 SP1 adds some useful TR1 features to MSVC++ (and lots of new .NET stuff of course). 2008 is also the first one with official support for Vista, which avoids some issues with UAC and some GUI glitches.

So no I wouldn't say it's "that much better", but it has a bunch of solid improvements and arguably there's few reasons why people shouldn't support it nowadays, given that it has been out for quite a while. I don't think its unreasonable for people to ask/expect it to be supported.

That said, thanks for the research/instructions! Are the Express versions of MSVC explicitly supported by the CUDA SDK curiously? Because none of them ship with 64-bit compilers, so it's a bit odd for the CUDA SDK to be looking at the 64-bit platform libraries if 32-bit-only Express editions are supported.
Ah, okay, primarily Vista issues. (You can tell how much time I spend in Vista...)

Yeah, it should be supported and will be sometime in the next month or so, I'm just always a bit skeptical of how good it is because of claims (from Microsoft) like "over a thousand customer-reported bugs fixed in VS2008 SP1" and the like. That makes me really nervous about trusting a compiler that had so many bugs in the first place, especially when it's not a brand-new product. Then again, I generally just use Emacs, gdb, gcc and makefiles, so perhaps I'm a bit of a Luddite.

The CUDA toolkit works with MSVC++ 2005 Express. I don't know if it's explicitly supported, but I've also never heard of something that works fine in Visual Studio that fails in Express. x64 is not supported by Express so the 32-bit toolkit has to be used (and cross-compilation--32-bit binaries with the 64-bit toolkit installed--is a bit of an issue on Windows at the moment).

Excellent tutorial though, thanks.

Andrew Lauritzen
13-Oct-2008, 06:15
Yeah, it should be supported and will be sometime in the next month or so, I'm just always a bit skeptical of how good it is because of claims (from Microsoft) like "over a thousand customer-reported bugs fixed in VS2008 SP1" and the like. That makes me really nervous about trusting a compiler that had so many bugs in the first place, especially when it's not a brand-new product.
Yeah but most of that stuff is usually GUI and IDE and similar kind of unimportant issues that most people will rarely run into. The remaining percentage of bugs are distributed among the different products (C++, C#, J#, all the profilers and unit testing, etc. etc.) and probably the libraries as well - .NET being a big one there. And for the few remaining bugs in the actual C++ compiler, they're usually obscure ICEs or template things that can usually be worked-around.

So it's definitely good to keep the fixes coming, but no, it's not like there were any crippling problems with MSVC 2005 :) That said in my experience for any cross-platform project of reasonable size there are work-arounds for the compilers on *every single* platform, so no one should get sitting too comfy ;)

Back on topic though I still have a few things that I've been meaning to play with in CUDA, but ironically now that there's Vista and x64 support, I no longer have an NVIDIA card to play with :(

Panajev2001a
13-Oct-2008, 08:50
VS2008 fixes a bunch of minor template issues and VS2008 SP1 adds some useful TR1 features to MSVC++ (and lots of new .NET stuff of course). 2008 is also the first one with official support for Vista, which avoids some issues with UAC and some GUI glitches.

Not only that, it is the first VS to fully integrate by default with the latest release of the Windows Platform SDK (well besides the update for Windows SDK for Windows Server 2008 which I will likely download as soon as I can because it also includes some new .NET bridges for Vista [it contains wrappers for Vista API's and functions that are not yet natively supported by the .NET Framework]).

So no I wouldn't say it's "that much better", but it has a bunch of solid improvements and arguably there's few reasons why people shouldn't support it nowadays, given that it has been out for quite a while. I don't think its unreasonable for people to ask/expect it to be supported.

That said, thanks for the research/instructions! Are the Express versions of MSVC explicitly supported by the CUDA SDK curiously? Because none of them ship with 64-bit compilers, so it's a bit odd for the CUDA SDK to be looking at the 64-bit platform libraries if 32-bit-only Express editions are supported.

Yes, according to NV people's responses in the forums they are... I think the problem was having installed the 64 bits version of the Toolkit and the SDK (CUDA) and while in theory they seemed geared to work with both 32 bit and 64 bit builds (64 bit if the 64 bit compiler could be found) in practice it does not seem so trivial...