double doesnt work in kernel

Hi all

I have a GTX 260 and the specification says that it supports double precision arithmetic. When I use doubles in the kernel it just returns 0 but when I change it to floats it gives the correct output. Am I supposed to do something special to enable double precision?

compile with -arch sm_13

Im using Visual Studio 2005. Must I download something extra for it?

No, but you need to do what tmurray said by going into your project properties and setting that compiler flag…by default, nvcc (which is called by VS to compile the device code) compiles for the older architectures that don’t support the double type.

O ok. Erm im kind of a n00b so where exactly do I set it in visual studio?

You must just add -arch sm_13 in your comand line;

For the example of cppIntegration, my line command is as follow :

(CUDA_BIN_PATH)\nvcc.exe" -arch sm_13 -ccbin "(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"(CUDA_INC_PATH)" -I./ -I../../common/inc -o (ConfigurationName)\cppIntegration.obj cppIntegration.cu

Basically if you have a CUDA rule, unless it supports the “-arch” flag, you need to change your .cu program properties to compile with “custom build step”. The command line will then become nvcc … and here you want to add -arch sm_13.

To get the complete command line, you can copy/paste it the one from your CUDA rules if that’s what you are using now.

Guys, guys. Start from the beginning.

Try opening an SDK sample, right click on its main .cu file (the one that doesn’t have a tiny red icon on it), go into properties, and then you can edit the Custom Build Step. Add nvcc flags there.