Compiling with --device-emulation option


I am trying to compile a project including some CUDA code. Compile operation seems good, but when I run the binary, I get the following error:

CUDA error: device emulation mode and device execution mode cannot be mixed

When I look the links of the binary, I get the following:

$ ldd myapp =>  (0xb76fe000) => /home/jerome/cuda/lib/ (0xb76b5000) => /home/jerome/cuda/lib/ (0xb67de000) => /usr/lib/ (0xb5fb8000) => /usr/lib/ (0xb5f31000) => /usr/lib/ (0xb5f2e000) => /usr/lib/ (0xb5f00000) => /usr/lib/ (0xb5e69000) => /usr/lib/ (0xb5e27000) => /usr/lib/ (0xb5dbf000) => /lib/i686/cmov/ (0xb5dbb000) => /lib/i686/cmov/ (0xb5da3000) => /lib/i686/cmov/ (0xb5d9f000) => /usr/lib/ (0xb5cda000) => /lib/i686/cmov/ (0xb5cb4000) => /lib/ (0xb5c97000) => /lib/i686/cmov/ (0xb5c7e000) => /lib/i686/cmov/ (0xb5b35000) => /usr/lib/ (0xb5a44000) => /lib/i686/cmov/ (0xb5a3b000)

	/lib/ (0xb76ff000)

I notice on line 2 that it is linked with . It should be linked with, no? What more than compile --device-emulation should I do?

You have obviously linked it with -lcublas. Try linking it with -lcublasemu and see what happens.