32 bit CUDA on 64 bit linux does it work?


Is it possible to build a 32-bit CUDA application on 64-bit linux? I ask because I need to link against an existing 32-bit library. How can this be done?



Yes, it can be done.

You need to install the two version with different names and then point to the right one (or use something like Cray modules to select which one you want to use):

64-bit CUDA

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH

32-bit CUDA

#export PATH=/usr/local/cuda32/bin:$PATH
#export LD_LIBRARY_PATH=/usr/local/cuda32/lib:$LD_LIBRARY_PATH

You also need to compile and link with the -m32 flag if the compiler you have defaults to 64 bit.

Won’t this cause an issue when trying to link against libcudart.so which would be 64bit?

It won’t cause an issue if you installed the 32 bit version of CUDA on a 64 bit system, like described above.