With a little more C ++, JackOLanterns Answer is slightly modified:
template <unsigned int ARCH> __global__ void kernel(...) { switch(ARCH) { case 35: do something break; case 30: do something else break; case 20: so something else break; default: do something for all other ARCH break; } }
EDIT: to remove the error @ sgar91 indicated:
you can invoke the kernel using the configuration items of your CUDA device requested through
cudaGetDeviceProperties(&props, devId); unsigned int cc = props.major * 10 + props.minor; switch(cc) { case 35: kernel<35><<<1, 1>>>(); break; ... }
Michael haidl
source share