Cufft test failing when selecting another device

Hello, I have a very strange error happening that is driving me crazy.
I am able to compile and run fine the cuFFT sample in the PGI directory (with -Mcuda=4.0,cc20). However if I use setDevice to anything other than 0 (I have 2 C2050 and a Quadro NVS 290), I get the error

0: copyin Memcpy (dev=0x210300000, host=0x200300000, size=134217728) FAILED: 11(invalid argument)

when the memory is being copied from host to device (I am assuming). What is even more confusing is that if I compile with -Mcuda=3.2,cc20, selecting any of my devices works fine BUT the calculation of the FFT gives me highly inaccurate answers.

I am running Fedora 14, gcc 4.4.6 and PGI 11.6 compilers.

Thanks for anyones help :)

-Andres[/code]

Hi Andres,

You need to set the device before the first usage, in this case when the device variables are allocated. Otherwise, the variable is allocated on device 0 by default. So when you switch devices, there isn’t space allocated on device 1 and the copy fails.

  • Mat

Thanks so much Mat! It took me a while to figure this one out.