gpustat is a lightweight command-line utility designed to provide quick and easy access to your GPU status. It acts as a convenient wrapper around the powerful nvidia-smi command, simplifying the process of monitoring your graphics processing units.
Installing gpustat is straightforward using pip, the Python package installer. Ensure you have Python and pip installed on your system.
pip install gpustat
The primary function of gpustat is to display detailed statistics about your GPUs. You can easily view information such as GPU utilization, memory usage, temperature, and more.
A key feature of gpustat is its ability to show which processes are currently running on your GPUs. This is invaluable for debugging and understanding resource allocation.
To display GPU statistics along with the process IDs (PIDs) and names running on them, use the following command:
gpustat -cp
The output of gpustat -cp provides a clear overview of your GPU resources. Each line typically represents a GPU and lists its current status, including:
- GPU ID
- GPU Utilization (%)
- Memory Usage (e.g., 1000MiB / 11000MiB)
- Processes running on the GPU (PID, User, Command)
gpustat offers several advantages for developers and system administrators working with NVIDIA GPUs:
- Simplicity: Provides a cleaner and more focused output than raw
nvidia-smi. - Readability: Enhanced formatting makes it easier to quickly grasp GPU status.
- Process Information: Directly shows which applications are consuming GPU resources.
- Convenience: Quick installation and easy-to-remember commands.
For more advanced options and configurations, refer to the official nvidia-smi documentation.