Another double precision issue Find out for which architecture a kernel has been compiled

Hello,

I am trying to build functions using single and double precision, where the user can choose which precision he’d like to use. This of course is limited by the different compile modes (-arch sm_10 / -arch sm_13). What I can state now is the following:

    [*]I can compile double precision kernels by using the -arch sm_13 flag. These functions run well on my 280GTX

    [*]If compiled with -arch sm_13, all kernels (even those not using double) fail when using any older card.

What I’d like to have is a code switch like #ifdef sm_13, which allows for detecting which compilation architecture has been used.

Any clues?

You need to compile separate versions of the kernel for sm_10 and sm_13 and then choose between them at runtime based on the compute capability of the card (which you can get from cudaGetDeviceProperties).

The Mandelbrot sample in the SDK shows how to do this.

Thank you for your response.

That way is even more convenient except the additional work needed to compile two versions…