Conditional compilation compilation based on the CC version

Hello

i’m using runtime API CUDA version 3.2 and compile my code for both 1.0 and 2.0 targets.

I wrote two kernels for different parameters:

if (radius > 8)

    {

        if (supported_cc_version < 20)

            {

                cout << "Unsupported parameter radius=" << radius;

                return;

            }

        VarianceLarge <<<>>>();

    }

else 

    VarianceSmall<<<>>>();

In the VarianceLarge function i want to use more than 16kb shared memory with cudaFuncSetCacheConfig() configuration. Of course this will work for the cc 2.0 and higher.

Compilation for 2.0 CC is ok, but compilation for lower cc says “Entry function ‘_Z13VarianceLargePfS_iiii’ uses too much shared data (0x9018 bytes + 0x10 bytes system, 0x4000 max)”.

How can i just skip compilation of this function for lower cc target?

#if __CUDA_ARCH__ >= 200

    ...

#endif