Last active
June 4, 2023 20:32
-
-
Save ShannonScott/0c528f18f68955746893759e2cca1366 to your computer and use it in GitHub Desktop.
[List NVDIA GPUs] Bash array of GPUs in a system. #tags: nvidia, gpu, bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get a list of GPUs in a system | |
# | |
# Useful nvidia-smi Queries | |
# https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries | |
# Get GPU names as a bach array, replace spaces with underscores | |
gpu_names=($(nvidia-smi --query-gpu=gpu_name --format=csv,noheader | tr -s ' ' '_')) | |
for name in "${gpu_names[@]}" | |
do | |
echo $name | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment