Unify x86/x64 CUDA development file

Hi,

I have a problem:

I develop an application that runs for x86 and also for x64. I installed the CUDA SDK/toolkit for x86.
When I try to install ALSO the x64 sdk/toolkit a message pops saying that

“A version of the NVIDIA CUDA is already installed. In order to continue, setup will need to uninstall the previous version”
:blink:

I need BOTH x86 and x64 installed!

suggestion: Pls, unify the SDK/toolkit. Just put the corresponding .h/.lib/.dll files in a subfolder called x86 and x64. In that way the developers just need to install ONE sdk/toolkit and tell Visual Studio to use the x86 folder for the x86 compilations and the x64 for the x64 ones.

Other alternative if just to allow the developers to install independently the x86 and x64 sdk/toolkit without popping that absurd message…

thx.

I am using cuda x64 compiler but I am producing 32-bit code. I assume you are using Visual Studio with CUDA Build Rules. Here are important elements:

For 32-bit code:

  • CUDA Build Rule → General → Extra Options: -m32
  • Linker → Advanced → Target Machine: MachineX86
  • Linker → General → Additional Library Directories: “C:\NVIDIA\CUDA SDK\C\common\inc”, “C:\NVIDIA\CUDA\lib”

For 64-bit code:

  • CUDA Build Rule → General → Extra Options: -m64
  • Linker → Advanced → Target Machine: MachineX64
  • Linker → General → Additional Library Directories: “C:\NVIDIA\CUDA SDK\C\common\inc”, “C:\NVIDIA\CUDA\lib64”

I have also two versions of environmental variables and use them accordingly in the project.
CUDA_LIB_PATH=C:\NVIDIA\CUDA\lib64
CUDA_LIB_PATH32=C:\NVIDIA\CUDA\lib

(note the C:\NVIDIA is where I install all NVIDIA’s stuff, it may be different on your computer)

You may stumble on using correct cudart.dll file (there is 32 and 64 bit version). I have both of them, but I don’t quite remember how I got them both, but just some copy should resolve that problem. I believe if OS finds two .dll files of the same name, one with 32bit functions and other with 64bit functions it will detect which one is correct at runtime.

Sorry, I set it up a year ago and forgot many details :(
Hope this helps at least partially. Tell us if you have any problems!

Thanks cyg.

Indeed, it’s very easy to solve: Just install the x64 version which already includes the x86 libs/dlls and use the -m32/-m64 to cross-compile