how to compute GPU's max. num. of threads programmatically
===

Can you show how to compute maximum number of threads that can reside in specific GPU using CUDA? I.e. maximum number of threads that I can assign to kernel. Thanks!