How to know at run time that NVENC and NVDEC sample supports Hardware acceleration.

Can anyone know how to know that NVIDIA Video codec SDK sample either encode through NVENC or decode through NVDEC supports Hardware acceleration on particular system. Is there any function by which i can get weather it supports Hardware acceleration or not, If yes then how can i get weather PC supports hardware or not.

I have the same question too, and did not find an easy solution, but I came up a solution that try to use default parameters to initialize encoder or decoder and check if the encoder or decoder can be initialized successfully, stupid but effective