Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweaked the gpu_users alias to allow for an input of a specific lab, ... #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ gpus_users -v
# Summary of node usage
node_usage
```

Any of the gpu_users command can be followed up with a lab (e.g. cvmlp, rehg, hoffman, etc.) to filter for the usage only in that lab, i.e.

```
gpus_users --cvmlp
gpus_users -q --cvmlp
gpus_users -v --cvmlp
```
15 changes: 7 additions & 8 deletions gpus_users.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ usage_by_lab() {
{
sacctmgr -nop show assoc format=account,user,grptres | grep -v 'root' | grep -v 'test-lab';
squeue -O "UserName,StateCompact,QOS,tres-alloc:1000,Account,Partition" -h | tr -s " " | awk '$0="G> "$0' | grep gpu | sort;
} | awk -f $1 -
} | awk -v labfilter="$2" -f $1 -
}

usage_by_node() {
Expand All @@ -16,15 +16,14 @@ usage_by_node_type() {
} | awk -f $1 -
}


gpus_users() {
if [ $# -eq 1 ]; then
if [[ $1 == "-q" ]]; then
usage_by_lab ~/slurm_usage_utils/lab_usage_qos.awk
elif [[ $1 == "-v" ]]; then
usage_by_lab ~/slurm_usage_utils/lab_usage_verbose.awk
fi
if [[ $1 == "-q" ]]; then
usage_by_lab ~/slurm_usage_utils/lab_usage_qos.awk $2
elif [[ $1 == "-v" ]]; then
usage_by_lab ~/slurm_usage_utils/lab_usage_verbose.awk $2
else
usage_by_lab ~/slurm_usage_utils/lab_usage.awk
usage_by_lab ~/slurm_usage_utils/lab_usage.awk $1
fi
}

Expand Down
5 changes: 5 additions & 0 deletions lab_usage.awk
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ END {
if (lab == "guest-lab") {
continue;
}
if (length(labfilter) != 0) {
if (substr(lab, 0, length(lab)-4) != substr(labfilter,3)) {
continue;
}
}
print_str = sprintf(\
"[ %d/%d/%d ]",
labs_to_gpus_used[lab]["R"],
Expand Down
5 changes: 5 additions & 0 deletions lab_usage_qos.awk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ END {
if (lab == "guest-lab") {
continue;
}
if (length(labfilter) != 0) {
if (substr(lab, 0, length(lab)-4) != substr(labfilter,3)) {
continue;
}
}
print_str = sprintf("[ %d/%d/%d ]", labs_to_gpus_used[lab]["R"], labs_to_gpus_used[lab]["PD"], labs_to_gpus[lab])
printf("| %14s | %-15s |\n", lab, print_str);
if (lab in gpu_counts) {
Expand Down
5 changes: 5 additions & 0 deletions lab_usage_verbose.awk
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ END {
if (lab == "guest-lab") {
continue;
}
if (length(labfilter) != 0) {
if (substr(lab, 0, length(lab)-4) != substr(labfilter,3)) {
continue;
}
}
print_str = sprintf(\
"[ %d / %d / %d (Run/Sched/Total) GPUS]",
labs_to_gpus_used[lab]["R"],
Expand Down