Compiling 32 bits apps under 64 bits CUDA

Hey guys !

I’ve search around the forum and googled a lot, and I can’t find a solution, or better, a tutorial for my problem.

The CUDA toolkit v.2.3 said that:

“The 64-bit versions of the CUDA Toolkit now support compiling 32-bit applications.”

Which is perfect because, that’s what I need to do right now. After messing around the libraries, I’ve mange to find the cutil solution for VS and compile the cutil32D.lib I needed. For a simple test, I took the template example from the SDK (non-compiled, of course). Change the machine to Win32, now I’m stuck with the error message:

.\Debug\template.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Of course the target machine type is ‘X86’, what does it mean the “module machine” ?

I was reading an MSDN article ( it said that it can triggered that error if “The object files specified as input were compiled for different computer types.” That’s what I’m afraid of.

So for all you CUDA gurus there: How do you create an 32 bits CUDA apps with a 64 bits CUDA application.

P.S. Running on a

i7 920

Win7 64 bits

VS Studio 2008 PRO

196.21 Win7 64 bits drivers

2.3 CUDA toolit & SDK

(everything runs fine under x64)

I just CANT believe I would have to uninstall the 64 bits CUDA application and install and x86 one for 32 bits apps, and switch each time I change…

Thank you very much !

nvcc -m32

Ok, I add the -m32 parameter to the custom build of the .cu files ? I add a custom rules for all .cu files ? Could you be a little more precise ? Again, I’m using VS 2008 Pro.

On the other hand, I’ve tried adding the -m32 parameter to the custom build of the “” file.

And I get those kind of link error messages:

>template.obj : error LNK2019: unresolved external symbol _cudaThreadExit@0 referenced in function "void __cdecl runTest(int,char * *)"

And other _cuda methods link error. So I’m thinking maybe I’m missing some libs, other than cudart.lib and cutil32D.lib is there any other lib dependencies I would need to add ?

Thanks again.