How to View All Processes Using GPU Memory in Linux

Abstract: Identify processes consuming NVIDIA GPU memory using nvidia-smi query flags and dynamic monitoring to troubleshoot leaks.

Created: 2026-09-01 by
To view all processes using GPU memory in Linux, you must use the NVIDIA System Management Interface (nvidia-smi) with specific query flags. The most direct method is running nvidia-smi --query-compute-apps=pid,used_memory to list active compute contexts and their memory consumption. This command filters out idle drivers and shows only applications actively allocating VRAM, allowing for precise process management and troubleshooting of memory leaks or high-load tasks.

Prerequisites and Driver Verification

Before attempting to monitor GPU memory, ensure that the proprietary NVIDIA driver is installed and the kernel module is loaded correctly. Open-source Nouveau drivers often lack the necessary persistence mode support required for accurate process tracking. You can verify the installation by checking if the nvidia-smi binary exists in your system path. Run the following command to check for the tool's availability:
nvidia-smi -L
If this command returns a list of GPUs with their names and UUIDs, the driver is functioning. If it fails or returns an error regarding missing libraries, reinstall the NVIDIA driver package appropriate for your distribution. For Ubuntu-based systems, this typically involves installing the nvidia-driver-XXX meta-package via the package manager. Without a properly loaded kernel module, nvidia-smi cannot communicate with the hardware to retrieve process statistics.

Using Query-Compute-Apps for Process Listing

The primary tool for identifying which processes are consuming GPU memory is the --query-compute-apps flag within nvidia-smi. This flag specifically targets compute applications, excluding display servers or other non-compute contexts unless they are also performing calculations. The standard syntax requires specifying the columns you wish to retrieve. The two most critical columns are pid for the process ID and used_memory for the amount of VRAM consumed. Execute the following command to see a clean list of processes:
nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader,nounits
This output will resemble a simple table where each line contains a PID and its corresponding memory usage in megabytes. The --format=csv option ensures machine-readable output, while noheader removes column titles for easier parsing. The nounits flag prevents the addition of "MiB" text, making it simpler to script against if needed. This approach directly answers the need to identify heavy consumers without wading through verbose default outputs.

Monitoring with Dynamic Monitoring (dmon)

For real-time observation rather than a static snapshot, the dmon subcommand provides dynamic monitoring capabilities. This tool updates the screen periodically, showing changes in memory usage, temperature, and utilization. It is particularly useful when debugging applications that leak memory over time or fluctuate significantly in demand. Run the dynamic monitor with the following arguments:
nvidia-smi dmon -i 0 -c 1
The -i 0 flag sets the update interval to zero seconds, meaning it refreshes as fast as possible, while -c 1 limits the number of iterations to one if used in a script, or you can omit -c for continuous monitoring until interrupted with Ctrl+C. The output includes columns for PID, name, type, memory usage, and utilization percentage. This view helps correlate spikes in memory usage with specific application behaviors.

Interpreting Memory Usage Types

It is important to distinguish between different types of GPU memory usage. Compute apps report memory allocated for kernels and data structures. However, some memory may be reserved by the driver for context switching or graphics operations. If nvidia-smi reports high memory usage but no compute apps are listed, the memory might be held by the X server or Wayland compositor. In such cases, checking the --query-gpu options can provide broader context on total available versus free memory.

Scripting and Automation

Integrating these commands into shell scripts allows for automated alerts or cleanup routines. You can parse the CSV output from --query-compute-apps using standard text processing tools like awk or grep. For example, to find any process using more than 5000 MiB of memory, you could construct a pipeline that filters the numeric value. Here is a basic example of how to extract PIDs exceeding a threshold:
nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader,nounits | awk -F',' '$2 > 5000 {print $1}'
This snippet prints only the PIDs of processes consuming excessive VRAM. Such automation is valuable in server environments where resources must be strictly managed. You can combine this with notification services to alert administrators of potential issues before they cause system instability.

Managing High-Memory Processes

Once you have identified the offending processes, you may need to terminate them to free up resources. Use the standard Linux kill command with the PID obtained from the previous steps. Always attempt a graceful termination first using SIGTERM before resorting to SIGKILL.
kill [PID]
If the process does not respond, force its removal with kill -9 [PID]. After killing the process, verify that the memory has been released by running the query command again. Persistent memory leaks might require restarting the entire GPU driver stack, which can be done by reloading the kernel module or rebooting the system. For more detailed guidance on freeing memory, refer to our guide on Freeing GPU Memory in Linux: Boosting Performance and Efficiency.

Frequently Asked Questions

Why does nvidia-smi show memory usage but no processes?

This occurs when the GPU is being used by the display server (X11 or Wayland) or a background service rather than a compute application. The --query-compute-apps flag excludes these graphical contexts. To see all memory allocation, including graphics, use --query-gpu=memory.used,memory.total instead.

How do I monitor GPU memory on AMD GPUs?

NVIDIA-specific tools like nvidia-smi do not work on AMD hardware. Instead, use rocm-smi or radeontop for AMD GPUs. These tools provide similar functionality for listing processes and monitoring VRAM usage on ROCm-enabled systems.

Can I limit GPU memory usage for a specific process?

Yes, you can set environment variables like CUDA_VISIBLE_DEVICES to restrict access, but limiting memory size directly is handled at the application level. Some deep learning frameworks allow setting memory fraction limits. Alternatively, use cgroups or systemd resource controls to limit overall system memory, though this affects RAM, not VRAM specifically.

What causes sudden spikes in GPU memory usage?

Sudden spikes are often caused by large batch sizes in machine learning training, video encoding tasks, or rendering jobs. Check the logs of the active application to see if it is loading new datasets or textures. Reducing batch sizes or optimizing data pipelines can mitigate these spikes.

Is it safe to kill a process using GPU memory?

Killing a process frees the VRAM it holds, but it may crash the application abruptly. Ensure that saving state is possible or that data loss is acceptable. If the process is part of a critical service, coordinate with the application owner before terminating it to avoid data corruption or service interruption.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More