4

I'm pretty new to CUDA. I use Microsoft Visual Studio 2010 where I don't need to worry about writing a makefile. A problem arose as I tried to call in a .cu file a device function which was declared in the .h file and defined in another .cu file. At the end of building, I received an error message:

1>ptxas : fatal error : Unresolved extern function '_Z22atomicAddEmulateDoublePdd'

This appears in both CUDA 4.2 and 5.0. I'm wondering how should I configure my MVS to avoid this error. Sorry for the nooby questions and thanks for any suggestion!

biubiuty
  • 493
  • 6
  • 17

1 Answers1

3

CUDA 4.2 and does not support static linking so device functions must be defined in the same compilation unit. A common technique is to write the device function in a .cuh file and include it in the .cu file.

CUDA 5.0 supports a new feature called separate compilation. The CUDA 5.0 VS msbuild rules should be available in the CUDA 5.0 RC download.

Greg Smith
  • 11,007
  • 2
  • 36
  • 37
  • Without separate compilation, I use this method to have a single definition file for both host and device; [link](http://stackoverflow.com/questions/6978643/cuda-and-classes). How to set-up separate compilation? – Ali Naci Erdem May 22 '14 at 17:50