A C-based API for monitoring and managing various states of the NVIDIA GPU devices. NVIDIA Management Library (NVML) provides a direct access to the queries and commands exposed via nvidia-smi. NVML is included with the NVIDIA Linux graphics driver.
To write applications against this library see the NVML developer page: http://developer.nvidia.com/nvidia-management-library-NVML
To include NVML functionality in scripting languages see: http://search.cpan.org/~nvbinding/nvidia-ml-pl/lib/nvidia/ml.pm and http://pypi.python.org/pypi/nvidia-ml-py/