Skip to content

Instantly share code, notes, and snippets.

View dangne's full-sized avatar

Dang Nguyen dangne

View GitHub Profile
@dangne
dangne / show_used_gpus.py
Last active June 16, 2022 16:41
Show the number of running and pending GPUs in Slurm (contributors: dangne, hieultp).
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Monitor GPU usage in realtime by running the following command
# watch -n 1 ./show_used_gpus.py -vp research
import argparse
import subprocess
from collections import defaultdict
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)